Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Christnowx
Gephi
提交
048ae20e
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,发现更多精彩内容 >>
提交
048ae20e
编写于
11月 24, 2015
作者:
E
Eduardo Ramos
提交者:
Mathieu Bastian
11月 25, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ability to configure element id type in ImportAPI
上级
16541c85
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
165 addition
and
17 deletion
+165
-17
modules/DesktopDataLaboratory/src/main/java/org/gephi/desktop/datalab/DataTableTopComponent.java
...java/org/gephi/desktop/datalab/DataTableTopComponent.java
+2
-2
modules/DesktopDataLaboratory/src/main/java/org/gephi/desktop/datalab/tables/AbstractElementsDataTable.java
...phi/desktop/datalab/tables/AbstractElementsDataTable.java
+21
-7
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerLoader.java
.../main/java/org/gephi/io/importer/api/ContainerLoader.java
+7
-0
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerUnloader.java
...ain/java/org/gephi/io/importer/api/ContainerUnloader.java
+2
-0
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ElementIdType.java
...rc/main/java/org/gephi/io/importer/api/ElementIdType.java
+64
-0
modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportContainerImpl.java
.../java/org/gephi/io/importer/impl/ImportContainerImpl.java
+37
-0
modules/ImportAPI/src/main/resources/org/gephi/io/importer/impl/Bundle.properties
...in/resources/org/gephi/io/importer/impl/Bundle.properties
+2
-0
modules/ProcessorPlugin/src/main/java/org/gephi/io/processor/plugin/DefaultProcessor.java
.../java/org/gephi/io/processor/plugin/DefaultProcessor.java
+26
-4
modules/UILibraryWrapper/pom.xml
modules/UILibraryWrapper/pom.xml
+4
-4
未找到文件。
modules/DesktopDataLaboratory/src/main/java/org/gephi/desktop/datalab/DataTableTopComponent.java
浏览文件 @
048ae20e
...
...
@@ -499,13 +499,13 @@ public class DataTableTopComponent extends TopComponent implements AWTEventListe
return
;
}
if
(
isShowingNodesTable
())
{
if
(
nodeTable
.
setPattern
(
filterTextField
.
getText
(),
index
))
{
if
(
nodeTable
.
set
Filter
Pattern
(
filterTextField
.
getText
(),
index
))
{
filterTextField
.
setBackground
(
Color
.
WHITE
);
}
else
{
filterTextField
.
setBackground
(
invalidFilterColor
);
}
}
else
if
(
isShowingEdgesTable
())
{
if
(
edgeTable
.
setPattern
(
filterTextField
.
getText
(),
index
))
{
if
(
edgeTable
.
set
Filter
Pattern
(
filterTextField
.
getText
(),
index
))
{
filterTextField
.
setBackground
(
Color
.
WHITE
);
}
else
{
filterTextField
.
setBackground
(
invalidFilterColor
);
...
...
modules/DesktopDataLaboratory/src/main/java/org/gephi/desktop/datalab/tables/AbstractElementsDataTable.java
浏览文件 @
048ae20e
...
...
@@ -49,6 +49,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.regex.PatternSyntaxException
;
import
javax.swing.RowFilter
;
import
javax.swing.table.TableCellRenderer
;
...
...
@@ -81,7 +82,7 @@ import org.openide.util.Lookup;
public
abstract
class
AbstractElementsDataTable
<
T
extends
Element
>
{
protected
final
JXTable
table
;
protected
RowFilter
rowFilter
;
protected
String
filterPattern
;
protected
List
<
T
>
selectedElements
;
protected
final
AttributeColumnsController
attributeColumnsController
;
protected
boolean
refreshingTable
=
false
;
...
...
@@ -102,7 +103,6 @@ public abstract class AbstractElementsDataTable<T extends Element> {
table
.
setColumnControlVisible
(
false
);
table
.
setSortable
(
true
);
table
.
setAutoCreateRowSorter
(
true
);
table
.
setRowFilter
(
rowFilter
);
sparkLinesRenderers
=
new
ArrayList
<
SparkLinesRenderer
>();
intervalSetRenderer
=
new
IntervalSetRenderer
();
intervalMapRenderer
=
new
IntervalMapRenderer
();
...
...
@@ -165,19 +165,33 @@ public abstract class AbstractElementsDataTable<T extends Element> {
return
table
;
}
public
boolean
setPattern
(
String
regularExpr
,
int
column
)
{
public
boolean
set
Filter
Pattern
(
String
regularExpr
,
int
column
)
{
try
{
if
(
Objects
.
equals
(
filterPattern
,
regularExpr
)){
return
true
;
}
filterPattern
=
regularExpr
;
if
(
regularExpr
==
null
||
regularExpr
.
trim
().
isEmpty
()){
table
.
setRowFilter
(
null
);
}
else
{
if
(!
regularExpr
.
startsWith
(
"(?i)"
))
{
//CASE_INSENSITIVE
regularExpr
=
"(?i)"
+
regularExpr
;
}
rowFilter
=
RowFilter
.
regexFilter
(
regularExpr
,
column
);
RowFilter
rowFilter
=
RowFilter
.
regexFilter
(
regularExpr
,
column
);
table
.
setRowFilter
(
rowFilter
);
}
}
catch
(
PatternSyntaxException
e
)
{
return
false
;
}
return
true
;
}
public
String
getPattern
(){
return
filterPattern
;
}
public
void
refreshModel
(
T
[]
elements
,
Column
[]
cols
,
GraphModel
graphModel
,
DataTablesModel
dataTablesModel
)
{
showingColumns
=
cols
;
Interval
timeBounds
=
null
;
...
...
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerLoader.java
浏览文件 @
048ae20e
...
...
@@ -231,6 +231,13 @@ public interface ContainerLoader {
public
void
setTimeFormat
(
TimeFormat
timeFormat
);
/**
/**
* Sets the type of the id for elements.
*
* @param type id type
*/
public
void
setElementIdType
(
ElementIdType
type
);
*
Sets
the
current
time
representation
,
either
<
code
>
TIMESTAMP
</
code
>
or
*
<
code
>
INTERVAL
</
code
>.
*
<
p
>
...
...
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerUnloader.java
浏览文件 @
048ae20e
...
...
@@ -88,6 +88,8 @@ public interface ContainerUnloader {
public
Class
getEdgeTypeLabelClass
();
public
ElementIdType
getElementIdType
();
//PARAMETERS GETTERS
public
boolean
allowSelfLoop
();
...
...
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ElementIdType.java
0 → 100644
浏览文件 @
048ae20e
/*
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.io.importer.api
;
/**
* Element id type.
*
* @author Mathieu Bastian
*/
public
enum
ElementIdType
{
STRING
(
String
.
class
),
INTEGER
(
Integer
.
class
),
LONG
(
Long
.
class
);
private
final
Class
cls
;
ElementIdType
(
Class
cls
)
{
this
.
cls
=
cls
;
}
public
Class
getTypeClass
()
{
return
cls
;
}
}
modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportContainerImpl.java
浏览文件 @
048ae20e
...
...
@@ -68,6 +68,7 @@ import org.gephi.io.importer.api.EdgeDirectionDefault;
import
org.gephi.io.importer.api.EdgeDraft
;
import
org.gephi.io.importer.api.EdgeWeightMergeStrategy
;
import
org.gephi.io.importer.api.ElementDraft
;
import
org.gephi.io.importer.api.ElementIdType
;
import
org.gephi.io.importer.api.Issue
;
import
org.gephi.io.importer.api.Issue.Level
;
import
org.gephi.io.importer.api.NodeDraft
;
...
...
@@ -99,6 +100,8 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
private
EdgeDirectionDefault
edgeDefault
=
EdgeDirectionDefault
.
MIXED
;
private
final
Object2ObjectMap
<
String
,
ColumnDraft
>
nodeColumns
;
private
final
Object2ObjectMap
<
String
,
ColumnDraft
>
edgeColumns
;
//Config
private
ElementIdType
elementIdType
=
ElementIdType
.
STRING
;
//Management
private
boolean
dynamicGraph
=
false
;
private
boolean
dynamicAttributes
=
false
;
...
...
@@ -525,6 +528,17 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
}
@Override
@Override
public
void
setElementIdType
(
ElementIdType
type
)
{
this
.
elementIdType
=
type
;
report
.
log
(
NbBundle
.
getMessage
(
ImportContainerImpl
.
class
,
"ImportContainerLog.ElementIdType"
,
elementIdType
.
toString
()));
}
@Override
public
ElementIdType
getElementIdType
()
{
return
elementIdType
;
}
public
boolean
verify
()
{
//Edge weight zero or negative
for
(
EdgeDraftImpl
edge
:
new
NullFilterIterable
<
EdgeDraftImpl
>(
edgeList
))
{
...
...
@@ -546,6 +560,29 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
setEdgeDefault
(
EdgeDirectionDefault
.
MIXED
);
}
//IdType
if
(
elementIdType
.
equals
(
ElementIdType
.
INTEGER
)
||
elementIdType
.
equals
(
ElementIdType
.
LONG
))
{
try
{
for
(
NodeDraftImpl
node
:
nodeList
)
{
if
(
elementIdType
.
equals
(
ElementIdType
.
INTEGER
))
{
Integer
.
parseInt
(
node
.
getId
());
}
else
if
(
elementIdType
.
equals
(
ElementIdType
.
LONG
))
{
Long
.
parseLong
(
node
.
getId
());
}
}
for
(
EdgeDraftImpl
edge
:
edgeList
)
{
if
(
elementIdType
.
equals
(
ElementIdType
.
INTEGER
))
{
Integer
.
parseInt
(
edge
.
getId
());
}
else
if
(
elementIdType
.
equals
(
ElementIdType
.
LONG
))
{
Long
.
parseLong
(
edge
.
getId
());
}
}
}
catch
(
NumberFormatException
e
)
{
report
.
logIssue
(
new
Issue
(
NbBundle
.
getMessage
(
ImportContainerImpl
.
class
,
"ImportContainerException_ElementIdType_Parse_Error"
,
elementIdType
),
Level
.
WARNING
));
elementIdType
=
ElementIdType
.
STRING
;
}
}
//Is dynamic graph
for
(
NodeDraftImpl
node
:
nodeList
)
{
if
(
node
!=
null
)
{
...
...
modules/ImportAPI/src/main/resources/org/gephi/io/importer/impl/Bundle.properties
浏览文件 @
048ae20e
...
...
@@ -8,6 +8,7 @@ ImportContainerLog.AddDynamicEdgeColumn = Edge column ''{0}'' (Dynamic {1})
ImportContainerLog.EdgeLabelType
=
Edge labels are of type ''{0}''
ImportContainerLog.TimeZone
=
Time zone is set at ''{0}''
ImportContainerLog.MultiGraphCount
=
Multi-graph with {0} different types
ImportContainerLog.ElementIdType
=
Element id type set at ''{0}''
ImportContainerException_nodeExist
=
Duplicated node id=''{0}''
ImportContainerException_UnknowNodeId
=
Unknown Node id=''{0}''
...
...
@@ -24,6 +25,7 @@ ImportContainerException_Unsupported_Edge_type = Edge types can only have a prim
ImportContainerException_Unsupported_Edge_type_Conflict
=
Edge label type is of type {0} but should be {1}, the label is ignored
ImportContainerException_Set_EdgeDefault
=
Default edge type set as ''{0}''
ImportContainerException_Weight_Zero_Ignored
=
Edge weight is 0, the edge id=''{0}'' is ignored
ImportContainerException_ElementIdType_Parse_Error
=
The id type is configured to ''{0}'' but some elements id can't be parsed, defaulting to 'STRING'
ImportContainerException_Negative_Weight
=
Edge id=''{0}'' has a negative weight
ImportContainerException_Column_Type_Mismatch
=
A column ''{0}'' already exists but with a different type=''{1}''
...
...
modules/ProcessorPlugin/src/main/java/org/gephi/io/processor/plugin/DefaultProcessor.java
浏览文件 @
048ae20e
...
...
@@ -52,6 +52,7 @@ import org.gephi.graph.api.Node;
import
org.gephi.io.importer.api.ContainerUnloader
;
import
org.gephi.io.importer.api.EdgeDirection
;
import
org.gephi.io.importer.api.EdgeDraft
;
import
org.gephi.io.importer.api.ElementIdType
;
import
org.gephi.io.importer.api.NodeDraft
;
import
org.gephi.io.processor.spi.Processor
;
import
org.gephi.project.api.ProjectController
;
...
...
@@ -111,6 +112,8 @@ public class DefaultProcessor extends AbstractProcessor implements Processor {
if
(
container
.
getEdgeTypeLabelClass
()
!=
null
)
{
// configuration.setEdgeLabelType(container.getEdgeTypeLabelClass());
}
configuration
.
setNodeIdType
(
container
.
getElementIdType
().
getTypeClass
());
configuration
.
setEdgeIdType
(
container
.
getElementIdType
().
getTypeClass
());
graphController
.
getGraphModel
(
workspace
).
setConfiguration
(
configuration
);
}
...
...
@@ -137,8 +140,10 @@ public class DefaultProcessor extends AbstractProcessor implements Processor {
int
addedNodes
=
0
,
addedEdges
=
0
;
//Create all nodes
ElementIdType
elementIdType
=
container
.
getElementIdType
();
for
(
NodeDraft
draftNode
:
container
.
getNodes
())
{
String
id
=
draftNode
.
getId
();
String
idString
=
draftNode
.
getId
();
Object
id
=
toElementId
(
elementIdType
,
idString
);
Node
node
=
graph
.
getNode
(
id
);
if
(
node
==
null
)
{
node
=
factory
.
newNode
(
id
);
...
...
@@ -153,11 +158,12 @@ public class DefaultProcessor extends AbstractProcessor implements Processor {
//Create all edges and push to data structure
for
(
EdgeDraft
draftEdge
:
container
.
getEdges
())
{
String
id
=
draftEdge
.
getId
();
String
idString
=
draftEdge
.
getId
();
Object
id
=
toElementId
(
elementIdType
,
idString
);
String
sourceId
=
draftEdge
.
getSource
().
getId
();
String
targetId
=
draftEdge
.
getTarget
().
getId
();
Node
source
=
graph
.
getNode
(
sourceId
);
Node
target
=
graph
.
getNode
(
t
argetId
);
Node
source
=
graph
.
getNode
(
toElementId
(
elementIdType
,
sourceId
)
);
Node
target
=
graph
.
getNode
(
t
oElementId
(
elementIdType
,
targetId
)
);
Object
type
=
draftEdge
.
getType
();
int
edgeType
=
graphModel
.
addEdgeType
(
type
);
...
...
@@ -197,4 +203,20 @@ public class DefaultProcessor extends AbstractProcessor implements Processor {
Progress
.
finish
(
progressTicket
);
}
private
Object
toElementId
(
ElementIdType
elementIdType
,
String
idString
)
{
Object
id
;
switch
(
elementIdType
)
{
case
INTEGER:
id
=
Integer
.
parseInt
(
idString
);
break
;
case
LONG:
id
=
Long
.
parseLong
(
idString
);
break
;
default
:
id
=
idString
;
break
;
}
return
id
;
}
}
modules/UILibraryWrapper/pom.xml
浏览文件 @
048ae20e
...
...
@@ -40,9 +40,9 @@
</exclusions>
</dependency>
<dependency>
<groupId>
org.swinglabs
</groupId>
<artifactId>
swingx
</artifactId>
<version>
1.6.1
</version>
<groupId>
org.swinglabs
.swingx
</groupId>
<artifactId>
swingx
-all
</artifactId>
<version>
1.6.
5-
1
</version>
</dependency>
<dependency>
<groupId>
org.jdesktop
</groupId>
...
...
@@ -62,7 +62,7 @@
<dependency>
<groupId>
com.miglayout
</groupId>
<artifactId>
miglayout
</artifactId>
<version>
3.7.
1
</version>
<version>
3.7.
4
</version>
</dependency>
<dependency>
<groupId>
net.java.dev
</groupId>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录