Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Christnowx
Gephi
提交
5086cce8
G
Gephi
项目概览
Christnowx
/
Gephi
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gephi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5086cce8
编写于
5月 18, 2013
作者:
M
Mathieu Bastian
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:gephi/gephi
上级
acbe4bca
c071086d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
696 addition
and
421 deletion
+696
-421
modules/FiltersImpl/src/main/java/org/gephi/filters/FilterControllerImpl.java
...src/main/java/org/gephi/filters/FilterControllerImpl.java
+419
-419
modules/FiltersPlugin/src/main/java/org/gephi/filters/plugin/operator/NOTBuilderNode.java
...ava/org/gephi/filters/plugin/operator/NOTBuilderNode.java
+15
-0
modules/ImportPlugin/src/main/java/org/gephi/io/importer/plugin/file/ImporterBuilderTGF.java
...org/gephi/io/importer/plugin/file/ImporterBuilderTGF.java
+76
-0
modules/ImportPlugin/src/main/java/org/gephi/io/importer/plugin/file/ImporterTGF.java
...n/java/org/gephi/io/importer/plugin/file/ImporterTGF.java
+183
-0
modules/ImportPlugin/src/main/resources/org/gephi/io/importer/plugin/file/Bundle.properties
...urces/org/gephi/io/importer/plugin/file/Bundle.properties
+2
-1
modules/VisualizationImpl/src/main/java/org/gephi/visualization/component/ActionsToolbar.java
...ava/org/gephi/visualization/component/ActionsToolbar.java
+1
-1
未找到文件。
modules/FiltersImpl/src/main/java/org/gephi/filters/FilterControllerImpl.java
浏览文件 @
5086cce8
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package
org.gephi.filters
;
import
java.beans.PropertyEditorManager
;
import
org.gephi.data.attributes.api.AttributeColumn
;
import
org.gephi.data.attributes.api.AttributeController
;
import
org.gephi.data.attributes.api.AttributeModel
;
import
org.gephi.data.attributes.api.AttributeOrigin
;
import
org.gephi.data.attributes.api.AttributeType
;
import
org.gephi.filters.api.FilterController
;
import
org.gephi.filters.api.FilterModel
;
import
org.gephi.filters.api.PropertyExecutor
;
import
org.gephi.filters.api.Query
;
import
org.gephi.filters.api.Range
;
import
org.gephi.filters.FilterThread.PropertyModifier
;
import
org.gephi.filters.spi.*
;
import
org.gephi.graph.api.Edge
;
import
org.gephi.graph.api.Graph
;
import
org.gephi.graph.api.GraphController
;
import
org.gephi.graph.api.GraphModel
;
import
org.gephi.graph.api.GraphView
;
import
org.gephi.graph.api.HierarchicalGraph
;
import
org.gephi.graph.api.Node
;
import
org.gephi.project.api.ProjectController
;
import
org.gephi.utils.progress.Progress
;
import
org.gephi.utils.progress.ProgressTicket
;
import
org.gephi.utils.progress.ProgressTicketProvider
;
import
org.gephi.project.api.Workspace
;
import
org.gephi.project.api.WorkspaceInformation
;
import
org.gephi.project.api.WorkspaceListener
;
import
org.gephi.visualization.api.VisualizationController
;
import
org.openide.util.Lookup
;
import
org.openide.util.lookup.ServiceProvider
;
import
org.openide.util.lookup.ServiceProviders
;
/**
*
* @author Mathieu Bastian
*/
@ServiceProviders
({
@ServiceProvider
(
service
=
FilterController
.
class
),
@ServiceProvider
(
service
=
PropertyExecutor
.
class
)})
public
class
FilterControllerImpl
implements
FilterController
,
PropertyExecutor
{
private
FilterModelImpl
model
;
public
FilterControllerImpl
()
{
//Register range editor
PropertyEditorManager
.
registerEditor
(
Range
.
class
,
RangePropertyEditor
.
class
);
PropertyEditorManager
.
registerEditor
(
AttributeColumn
.
class
,
AttributeColumnPropertyEditor
.
class
);
//Model management
ProjectController
pc
=
Lookup
.
getDefault
().
lookup
(
ProjectController
.
class
);
pc
.
addWorkspaceListener
(
new
WorkspaceListener
()
{
public
void
initialize
(
Workspace
workspace
)
{
workspace
.
add
(
new
FilterModelImpl
(
workspace
));
}
public
void
select
(
Workspace
workspace
)
{
model
=
(
FilterModelImpl
)
workspace
.
getLookup
().
lookup
(
FilterModel
.
class
);
if
(
model
==
null
)
{
model
=
new
FilterModelImpl
(
workspace
);
workspace
.
add
(
model
);
}
}
public
void
unselect
(
Workspace
workspace
)
{
}
public
void
close
(
Workspace
workspace
)
{
FilterModelImpl
m
=
(
FilterModelImpl
)
workspace
.
getLookup
().
lookup
(
FilterModel
.
class
);
if
(
m
!=
null
)
{
m
.
destroy
();
}
}
public
void
disable
()
{
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
if
(
model
!=
null
&&
model
.
getCurrentResult
()
!=
null
&&
graphModel
!=
null
)
{
graphModel
.
destroyView
(
model
.
getCurrentResult
());
model
.
setCurrentResult
(
null
);
}
model
=
null
;
}
});
if
(
pc
.
getCurrentWorkspace
()
!=
null
)
{
Workspace
workspace
=
pc
.
getCurrentWorkspace
();
model
=
(
FilterModelImpl
)
workspace
.
getLookup
().
lookup
(
FilterModel
.
class
);
if
(
model
==
null
)
{
model
=
new
FilterModelImpl
(
workspace
);
workspace
.
add
(
model
);
}
}
}
public
Query
createQuery
(
Filter
filter
)
{
if
(
filter
instanceof
Operator
)
{
return
new
OperatorQueryImpl
((
Operator
)
filter
);
}
return
new
FilterQueryImpl
(
filter
);
}
public
void
add
(
Query
query
)
{
AbstractQueryImpl
absQuery
=
((
AbstractQueryImpl
)
query
);
absQuery
=
absQuery
.
getRoot
();
if
(!
model
.
hasQuery
(
absQuery
))
{
model
.
addFirst
(
absQuery
);
//Init filters with default graph
Graph
graph
=
null
;
if
(
model
!=
null
&&
model
.
getGraphModel
()
!=
null
)
{
graph
=
model
.
getGraphModel
().
getGraph
();
}
else
{
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
graph
=
graphModel
.
getGraph
();
}
for
(
Query
q
:
query
.
getDescendantsAndSelf
())
{
Filter
filter
=
q
.
getFilter
();
if
(
filter
instanceof
NodeFilter
||
filter
instanceof
EdgeFilter
||
filter
instanceof
AttributableFilter
)
{
FilterProcessor
filterProcessor
=
new
FilterProcessor
();
filterProcessor
.
init
(
filter
,
graph
);
}
}
}
}
public
void
remove
(
Query
query
)
{
if
(
model
.
getCurrentQuery
()
==
query
)
{
if
(
model
.
isSelecting
())
{
selectVisible
(
null
);
}
else
{
filterVisible
(
null
);
}
}
query
=
((
AbstractQueryImpl
)
query
).
getRoot
();
model
.
remove
(
query
);
}
public
void
rename
(
Query
query
,
String
name
)
{
model
.
rename
(
query
,
name
);
}
public
void
setSubQuery
(
Query
query
,
Query
subQuery
)
{
//Init subquery when new filter
if
(
subQuery
.
getParent
()
==
null
&&
subQuery
!=
model
.
getCurrentQuery
())
{
Graph
graph
=
null
;
if
(
model
!=
null
&&
model
.
getGraphModel
()
!=
null
)
{
graph
=
model
.
getGraphModel
().
getGraph
();
}
else
{
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
graph
=
graphModel
.
getGraph
();
}
Filter
filter
=
subQuery
.
getFilter
();
if
(
filter
instanceof
NodeFilter
||
filter
instanceof
EdgeFilter
||
filter
instanceof
AttributableFilter
)
{
FilterProcessor
filterProcessor
=
new
FilterProcessor
();
filterProcessor
.
init
(
filter
,
graph
);
}
}
model
.
setSubQuery
(
query
,
subQuery
);
}
public
void
removeSubQuery
(
Query
query
,
Query
parent
)
{
model
.
removeSubQuery
(
query
,
parent
);
}
public
void
filterVisible
(
Query
query
)
{
if
(
query
!=
null
&&
model
.
getCurrentQuery
()
==
query
&&
model
.
isFiltering
())
{
return
;
}
model
.
setFiltering
(
query
!=
null
);
model
.
setCurrentQuery
(
query
);
if
(
model
.
getFilterThread
()
!=
null
)
{
model
.
getFilterThread
().
setRunning
(
false
);
model
.
setFilterThread
(
null
);
}
if
(
query
!=
null
)
{
FilterThread
filterThread
=
new
FilterThread
(
model
);
model
.
setFilterThread
(
filterThread
);
filterThread
.
setRootQuery
((
AbstractQueryImpl
)
query
);
filterThread
.
start
();
}
else
{
model
.
getGraphModel
().
setVisibleView
(
null
);
if
(
model
.
getCurrentResult
()
!=
null
)
{
model
.
getGraphModel
().
destroyView
(
model
.
getCurrentResult
());
model
.
setCurrentResult
(
null
);
}
}
}
public
GraphView
filter
(
Query
query
)
{
FilterProcessor
processor
=
new
FilterProcessor
();
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
Graph
result
=
processor
.
process
((
AbstractQueryImpl
)
query
,
graphModel
);
return
result
.
getView
();
}
public
void
selectVisible
(
Query
query
)
{
if
(
query
!=
null
&&
model
.
getCurrentQuery
()
==
query
&&
model
.
isSelecting
())
{
return
;
}
model
.
setSelecting
(
query
!=
null
);
model
.
setCurrentQuery
(
query
);
if
(
model
.
getFilterThread
()
!=
null
)
{
model
.
getFilterThread
().
setRunning
(
false
);
model
.
setFilterThread
(
null
);
}
model
.
getGraphModel
().
setVisibleView
(
null
);
if
(
model
.
getCurrentResult
()
!=
null
)
{
model
.
getGraphModel
().
destroyView
(
model
.
getCurrentResult
());
model
.
setCurrentResult
(
null
);
}
if
(
query
!=
null
)
{
FilterThread
filterThread
=
new
FilterThread
(
model
);
model
.
setFilterThread
(
filterThread
);
filterThread
.
setRootQuery
((
AbstractQueryImpl
)
query
);
filterThread
.
start
();
}
else
{
VisualizationController
visController
=
Lookup
.
getDefault
().
lookup
(
VisualizationController
.
class
);
if
(
visController
!=
null
)
{
visController
.
selectNodes
(
null
);
}
}
}
public
void
exportToColumn
(
String
title
,
Query
query
)
{
HierarchicalGraph
result
;
if
(
model
.
getCurrentQuery
()
==
query
)
{
GraphView
view
=
model
.
getCurrentResult
();
if
(
view
!=
null
)
{
return
;
}
result
=
model
.
getGraphModel
().
getHierarchicalGraph
(
view
);
}
else
{
FilterProcessor
processor
=
new
FilterProcessor
();
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
result
=
(
HierarchicalGraph
)
processor
.
process
((
AbstractQueryImpl
)
query
,
graphModel
);
}
AttributeModel
am
=
Lookup
.
getDefault
().
lookup
(
AttributeController
.
class
).
getModel
();
AttributeColumn
nodeCol
=
am
.
getNodeTable
().
getColumn
(
"filter_"
+
title
);
if
(
nodeCol
==
null
)
{
nodeCol
=
am
.
getNodeTable
().
addColumn
(
"filter_"
+
title
,
title
,
AttributeType
.
BOOLEAN
,
AttributeOrigin
.
COMPUTED
,
Boolean
.
FALSE
);
}
AttributeColumn
edgeCol
=
am
.
getEdgeTable
().
getColumn
(
"filter_"
+
title
);
if
(
edgeCol
==
null
)
{
edgeCol
=
am
.
getEdgeTable
().
addColumn
(
"filter_"
+
title
,
title
,
AttributeType
.
BOOLEAN
,
AttributeOrigin
.
COMPUTED
,
Boolean
.
FALSE
);
}
result
.
readLock
();
for
(
Node
n
:
result
.
getNodes
())
{
n
.
getNodeData
().
getAttributes
().
setValue
(
nodeCol
.
getIndex
(),
Boolean
.
TRUE
);
}
for
(
Edge
e
:
result
.
getEdgesAndMetaEdges
())
{
e
.
getEdgeData
().
getAttributes
().
setValue
(
edgeCol
.
getIndex
(),
Boolean
.
TRUE
);
}
result
.
readUnlock
();
//StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(FilterControllerImpl.class, "FilterController.exportToColumn.status", title));
}
public
void
exportToNewWorkspace
(
Query
query
)
{
HierarchicalGraph
result
;
if
(
model
.
getCurrentQuery
()
==
query
)
{
GraphView
view
=
model
.
getCurrentResult
();
if
(
view
==
null
)
{
return
;
}
result
=
model
.
getGraphModel
().
getHierarchicalGraph
(
view
);
}
else
{
FilterProcessor
processor
=
new
FilterProcessor
();
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
result
=
(
HierarchicalGraph
)
processor
.
process
((
AbstractQueryImpl
)
query
,
graphModel
);
}
final
HierarchicalGraph
graphView
=
result
;
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
ProgressTicketProvider
progressProvider
=
Lookup
.
getDefault
().
lookup
(
ProgressTicketProvider
.
class
);
ProgressTicket
ticket
=
null
;
if
(
progressProvider
!=
null
)
{
ticket
=
progressProvider
.
createTicket
(
"Export to workspace"
,
null
);
}
Progress
.
start
(
ticket
);
ProjectController
pc
=
Lookup
.
getDefault
().
lookup
(
ProjectController
.
class
);
Workspace
newWorkspace
=
pc
.
duplicateWorkspace
(
pc
.
getCurrentWorkspace
());
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
(
newWorkspace
);
graphModel
.
clear
();
graphModel
.
pushFrom
(
graphView
);
Progress
.
finish
(
ticket
);
String
workspaceName
=
newWorkspace
.
getLookup
().
lookup
(
WorkspaceInformation
.
class
).
getName
();
//StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(FilterControllerImpl.class, "FilterController.exportToNewWorkspace.status", workspaceName));
}
},
"Export filter to workspace"
).
start
();
}
public
void
exportToLabelVisible
(
Query
query
)
{
HierarchicalGraph
result
;
if
(
model
.
getCurrentQuery
()
==
query
)
{
GraphView
view
=
model
.
getCurrentResult
();
if
(
view
==
null
)
{
return
;
}
result
=
model
.
getGraphModel
().
getHierarchicalGraph
(
view
);
}
else
{
FilterProcessor
processor
=
new
FilterProcessor
();
result
=
(
HierarchicalGraph
)
processor
.
process
((
AbstractQueryImpl
)
query
,
model
.
getGraphModel
());
}
HierarchicalGraph
fullHGraph
=
model
.
getGraphModel
().
getHierarchicalGraph
();
fullHGraph
.
readLock
();
for
(
Node
n
:
fullHGraph
.
getNodes
())
{
boolean
inView
=
n
.
getNodeData
().
getNode
(
result
.
getView
().
getViewId
())
!=
null
;
n
.
getNodeData
().
getTextData
().
setVisible
(
inView
);
}
for
(
Edge
e
:
fullHGraph
.
getEdgesAndMetaEdges
())
{
boolean
inView
=
result
.
contains
(
e
);
e
.
getEdgeData
().
getTextData
().
setVisible
(
inView
);
}
fullHGraph
.
readUnlock
();
}
public
void
setAutoRefresh
(
boolean
autoRefresh
)
{
if
(
model
!=
null
)
{
model
.
setAutoRefresh
(
autoRefresh
);
}
}
public
void
setCurrentQuery
(
Query
query
)
{
if
(
model
!=
null
)
{
model
.
setCurrentQuery
(
query
);
}
}
public
FilterModel
getModel
()
{
return
model
;
}
public
synchronized
FilterModel
getModel
(
Workspace
workspace
)
{
FilterModel
filterModel
=
workspace
.
getLookup
().
lookup
(
FilterModel
.
class
);
if
(
filterModel
==
null
)
{
filterModel
=
new
FilterModelImpl
(
workspace
);
workspace
.
add
(
filterModel
);
}
return
filterModel
;
}
public
void
setValue
(
FilterProperty
property
,
Object
value
,
Callback
callback
)
{
if
(
model
!=
null
)
{
Query
query
=
model
.
getQuery
(
property
.
getFilter
());
if
(
query
==
null
)
{
callback
.
setValue
(
value
);
return
;
}
AbstractQueryImpl
rootQuery
=
((
AbstractQueryImpl
)
query
).
getRoot
();
FilterThread
filterThread
=
null
;
if
((
filterThread
=
model
.
getFilterThread
())
!=
null
&&
model
.
getCurrentQuery
()
==
rootQuery
)
{
if
(
Thread
.
currentThread
().
equals
(
filterThread
))
{
//Called inside of the thread, in init for instance. Update normally.
callback
.
setValue
(
value
);
model
.
updateParameters
(
query
);
}
else
{
//The query is currently being filtered by the thread, or finished to do it
filterThread
.
addModifier
(
new
PropertyModifier
(
query
,
property
,
value
,
callback
));
filterThread
.
setRootQuery
(
rootQuery
);
}
}
else
{
//Update normally
callback
.
setValue
(
value
);
model
.
updateParameters
(
query
);
}
}
else
{
callback
.
setValue
(
value
);
}
}
}
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package
org.gephi.filters
;
import
java.beans.PropertyEditorManager
;
import
org.gephi.data.attributes.api.AttributeColumn
;
import
org.gephi.data.attributes.api.AttributeController
;
import
org.gephi.data.attributes.api.AttributeModel
;
import
org.gephi.data.attributes.api.AttributeOrigin
;
import
org.gephi.data.attributes.api.AttributeType
;
import
org.gephi.filters.api.FilterController
;
import
org.gephi.filters.api.FilterModel
;
import
org.gephi.filters.api.PropertyExecutor
;
import
org.gephi.filters.api.Query
;
import
org.gephi.filters.api.Range
;
import
org.gephi.filters.FilterThread.PropertyModifier
;
import
org.gephi.filters.spi.*
;
import
org.gephi.graph.api.Edge
;
import
org.gephi.graph.api.Graph
;
import
org.gephi.graph.api.GraphController
;
import
org.gephi.graph.api.GraphModel
;
import
org.gephi.graph.api.GraphView
;
import
org.gephi.graph.api.HierarchicalGraph
;
import
org.gephi.graph.api.Node
;
import
org.gephi.project.api.ProjectController
;
import
org.gephi.utils.progress.Progress
;
import
org.gephi.utils.progress.ProgressTicket
;
import
org.gephi.utils.progress.ProgressTicketProvider
;
import
org.gephi.project.api.Workspace
;
import
org.gephi.project.api.WorkspaceInformation
;
import
org.gephi.project.api.WorkspaceListener
;
import
org.gephi.visualization.api.VisualizationController
;
import
org.openide.util.Lookup
;
import
org.openide.util.lookup.ServiceProvider
;
import
org.openide.util.lookup.ServiceProviders
;
/**
*
* @author Mathieu Bastian
*/
@ServiceProviders
({
@ServiceProvider
(
service
=
FilterController
.
class
),
@ServiceProvider
(
service
=
PropertyExecutor
.
class
)})
public
class
FilterControllerImpl
implements
FilterController
,
PropertyExecutor
{
private
FilterModelImpl
model
;
public
FilterControllerImpl
()
{
//Register range editor
PropertyEditorManager
.
registerEditor
(
Range
.
class
,
RangePropertyEditor
.
class
);
PropertyEditorManager
.
registerEditor
(
AttributeColumn
.
class
,
AttributeColumnPropertyEditor
.
class
);
//Model management
ProjectController
pc
=
Lookup
.
getDefault
().
lookup
(
ProjectController
.
class
);
pc
.
addWorkspaceListener
(
new
WorkspaceListener
()
{
public
void
initialize
(
Workspace
workspace
)
{
workspace
.
add
(
new
FilterModelImpl
(
workspace
));
}
public
void
select
(
Workspace
workspace
)
{
model
=
(
FilterModelImpl
)
workspace
.
getLookup
().
lookup
(
FilterModel
.
class
);
if
(
model
==
null
)
{
model
=
new
FilterModelImpl
(
workspace
);
workspace
.
add
(
model
);
}
}
public
void
unselect
(
Workspace
workspace
)
{
}
public
void
close
(
Workspace
workspace
)
{
FilterModelImpl
m
=
(
FilterModelImpl
)
workspace
.
getLookup
().
lookup
(
FilterModel
.
class
);
if
(
m
!=
null
)
{
m
.
destroy
();
}
}
public
void
disable
()
{
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
if
(
model
!=
null
&&
model
.
getCurrentResult
()
!=
null
&&
graphModel
!=
null
)
{
graphModel
.
destroyView
(
model
.
getCurrentResult
());
model
.
setCurrentResult
(
null
);
}
model
=
null
;
}
});
if
(
pc
.
getCurrentWorkspace
()
!=
null
)
{
Workspace
workspace
=
pc
.
getCurrentWorkspace
();
model
=
(
FilterModelImpl
)
workspace
.
getLookup
().
lookup
(
FilterModel
.
class
);
if
(
model
==
null
)
{
model
=
new
FilterModelImpl
(
workspace
);
workspace
.
add
(
model
);
}
}
}
public
Query
createQuery
(
Filter
filter
)
{
if
(
filter
instanceof
Operator
)
{
return
new
OperatorQueryImpl
((
Operator
)
filter
);
}
return
new
FilterQueryImpl
(
filter
);
}
public
void
add
(
Query
query
)
{
AbstractQueryImpl
absQuery
=
((
AbstractQueryImpl
)
query
);
absQuery
=
absQuery
.
getRoot
();
if
(!
model
.
hasQuery
(
absQuery
))
{
model
.
addFirst
(
absQuery
);
//Init filters with default graph
Graph
graph
=
null
;
if
(
model
!=
null
&&
model
.
getGraphModel
()
!=
null
)
{
graph
=
model
.
getGraphModel
().
getGraph
();
}
else
{
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
graph
=
graphModel
.
getGraph
();
}
for
(
Query
q
:
query
.
getDescendantsAndSelf
())
{
Filter
filter
=
q
.
getFilter
();
if
(
filter
instanceof
NodeFilter
||
filter
instanceof
EdgeFilter
||
filter
instanceof
AttributableFilter
)
{
FilterProcessor
filterProcessor
=
new
FilterProcessor
();
filterProcessor
.
init
(
filter
,
graph
);
}
}
}
}
public
void
remove
(
Query
query
)
{
if
(
model
.
getCurrentQuery
()
==
query
)
{
if
(
model
.
isSelecting
())
{
selectVisible
(
null
);
}
else
{
filterVisible
(
null
);
}
}
query
=
((
AbstractQueryImpl
)
query
).
getRoot
();
model
.
remove
(
query
);
}
public
void
rename
(
Query
query
,
String
name
)
{
model
.
rename
(
query
,
name
);
}
public
void
setSubQuery
(
Query
query
,
Query
subQuery
)
{
//Init subquery when new filter
if
(
subQuery
.
getParent
()
==
null
&&
subQuery
!=
model
.
getCurrentQuery
())
{
Graph
graph
=
null
;
if
(
model
!=
null
&&
model
.
getGraphModel
()
!=
null
)
{
graph
=
model
.
getGraphModel
().
getGraph
();
}
else
{
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
graph
=
graphModel
.
getGraph
();
}
Filter
filter
=
subQuery
.
getFilter
();
if
(
filter
instanceof
NodeFilter
||
filter
instanceof
EdgeFilter
||
filter
instanceof
AttributableFilter
)
{
FilterProcessor
filterProcessor
=
new
FilterProcessor
();
filterProcessor
.
init
(
filter
,
graph
);
}
}
model
.
setSubQuery
(
query
,
subQuery
);
}
public
void
removeSubQuery
(
Query
query
,
Query
parent
)
{
model
.
removeSubQuery
(
query
,
parent
);
}
public
void
filterVisible
(
Query
query
)
{
if
(
query
!=
null
&&
model
.
getCurrentQuery
()
==
query
&&
model
.
isFiltering
())
{
return
;
}
model
.
setFiltering
(
query
!=
null
);
model
.
setCurrentQuery
(
query
);
if
(
model
.
getFilterThread
()
!=
null
)
{
model
.
getFilterThread
().
setRunning
(
false
);
model
.
setFilterThread
(
null
);
}
if
(
query
!=
null
)
{
FilterThread
filterThread
=
new
FilterThread
(
model
);
model
.
setFilterThread
(
filterThread
);
filterThread
.
setRootQuery
((
AbstractQueryImpl
)
query
);
filterThread
.
start
();
}
else
{
model
.
getGraphModel
().
setVisibleView
(
null
);
if
(
model
.
getCurrentResult
()
!=
null
)
{
model
.
getGraphModel
().
destroyView
(
model
.
getCurrentResult
());
model
.
setCurrentResult
(
null
);
}
}
}
public
GraphView
filter
(
Query
query
)
{
FilterProcessor
processor
=
new
FilterProcessor
();
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
Graph
result
=
processor
.
process
((
AbstractQueryImpl
)
query
,
graphModel
);
return
result
.
getView
();
}
public
void
selectVisible
(
Query
query
)
{
if
(
query
!=
null
&&
model
.
getCurrentQuery
()
==
query
&&
model
.
isSelecting
())
{
return
;
}
model
.
setSelecting
(
query
!=
null
);
model
.
setCurrentQuery
(
query
);
if
(
model
.
getFilterThread
()
!=
null
)
{
model
.
getFilterThread
().
setRunning
(
false
);
model
.
setFilterThread
(
null
);
}
model
.
getGraphModel
().
setVisibleView
(
null
);
if
(
model
.
getCurrentResult
()
!=
null
)
{
model
.
getGraphModel
().
destroyView
(
model
.
getCurrentResult
());
model
.
setCurrentResult
(
null
);
}
if
(
query
!=
null
)
{
FilterThread
filterThread
=
new
FilterThread
(
model
);
model
.
setFilterThread
(
filterThread
);
filterThread
.
setRootQuery
((
AbstractQueryImpl
)
query
);
filterThread
.
start
();
}
else
{
VisualizationController
visController
=
Lookup
.
getDefault
().
lookup
(
VisualizationController
.
class
);
if
(
visController
!=
null
)
{
visController
.
selectNodes
(
null
);
}
}
}
public
void
exportToColumn
(
String
title
,
Query
query
)
{
HierarchicalGraph
result
;
if
(
model
.
getCurrentQuery
()
==
query
)
{
GraphView
view
=
model
.
getCurrentResult
();
if
(
view
==
null
)
{
return
;
}
result
=
model
.
getGraphModel
().
getHierarchicalGraph
(
view
);
}
else
{
FilterProcessor
processor
=
new
FilterProcessor
();
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
result
=
(
HierarchicalGraph
)
processor
.
process
((
AbstractQueryImpl
)
query
,
graphModel
);
}
AttributeModel
am
=
Lookup
.
getDefault
().
lookup
(
AttributeController
.
class
).
getModel
();
AttributeColumn
nodeCol
=
am
.
getNodeTable
().
getColumn
(
"filter_"
+
title
);
if
(
nodeCol
==
null
)
{
nodeCol
=
am
.
getNodeTable
().
addColumn
(
"filter_"
+
title
,
title
,
AttributeType
.
BOOLEAN
,
AttributeOrigin
.
COMPUTED
,
Boolean
.
FALSE
);
}
AttributeColumn
edgeCol
=
am
.
getEdgeTable
().
getColumn
(
"filter_"
+
title
);
if
(
edgeCol
==
null
)
{
edgeCol
=
am
.
getEdgeTable
().
addColumn
(
"filter_"
+
title
,
title
,
AttributeType
.
BOOLEAN
,
AttributeOrigin
.
COMPUTED
,
Boolean
.
FALSE
);
}
result
.
readLock
();
for
(
Node
n
:
result
.
getNodes
())
{
n
.
getNodeData
().
getAttributes
().
setValue
(
nodeCol
.
getIndex
(),
Boolean
.
TRUE
);
}
for
(
Edge
e
:
result
.
getEdgesAndMetaEdges
())
{
e
.
getEdgeData
().
getAttributes
().
setValue
(
edgeCol
.
getIndex
(),
Boolean
.
TRUE
);
}
result
.
readUnlock
();
//StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(FilterControllerImpl.class, "FilterController.exportToColumn.status", title));
}
public
void
exportToNewWorkspace
(
Query
query
)
{
HierarchicalGraph
result
;
if
(
model
.
getCurrentQuery
()
==
query
)
{
GraphView
view
=
model
.
getCurrentResult
();
if
(
view
==
null
)
{
return
;
}
result
=
model
.
getGraphModel
().
getHierarchicalGraph
(
view
);
}
else
{
FilterProcessor
processor
=
new
FilterProcessor
();
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
();
result
=
(
HierarchicalGraph
)
processor
.
process
((
AbstractQueryImpl
)
query
,
graphModel
);
}
final
HierarchicalGraph
graphView
=
result
;
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
ProgressTicketProvider
progressProvider
=
Lookup
.
getDefault
().
lookup
(
ProgressTicketProvider
.
class
);
ProgressTicket
ticket
=
null
;
if
(
progressProvider
!=
null
)
{
ticket
=
progressProvider
.
createTicket
(
"Export to workspace"
,
null
);
}
Progress
.
start
(
ticket
);
ProjectController
pc
=
Lookup
.
getDefault
().
lookup
(
ProjectController
.
class
);
Workspace
newWorkspace
=
pc
.
duplicateWorkspace
(
pc
.
getCurrentWorkspace
());
GraphModel
graphModel
=
Lookup
.
getDefault
().
lookup
(
GraphController
.
class
).
getModel
(
newWorkspace
);
graphModel
.
clear
();
graphModel
.
pushFrom
(
graphView
);
Progress
.
finish
(
ticket
);
String
workspaceName
=
newWorkspace
.
getLookup
().
lookup
(
WorkspaceInformation
.
class
).
getName
();
//StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(FilterControllerImpl.class, "FilterController.exportToNewWorkspace.status", workspaceName));
}
},
"Export filter to workspace"
).
start
();
}
public
void
exportToLabelVisible
(
Query
query
)
{
HierarchicalGraph
result
;
if
(
model
.
getCurrentQuery
()
==
query
)
{
GraphView
view
=
model
.
getCurrentResult
();
if
(
view
==
null
)
{
return
;
}
result
=
model
.
getGraphModel
().
getHierarchicalGraph
(
view
);
}
else
{
FilterProcessor
processor
=
new
FilterProcessor
();
result
=
(
HierarchicalGraph
)
processor
.
process
((
AbstractQueryImpl
)
query
,
model
.
getGraphModel
());
}
HierarchicalGraph
fullHGraph
=
model
.
getGraphModel
().
getHierarchicalGraph
();
fullHGraph
.
readLock
();
for
(
Node
n
:
fullHGraph
.
getNodes
())
{
boolean
inView
=
n
.
getNodeData
().
getNode
(
result
.
getView
().
getViewId
())
!=
null
;
n
.
getNodeData
().
getTextData
().
setVisible
(
inView
);
}
for
(
Edge
e
:
fullHGraph
.
getEdgesAndMetaEdges
())
{
boolean
inView
=
result
.
contains
(
e
);
e
.
getEdgeData
().
getTextData
().
setVisible
(
inView
);
}
fullHGraph
.
readUnlock
();
}
public
void
setAutoRefresh
(
boolean
autoRefresh
)
{
if
(
model
!=
null
)
{
model
.
setAutoRefresh
(
autoRefresh
);
}
}
public
void
setCurrentQuery
(
Query
query
)
{
if
(
model
!=
null
)
{
model
.
setCurrentQuery
(
query
);
}
}
public
FilterModel
getModel
()
{
return
model
;
}
public
synchronized
FilterModel
getModel
(
Workspace
workspace
)
{
FilterModel
filterModel
=
workspace
.
getLookup
().
lookup
(
FilterModel
.
class
);
if
(
filterModel
==
null
)
{
filterModel
=
new
FilterModelImpl
(
workspace
);
workspace
.
add
(
filterModel
);
}
return
filterModel
;
}
public
void
setValue
(
FilterProperty
property
,
Object
value
,
Callback
callback
)
{
if
(
model
!=
null
)
{
Query
query
=
model
.
getQuery
(
property
.
getFilter
());
if
(
query
==
null
)
{
callback
.
setValue
(
value
);
return
;
}
AbstractQueryImpl
rootQuery
=
((
AbstractQueryImpl
)
query
).
getRoot
();
FilterThread
filterThread
=
null
;
if
((
filterThread
=
model
.
getFilterThread
())
!=
null
&&
model
.
getCurrentQuery
()
==
rootQuery
)
{
if
(
Thread
.
currentThread
().
equals
(
filterThread
))
{
//Called inside of the thread, in init for instance. Update normally.
callback
.
setValue
(
value
);
model
.
updateParameters
(
query
);
}
else
{
//The query is currently being filtered by the thread, or finished to do it
filterThread
.
addModifier
(
new
PropertyModifier
(
query
,
property
,
value
,
callback
));
filterThread
.
setRootQuery
(
rootQuery
);
}
}
else
{
//Update normally
callback
.
setValue
(
value
);
model
.
updateParameters
(
query
);
}
}
else
{
callback
.
setValue
(
value
);
}
}
}
modules/FiltersPlugin/src/main/java/org/gephi/filters/plugin/operator/NOTBuilderNode.java
浏览文件 @
5086cce8
...
...
@@ -45,6 +45,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
javax.swing.Icon
;
import
javax.swing.JPanel
;
import
org.gephi.filters.spi.AttributableFilter
;
import
org.gephi.filters.spi.Category
;
import
org.gephi.filters.spi.Filter
;
import
org.gephi.filters.spi.FilterBuilder
;
...
...
@@ -157,6 +158,20 @@ public class NOTBuilderNode implements FilterBuilder {
}
nodeFilter
.
finish
();
}
if
(
filter
instanceof
AttributableFilter
&&
((
AttributableFilter
)
filter
).
getType
()==
AttributableFilter
.
Type
.
NODE
&&
((
AttributableFilter
)
filter
).
init
(
hgraph
))
{
List
<
Node
>
nodeToRemove
=
new
ArrayList
<
Node
>();
AttributableFilter
attributableFilter
=
(
AttributableFilter
)
filter
;
for
(
Node
n
:
hgraph
.
getNodes
().
toArray
())
{
if
(
attributableFilter
.
evaluate
(
hgraph
,
n
))
{
nodeToRemove
.
add
(
n
);
}
}
for
(
Node
n
:
nodeToRemove
)
{
hgraph
.
removeNode
(
n
);
}
attributableFilter
.
finish
();
}
return
hgraph
;
}
...
...
modules/ImportPlugin/src/main/java/org/gephi/io/importer/plugin/file/ImporterBuilderTGF.java
0 → 100644
浏览文件 @
5086cce8
/*
Copyright 2008-2010 Gephi
Authors : rlfnb
Website : http://www.gephi.org
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package
org.gephi.io.importer.plugin.file
;
import
org.gephi.io.importer.api.FileType
;
import
org.gephi.io.importer.spi.FileImporter
;
import
org.gephi.io.importer.spi.FileImporterBuilder
;
import
org.openide.filesystems.FileObject
;
import
org.openide.util.NbBundle
;
import
org.openide.util.lookup.ServiceProvider
;
/**
*
* @author rlfnb
*/
@ServiceProvider
(
service
=
FileImporterBuilder
.
class
)
public
final
class
ImporterBuilderTGF
implements
FileImporterBuilder
{
public
static
final
String
IDENTIFER
=
"tgf"
;
public
FileImporter
buildImporter
()
{
return
new
ImporterTGF
();
}
public
String
getName
()
{
return
IDENTIFER
;
}
public
FileType
[]
getFileTypes
()
{
FileType
ft
=
new
FileType
(
".tgf"
,
NbBundle
.
getMessage
(
getClass
(),
"fileType_TGF_Name"
));
return
new
FileType
[]{
ft
};
}
public
boolean
isMatchingImporter
(
FileObject
fileObject
)
{
return
fileObject
.
getExt
().
equalsIgnoreCase
(
"tgf"
);
}
}
modules/ImportPlugin/src/main/java/org/gephi/io/importer/plugin/file/ImporterTGF.java
0 → 100644
浏览文件 @
5086cce8
/*
Copyright 2008-2010 Gephi
Authors : rlfnb
Website : http://www.gephi.org
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package
org.gephi.io.importer.plugin.file
;
import
java.io.LineNumberReader
;
import
java.io.Reader
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
org.gephi.io.importer.api.ContainerLoader
;
import
org.gephi.io.importer.api.EdgeDraft
;
import
org.gephi.io.importer.api.ImportUtils
;
import
org.gephi.io.importer.api.NodeDraft
;
import
org.gephi.io.importer.api.Report
;
import
org.gephi.io.importer.spi.FileImporter
;
import
org.gephi.utils.longtask.spi.LongTask
;
import
org.gephi.utils.progress.Progress
;
import
org.gephi.utils.progress.ProgressTicket
;
/**
*
* @author rlfnb
*/
public
class
ImporterTGF
implements
FileImporter
,
LongTask
{
//Architecture
private
Reader
reader
;
private
ContainerLoader
container
;
private
Report
report
;
private
ProgressTicket
progressTicket
;
private
boolean
cancel
=
false
;
public
boolean
execute
(
ContainerLoader
container
)
{
this
.
container
=
container
;
this
.
report
=
new
Report
();
LineNumberReader
lineReader
=
ImportUtils
.
getTextReader
(
reader
);
try
{
importData
(
lineReader
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
return
!
cancel
;
}
private
void
importData
(
LineNumberReader
reader
)
throws
Exception
{
Progress
.
start
(
progressTicket
);
//Progress
List
<
String
>
nodes
=
new
ArrayList
<
String
>();
List
<
String
>
edges
=
new
ArrayList
<
String
>();
boolean
isNode
=
true
;
for
(;
reader
.
ready
();)
{
String
line
=
reader
.
readLine
().
trim
();
if
(
"#"
.
equalsIgnoreCase
(
line
))
{
isNode
=
false
;
}
else
{
if
(
line
!=
null
&&
!
line
.
isEmpty
())
{
if
(
isNode
)
{
nodes
.
add
(
line
);
}
else
{
edges
.
add
(
line
);
}
}
}
}
Progress
.
switchToDeterminate
(
progressTicket
,
nodes
.
size
()
+
edges
.
size
());
if
(
nodes
.
isEmpty
())
{
throw
new
Exception
(
"Cannot import a graph without nodes!"
);
}
for
(
String
n
:
nodes
)
{
addNode
(
n
.
substring
(
0
,
n
.
indexOf
(
" "
)),
n
.
substring
(
n
.
indexOf
(
" "
)));
}
Progress
.
progress
(
progressTicket
);
//Progress
for
(
String
e
:
edges
)
{
int
firstSpace
=
e
.
indexOf
(
" "
);
int
secondSpace
=
e
.
indexOf
(
" "
,
firstSpace
+
1
);
String
[]
tempFields
=
e
.
split
(
" "
);
String
from
=
tempFields
[
0
];
String
to
=
tempFields
[
1
];
addEdge
(
from
,
to
,
e
.
substring
(
secondSpace
));
}
Progress
.
progress
(
progressTicket
);
//Progress
}
private
void
addNode
(
String
id
,
String
label
)
{
NodeDraft
node
;
if
(!
container
.
nodeExists
(
id
))
{
node
=
container
.
factory
().
newNodeDraft
();
node
.
setId
(
id
);
node
.
setLabel
(
label
);
container
.
addNode
(
node
);
}
}
private
void
addEdge
(
String
source
,
String
target
,
String
label
)
{
NodeDraft
sourceNode
;
if
(!
container
.
nodeExists
(
source
))
{
sourceNode
=
container
.
factory
().
newNodeDraft
();
sourceNode
.
setId
(
source
);
container
.
addNode
(
sourceNode
);
}
else
{
sourceNode
=
container
.
getNode
(
source
);
}
NodeDraft
targetNode
;
if
(!
container
.
nodeExists
(
target
))
{
targetNode
=
container
.
factory
().
newNodeDraft
();
targetNode
.
setId
(
target
);
container
.
addNode
(
targetNode
);
}
else
{
targetNode
=
container
.
getNode
(
target
);
}
EdgeDraft
edge
=
container
.
getEdge
(
sourceNode
,
targetNode
);
if
(
edge
==
null
)
{
edge
=
container
.
factory
().
newEdgeDraft
();
edge
.
setSource
(
sourceNode
);
edge
.
setTarget
(
targetNode
);
edge
.
setLabel
(
label
);
container
.
addEdge
(
edge
);
}
}
public
void
setReader
(
Reader
reader
)
{
this
.
reader
=
reader
;
}
public
ContainerLoader
getContainer
()
{
return
container
;
}
public
Report
getReport
()
{
return
report
;
}
public
boolean
cancel
()
{
cancel
=
true
;
return
true
;
}
public
void
setProgressTicket
(
ProgressTicket
progressTicket
)
{
this
.
progressTicket
=
progressTicket
;
}
}
modules/ImportPlugin/src/main/resources/org/gephi/io/importer/plugin/file/Bundle.properties
浏览文件 @
5086cce8
...
...
@@ -5,6 +5,7 @@ fileType_GraphML_Name = GraphML Files
fileType_GML_Name
=
GML Files
fileType_TLP_Name
=
TLP Files
fileType_CSV_Name
=
CSV Files
fileType_TGF_Name
=
TGF Files
fileType_Edges_Name
=
Edge List
fileType_GraphViz_Name
=
GraphViz Files
fileType_DL_Name
=
DL Files (UCINET)
...
...
@@ -125,4 +126,4 @@ importerDOT_error_labelunreachable = Unable to find label at line {0}
importerDOT_error_colorunreachable
=
Unable to find color at line {0}
importerDOT_error_edgeparsing
=
Unable to parse edge at line {0}
importerDOT_error_posunreachable
=
Unable to parse position of node at line {0}. Must be pos="x, y".
importerDOT_error_weightunreachable
=
Unable to parse edge's weight at line {0}
\ No newline at end of file
importerDOT_error_weightunreachable
=
Unable to parse edge's weight at line {0}
modules/VisualizationImpl/src/main/java/org/gephi/visualization/component/ActionsToolbar.java
浏览文件 @
5086cce8
...
...
@@ -71,7 +71,7 @@ public class ActionsToolbar extends JToolBar {
//Settings
private
Color
color
=
new
Color
(
0.6f
,
0.6f
,
0.6f
);
private
float
size
=
1
f
;
private
float
size
=
1
0.0
f
;
public
ActionsToolbar
()
{
initDesign
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录