diff --git a/Algorithms/manifest.mf b/Algorithms/manifest.mf index 1a8db97ad7..3af10dda54 100644 --- a/Algorithms/manifest.mf +++ b/Algorithms/manifest.mf @@ -2,4 +2,4 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.algorithms OpenIDE-Module-Localizing-Bundle: org/gephi/algorithms/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.1.0 +OpenIDE-Module-Specification-Version: 0.8.1.1 diff --git a/Algorithms/src/org/gephi/algorithms/shortestpath/AbstractShortestPathAlgorithm.java b/Algorithms/src/org/gephi/algorithms/shortestpath/AbstractShortestPathAlgorithm.java index c8448588a7..a88d64f6be 100644 --- a/Algorithms/src/org/gephi/algorithms/shortestpath/AbstractShortestPathAlgorithm.java +++ b/Algorithms/src/org/gephi/algorithms/shortestpath/AbstractShortestPathAlgorithm.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian -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. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian + 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.algorithms.shortestpath; @@ -45,6 +45,7 @@ Development and Distribution License("CDDL") (collectively, the import java.util.HashMap; import org.gephi.graph.api.Edge; import org.gephi.graph.api.Node; +import org.gephi.graph.api.NodeData; /** * @@ -52,27 +53,27 @@ Development and Distribution License("CDDL") (collectively, the */ public abstract class AbstractShortestPathAlgorithm { - protected final HashMap colors; - protected final HashMap distances; + protected final HashMap colors; + protected final HashMap distances; protected final Node sourceNode; protected double maxDistance = 0; public AbstractShortestPathAlgorithm(Node sourceNode) { this.sourceNode = sourceNode; - colors = new HashMap(); - distances = new HashMap(); + colors = new HashMap(); + distances = new HashMap(); } protected boolean relax(Edge edge) { Node source = edge.getSource(); Node target = edge.getTarget(); - double distSource = distances.get(source); - double distTarget = distances.get(target); + double distSource = distances.get(source.getNodeData()); + double distTarget = distances.get(target.getNodeData()); double weight = edgeWeight(edge); double sourceWeight = distSource + weight; if (sourceWeight < distTarget) { - distances.put(target, sourceWeight); + distances.put(target.getNodeData(), sourceWeight); maxDistance = Math.max(maxDistance, sourceWeight); return true; } else { @@ -90,7 +91,7 @@ protected double edgeWeight(Edge edge) { public abstract Edge getPredecessorIncoming(Node node); - public HashMap getDistances() { + public HashMap getDistances() { return distances; } diff --git a/Algorithms/src/org/gephi/algorithms/shortestpath/BellmanFordShortestPathAlgorithm.java b/Algorithms/src/org/gephi/algorithms/shortestpath/BellmanFordShortestPathAlgorithm.java index 6c4221ebc2..7f6f4f3055 100644 --- a/Algorithms/src/org/gephi/algorithms/shortestpath/BellmanFordShortestPathAlgorithm.java +++ b/Algorithms/src/org/gephi/algorithms/shortestpath/BellmanFordShortestPathAlgorithm.java @@ -48,6 +48,7 @@ Development and Distribution License("CDDL") (collectively, the import org.gephi.graph.api.DirectedGraph; import org.gephi.graph.api.Edge; import org.gephi.graph.api.Node; +import org.gephi.graph.api.NodeData; import org.openide.util.Lookup; /** @@ -57,13 +58,13 @@ Development and Distribution License("CDDL") (collectively, the public class BellmanFordShortestPathAlgorithm extends AbstractShortestPathAlgorithm { protected final DirectedGraph graph; - protected final HashMap predecessors; + protected final HashMap predecessors; protected TimeInterval timeInterval; public BellmanFordShortestPathAlgorithm(DirectedGraph graph, Node sourceNode) { super(sourceNode); this.graph = graph; - predecessors = new HashMap(); + predecessors = new HashMap(); DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class); if (dynamicController != null) { timeInterval = DynamicUtilities.getVisibleInterval(dynamicController.getModel(graph.getGraphModel().getWorkspace())); @@ -77,10 +78,10 @@ public void compute() { //Initialize int nodeCount = 0; for (Node node : graph.getNodes()) { - distances.put(node, Double.POSITIVE_INFINITY); + distances.put(node.getNodeData(), Double.POSITIVE_INFINITY); nodeCount++; } - distances.put(sourceNode, 0d); + distances.put(sourceNode.getNodeData(), 0d); //Relax edges repeatedly @@ -91,7 +92,7 @@ public void compute() { Node target = edge.getTarget(); if (relax(edge)) { relaxed = true; - predecessors.put(target, edge); + predecessors.put(target.getNodeData(), edge); } } if (!relaxed) { @@ -102,7 +103,7 @@ public void compute() { //Check for negative-weight cycles for (Edge edge : graph.getEdges()) { - if (distances.get(edge.getSource()) + edgeWeight(edge) < distances.get(edge.getTarget())) { + if (distances.get(edge.getSource().getNodeData()) + edgeWeight(edge) < distances.get(edge.getTarget().getNodeData())) { graph.readUnlock(); throw new RuntimeException("The Graph contains a negative-weighted cycle"); } @@ -120,9 +121,9 @@ protected double edgeWeight(Edge edge) { } public Node getPredecessor(Node node) { - Edge edge = predecessors.get(node); + Edge edge = predecessors.get(node.getNodeData()); if (edge != null) { - if (edge.getSource() != node) { + if (edge.getSource().getNodeData() != node.getNodeData()) { return edge.getSource(); } else { return edge.getTarget(); @@ -132,6 +133,6 @@ public Node getPredecessor(Node node) { } public Edge getPredecessorIncoming(Node node) { - return predecessors.get(node); + return predecessors.get(node.getNodeData()); } } diff --git a/Algorithms/src/org/gephi/algorithms/shortestpath/DijkstraShortestPathAlgorithm.java b/Algorithms/src/org/gephi/algorithms/shortestpath/DijkstraShortestPathAlgorithm.java index e16bda886a..e5cca16995 100644 --- a/Algorithms/src/org/gephi/algorithms/shortestpath/DijkstraShortestPathAlgorithm.java +++ b/Algorithms/src/org/gephi/algorithms/shortestpath/DijkstraShortestPathAlgorithm.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian -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. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian + 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.algorithms.shortestpath; @@ -50,6 +50,7 @@ Development and Distribution License("CDDL") (collectively, the import org.gephi.graph.api.Edge; import org.gephi.graph.api.Graph; import org.gephi.graph.api.Node; +import org.gephi.graph.api.NodeData; import org.openide.util.Lookup; /** @@ -57,41 +58,41 @@ Development and Distribution License("CDDL") (collectively, the * @author Mathieu Bastian */ public class DijkstraShortestPathAlgorithm extends AbstractShortestPathAlgorithm { - + protected final Graph graph; - protected final HashMap predecessors; + protected final HashMap predecessors; protected TimeInterval timeInterval; - + public DijkstraShortestPathAlgorithm(Graph graph, Node sourceNode) { super(sourceNode); this.graph = graph; - predecessors = new HashMap(); + predecessors = new HashMap(); DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class); if (dynamicController != null) { timeInterval = DynamicUtilities.getVisibleInterval(dynamicController.getModel(graph.getGraphModel().getWorkspace())); } } - + public void compute() { - + graph.readLock(); Set unsettledNodes = new HashSet(); - Set settledNodes = new HashSet(); + Set settledNodes = new HashSet(); //Initialize for (Node node : graph.getNodes()) { - distances.put(node, Double.POSITIVE_INFINITY); + distances.put(node.getNodeData(), Double.POSITIVE_INFINITY); } - distances.put(sourceNode, 0d); + distances.put(sourceNode.getNodeData(), 0d); unsettledNodes.add(sourceNode); - + while (!unsettledNodes.isEmpty()) { // find node with smallest distance value Double minDistance = Double.POSITIVE_INFINITY; Node minDistanceNode = null; for (Node k : unsettledNodes) { - Double dist = distances.get(k); + Double dist = distances.get(k.getNodeData()); if (minDistanceNode == null) { minDistanceNode = k; } @@ -102,35 +103,35 @@ public void compute() { } } unsettledNodes.remove(minDistanceNode); - settledNodes.add(minDistanceNode); - + settledNodes.add(minDistanceNode.getNodeData()); + for (Edge edge : graph.getEdges(minDistanceNode)) { Node neighbor = graph.getOpposite(minDistanceNode, edge); - if (!settledNodes.contains(neighbor)) { + if (!settledNodes.contains(neighbor.getNodeData())) { double dist = getShortestDistance(minDistanceNode) + edgeWeight(edge); if (getShortestDistance(neighbor) > dist) { - - distances.put(neighbor, dist); - predecessors.put(neighbor, edge); + + distances.put(neighbor.getNodeData(), dist); + predecessors.put(neighbor.getNodeData(), edge); unsettledNodes.add(neighbor); maxDistance = Math.max(maxDistance, dist); } } } } - + graph.readUnlock(); } - + private double getShortestDistance(Node destination) { - Double d = distances.get(destination); + Double d = distances.get(destination.getNodeData()); if (d == null) { return Double.POSITIVE_INFINITY; } else { return d; } } - + @Override protected double edgeWeight(Edge edge) { if (timeInterval != null) { @@ -138,9 +139,9 @@ protected double edgeWeight(Edge edge) { } return edge.getWeight(); } - + public Node getPredecessor(Node node) { - Edge edge = predecessors.get(node); + Edge edge = predecessors.get(node.getNodeData()); if (edge != null) { if (edge.getSource() != node) { return edge.getSource(); @@ -150,8 +151,8 @@ public Node getPredecessor(Node node) { } return null; } - + public Edge getPredecessorIncoming(Node node) { - return predecessors.get(node); + return predecessors.get(node.getNodeData()); } } diff --git a/AttributesAPI/manifest.mf b/AttributesAPI/manifest.mf index 7f0fa31e39..3ae3a53fa0 100644 --- a/AttributesAPI/manifest.mf +++ b/AttributesAPI/manifest.mf @@ -1,5 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.gephi.data.attributes.api OpenIDE-Module-Localizing-Bundle: org/gephi/data/attributes/api/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.6 +OpenIDE-Module-Specification-Version: 0.8.0.7 AutoUpdate-Essential-Module: true diff --git a/AttributesAPI/src/org/gephi/data/attributes/api/AttributeUtils.java b/AttributesAPI/src/org/gephi/data/attributes/api/AttributeUtils.java index 19d2471bcf..e6f12cca76 100644 --- a/AttributesAPI/src/org/gephi/data/attributes/api/AttributeUtils.java +++ b/AttributesAPI/src/org/gephi/data/attributes/api/AttributeUtils.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian , Martin Škurla -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. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian , Martin Škurla + 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.data.attributes.api; @@ -49,7 +49,7 @@ Development and Distribution License("CDDL") (collectively, the /** * * @author Mathieu Bastian - * @author Martin Škurla + * @author Martin Škurla */ public abstract class AttributeUtils { @@ -125,6 +125,8 @@ public static String getXMLDateStringFromDouble(double d) { } GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis((long) d); - return dateFactory.newXMLGregorianCalendar(gc).toXMLFormat().substring(0, 23); + String s = dateFactory.newXMLGregorianCalendar(gc).toXMLFormat().substring(0, 23); + s = s.endsWith("T00:00:00.000") ? s.substring(0, 10) : s; + return s; } } diff --git a/AttributesImpl/manifest.mf b/AttributesImpl/manifest.mf index 5a20eea938..0ad45bbd6d 100644 --- a/AttributesImpl/manifest.mf +++ b/AttributesImpl/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.data.attributes OpenIDE-Module-Localizing-Bundle: org/gephi/data/attributes/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.3 +OpenIDE-Module-Specification-Version: 0.8.0.5 diff --git a/AttributesImpl/src/org/gephi/data/attributes/AttributeTableImpl.java b/AttributesImpl/src/org/gephi/data/attributes/AttributeTableImpl.java index a597cceccf..04d40bcd58 100644 --- a/AttributesImpl/src/org/gephi/data/attributes/AttributeTableImpl.java +++ b/AttributesImpl/src/org/gephi/data/attributes/AttributeTableImpl.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian , Martin Škurla -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. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian , Martin Škurla + 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.data.attributes; @@ -45,10 +45,10 @@ Development and Distribution License("CDDL") (collectively, the import java.util.HashMap; import java.util.List; import java.util.Map; -import org.gephi.data.attributes.api.AttributeTable; import org.gephi.data.attributes.api.AttributeColumn; import org.gephi.data.attributes.api.AttributeEvent; import org.gephi.data.attributes.api.AttributeOrigin; +import org.gephi.data.attributes.api.AttributeTable; import org.gephi.data.attributes.api.AttributeType; import org.gephi.data.attributes.event.ColumnEvent; import org.gephi.data.attributes.spi.AttributeValueDelegateProvider; @@ -126,9 +126,9 @@ private synchronized AttributeColumnImpl addColumn(String id, String title, Attr } AttributeColumnImpl column = new AttributeColumnImpl(this, columns.size(), id, title, type, origin, defaultValue, attributeValueDelegateProvider); columns.add(column); - columnsMap.put(id, column); + columnsMap.put(id.toLowerCase(), column); if (title != null && !title.equals(id)) { - columnsMap.put(title, column); + columnsMap.put(title.toLowerCase(), column); } columnsSet.put(column, column); @@ -155,9 +155,9 @@ public synchronized void removeColumn(AttributeColumn column) { } //Remove from collections columns.remove((AttributeColumnImpl) column); - columnsMap.remove(column.getId()); + columnsMap.remove(column.getId().toLowerCase()); if (column.getTitle() != null && !column.getTitle().equals(column.getId())) { - columnsMap.remove(column.getTitle()); + columnsMap.remove(column.getTitle().toLowerCase()); } columnsSet.remove(column); @@ -174,16 +174,16 @@ public synchronized AttributeColumn replaceColumn(AttributeColumn source, Attrib return null; } //Remove from collections - columnsMap.remove(source.getId()); + columnsMap.remove(source.getId().toLowerCase()); if (source.getTitle() != null && !source.getTitle().equals(source.getId())) { - columnsMap.remove(source.getTitle()); + columnsMap.remove(source.getTitle().toLowerCase()); } columnsSet.remove(source); //Add targetImpl.index = index; columns.set(index, targetImpl); - columnsMap.put(targetImpl.id, targetImpl); + columnsMap.put(targetImpl.id.toLowerCase(), targetImpl); if (targetImpl.title != null && !targetImpl.title.equals(targetImpl.id)) { columnsMap.put(targetImpl.title.toLowerCase(), targetImpl); } @@ -191,7 +191,7 @@ public synchronized AttributeColumn replaceColumn(AttributeColumn source, Attrib model.fireAttributeEvent( new ColumnEvent(AttributeEvent.EventType.REPLACE_COLUMN, (AttributeColumnImpl) source)); - + //Version version++; return targetImpl; @@ -221,11 +221,7 @@ public synchronized AttributeColumnImpl getColumn(int index) { } public synchronized AttributeColumnImpl getColumn(String id) { - AttributeColumnImpl col = columnsMap.get(id); - if (col == null) { - return columnsMap.get(id.toLowerCase()); - } - return col; + return columnsMap.get(id.toLowerCase()); } public synchronized AttributeColumnImpl getColumn(String title, AttributeType type) { diff --git a/AttributesImpl/src/org/gephi/data/attributes/serialization/AttributeRowSerializer.java b/AttributesImpl/src/org/gephi/data/attributes/serialization/AttributeRowSerializer.java index 84ab0cc7a8..4249d325b0 100644 --- a/AttributesImpl/src/org/gephi/data/attributes/serialization/AttributeRowSerializer.java +++ b/AttributesImpl/src/org/gephi/data/attributes/serialization/AttributeRowSerializer.java @@ -151,7 +151,7 @@ public boolean writeRow(XMLStreamWriter writer, AttributeRowImpl row) throws XML public void readRow(XMLStreamReader reader, AbstractAttributeModel model, AttributeTableImpl table, AttributeRowImpl row) throws XMLStreamException { row.setRowVersion(Integer.parseInt(reader.getAttributeValue(null, "version"))); - AttributeColumnImpl col = null; + Integer index = null; String value = ""; boolean end = false; @@ -162,11 +162,11 @@ public void readRow(XMLStreamReader reader, AbstractAttributeModel model, Attrib case XMLStreamReader.START_ELEMENT: String name = reader.getLocalName(); if (ELEMENT_VALUE.equalsIgnoreCase(name)) { - col = (AttributeColumnImpl) table.getColumn(Integer.parseInt(reader.getAttributeValue(null, "index"))); + index = Integer.parseInt(reader.getAttributeValue(null, "index")); } break; case XMLStreamReader.CHARACTERS: - if (!reader.isWhiteSpace() && col != null) { + if (!reader.isWhiteSpace() && index != null) { value += reader.getText(); } break; @@ -174,14 +174,14 @@ public void readRow(XMLStreamReader reader, AbstractAttributeModel model, Attrib if (ELEMENT_NODE_ROW.equalsIgnoreCase(reader.getLocalName()) || ELEMENT_EDGE_ROW.equalsIgnoreCase(reader.getLocalName())) { end = true; } - if (!value.isEmpty() && col != null) { - AttributeType type = col.getType(); + if (!value.isEmpty() && index != null) { + AttributeType type = table.getColumn(index).getType(); Object v = type.parse(value); v = model.getManagedValue(v, type); - row.setValue(col, v); + row.setValue(index, v); } value = ""; - col = null; + index = null; break; } } diff --git a/DesktopImport/manifest.mf b/DesktopImport/manifest.mf index b2c4b34e5d..c82e843b4d 100644 --- a/DesktopImport/manifest.mf +++ b/DesktopImport/manifest.mf @@ -3,5 +3,5 @@ AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.desktop.importer OpenIDE-Module-Layer: org/gephi/desktop/importer/layer.xml OpenIDE-Module-Localizing-Bundle: org/gephi/desktop/importer/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.3 +OpenIDE-Module-Specification-Version: 0.8.0.4 diff --git a/DesktopImport/src/org/gephi/desktop/importer/ReportPanel.form b/DesktopImport/src/org/gephi/desktop/importer/ReportPanel.form index b2e70cba48..a624244ef5 100644 --- a/DesktopImport/src/org/gephi/desktop/importer/ReportPanel.form +++ b/DesktopImport/src/org/gephi/desktop/importer/ReportPanel.form @@ -42,7 +42,7 @@ - + diff --git a/DesktopImport/src/org/gephi/desktop/importer/ReportPanel.java b/DesktopImport/src/org/gephi/desktop/importer/ReportPanel.java index 7f5cfa2666..8123a904b1 100644 --- a/DesktopImport/src/org/gephi/desktop/importer/ReportPanel.java +++ b/DesktopImport/src/org/gephi/desktop/importer/ReportPanel.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian -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. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian + 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.desktop.importer; @@ -102,7 +102,6 @@ public class ReportPanel extends javax.swing.JPanel { public ReportPanel() { try { SwingUtilities.invokeAndWait(new Runnable() { - public void run() { initComponents(); initIcons(); @@ -118,7 +117,6 @@ public void run() { fillingThreads = new ThreadGroup("Report Panel Issues"); graphTypeCombo.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { int g = graphTypeCombo.getSelectedIndex(); switch (g) { @@ -136,7 +134,6 @@ public void itemStateChanged(ItemEvent e) { }); autoscaleCheckbox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { if (autoscaleCheckbox.isSelected() != container.isAutoScale()) { container.setAutoScale(autoscaleCheckbox.isSelected()); @@ -145,7 +142,6 @@ public void itemStateChanged(ItemEvent e) { }); createMissingNodesCheckbox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { if (createMissingNodesCheckbox.isSelected() != container.getUnloader().allowAutoNode()) { container.setAllowAutoNode(createMissingNodesCheckbox.isSelected()); @@ -164,28 +160,16 @@ public void initIcons() { public void setData(Report report, Container container) { this.container = container; initProcessorsUI(); - if(report.getIssues().isEmpty()) { - try { - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - removeTabbedPane(); - } - }); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (InvocationTargetException ex) { - Exceptions.printStackTrace(ex); - } - } else { - report.pruneReport(ISSUES_LIMIT); - fillIssues(report); - fillReport(report); - } + + report.pruneReport(ISSUES_LIMIT); + fillIssues(report); + fillReport(report); + fillStats(container); autoscaleCheckbox.setSelected(container.isAutoScale()); createMissingNodesCheckbox.setSelected(container.getUnloader().allowAutoNode()); } - + private void removeTabbedPane() { tabbedPane.setVisible(false); } @@ -202,14 +186,12 @@ private void fillIssues(Report report) { //Thread Thread thread = new Thread(fillingThreads, new Runnable() { - public void run() { busyLabel.setBusy(true); final TreeModel treeMdl = new IssueTreeModel(issues); final OutlineModel mdl = DefaultOutlineModel.createOutlineModel(treeMdl, new IssueRowModel(), true); SwingUtilities.invokeLater(new Runnable() { - public void run() { issuesOutline.setRootVisible(false); issuesOutline.setRenderDataProvider(new IssueRenderer()); @@ -227,11 +209,9 @@ public void run() { private void fillReport(final Report report) { Thread thread = new Thread(fillingThreads, new Runnable() { - public void run() { final String str = report.getText(); SwingUtilities.invokeLater(new Runnable() { - public void run() { reportEditor.setText(str); } @@ -245,15 +225,14 @@ public void run() { private void fillStats(final Container container) { SwingUtilities.invokeLater(new Runnable() { - public void run() { //Source String source = container.getSource(); String[] label = source.split("\\."); - if (label.length > 2 && label[label.length-2].matches("\\d+")) { //case of temp file - source = source.replaceFirst("."+label[label.length-2], ""); + if (label.length > 2 && label[label.length - 2].matches("\\d+")) { //case of temp file + source = source.replaceFirst("." + label[label.length - 2], ""); } - + sourceLabel.setText(source); //Autoscale @@ -334,10 +313,10 @@ private ProcessorUI getProcessorUI(Processor processor) { return null; } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents diff --git a/DesktopStatistics/src/org/gephi/desktop/statistics/StatisticsFrontEnd.java b/DesktopStatistics/src/org/gephi/desktop/statistics/StatisticsFrontEnd.java index 7b91f0e522..a596ed47e3 100644 --- a/DesktopStatistics/src/org/gephi/desktop/statistics/StatisticsFrontEnd.java +++ b/DesktopStatistics/src/org/gephi/desktop/statistics/StatisticsFrontEnd.java @@ -118,6 +118,7 @@ public void actionPerformed(ActionEvent e) { private void initUI(StatisticsUI ui) { this.statisticsUI = ui; displayLabel.setText(ui.getDisplayName()); + displayLabel.setToolTipText(ui.getShortDescription()); busyLabel.setVisible(false); runButton.setEnabled(false); runButton.setText(RUN); diff --git a/DynamicAPI/manifest.mf b/DynamicAPI/manifest.mf index 3b677fa3cb..c84a0f5726 100644 --- a/DynamicAPI/manifest.mf +++ b/DynamicAPI/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.dynamic.api OpenIDE-Module-Localizing-Bundle: org/gephi/dynamic/api/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.6 +OpenIDE-Module-Specification-Version: 0.8.0.7 diff --git a/DynamicAPI/src/org/gephi/dynamic/DynamicUtilities.java b/DynamicAPI/src/org/gephi/dynamic/DynamicUtilities.java index 90f49b65b9..c02b01a092 100644 --- a/DynamicAPI/src/org/gephi/dynamic/DynamicUtilities.java +++ b/DynamicAPI/src/org/gephi/dynamic/DynamicUtilities.java @@ -5,39 +5,39 @@ * * 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. + 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.dynamic; @@ -46,6 +46,7 @@ Development and Distribution License("CDDL") (collectively, the import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.Date; @@ -77,8 +78,8 @@ Development and Distribution License("CDDL") (collectively, the import org.openide.util.Exceptions; /** - * Contains only static, and toolkit functions, like type conversion - * for the needs of dynamic stuff. + * Contains only static, and toolkit functions, like type conversion for the + * needs of dynamic stuff. * * @author Cezary Bartosiak */ @@ -100,10 +101,39 @@ public final class DynamicUtilities { * * @return date as a double. * - * @throws IllegalArgumentException if {@code str} is not a valid {@code XMLGregorianCalendar}. - * @throws NullPointerException if {@code str} is null. + * @throws IllegalArgumentException if {@code str} is not a valid + * {@code XMLGregorianCalendar}. + * @throws NullPointerException if {@code str} is null. */ public static double getDoubleFromXMLDateString(String str) { + try { + return dateFactory.newXMLGregorianCalendar(str.length() > 10 ? str.substring(0, 10) : str). + toGregorianCalendar().getTimeInMillis(); + } catch (IllegalArgumentException ex) { + //Try simple format + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date date = dateFormat.parse(str.length() > 10 ? str.substring(0, 10) : str); + return date.getTime(); + } catch (ParseException ex1) { + Exceptions.printStackTrace(ex1); + return 0.0; + } + } + } + + /** + * Used for import (parses XML date strings). + * + * @param str a string to parse from + * + * @return date as a double. + * + * @throws IllegalArgumentException if {@code str} is not a valid + * {@code XMLGregorianCalendar}. + * @throws NullPointerException if {@code str} is null. + */ + public static double getDoubleFromXMLDateTimeString(String str) { try { return dateFactory.newXMLGregorianCalendar(str.length() > 23 ? str.substring(0, 23) : str). toGregorianCalendar().getTimeInMillis(); @@ -127,8 +157,9 @@ public static double getDoubleFromXMLDateString(String str) { * * @return date as a double. * - * @throws IllegalArgumentException if {@code str} is not a valid {@code XMLGregorianCalendar}. - * @throws NullPointerException if {@code str} is null. + * @throws IllegalArgumentException if {@code str} is not a valid + * {@code XMLGregorianCalendar}. + * @throws NullPointerException if {@code str} is null. */ public static double getDoubleFromDate(Date date) { return date.getTime(); @@ -179,7 +210,7 @@ public static String getXMLDateStringFromDouble(double d) { * @param in interval to add (could be null) * * @return a new {@code DynamicType} instance that contains a given - * {@code Interval} in. + * {@code Interval} in. */ public static DynamicType createDynamicObject(AttributeType type, Interval in) { return createDynamicObject(type, null, in); @@ -192,7 +223,7 @@ public static DynamicType createDynamicObject(AttributeType type, Interval in) { * @param in intervals to add (could be null) * * @return a new {@code DynamicType} instance with intervals given by - * {@code List} in. + * {@code List} in. */ public static DynamicType createDynamicObject(AttributeType type, List in) { return createDynamicObject(type, null, in); @@ -202,7 +233,7 @@ public static DynamicType createDynamicObject(AttributeType type, List * Returns a deep copy of {@code source}. * * @param source an object to copy from (could be null, then completely new - * instance is created) + * instance is created) * * @return a deep copy of {@code source}. */ @@ -215,11 +246,11 @@ public static DynamicType createDynamicObject(AttributeType type, DynamicType so * {@code Interval} in. * * @param source an object to copy from (could be null, then completely new - * instance is created) - * @param in interval to add (could be null) + * instance is created) + * @param in interval to add (could be null) * * @return a deep copy of {@code source} that contains a given - * {@code Interval} in. + * {@code Interval} in. */ public static DynamicType createDynamicObject(AttributeType type, DynamicType source, Interval in) { return createDynamicObject(type, source, in, null); @@ -227,17 +258,17 @@ public static DynamicType createDynamicObject(AttributeType type, DynamicType so /** * Returns a deep copy of {@code source} that contains a given - * {@code Interval} in. Before add it removes from the newly created - * object all intervals that overlap with a given {@code Interval} out. + * {@code Interval} in. Before add it removes from the newly created object + * all intervals that overlap with a given {@code Interval} out. * * @param source an object to copy from (could be null, then completely new - * instance is created) - * @param in interval to add (could be null) - * @param out interval to remove (could be null) + * instance is created) + * @param in interval to add (could be null) + * @param out interval to remove (could be null) * * @return a deep copy of {@code source} that contains a given - * {@code Interval} in. Before add it removes from the newly created - * object all intervals that overlap with a given {@code Interval} out. + * {@code Interval} in. Before add it removes from the newly created object + * all intervals that overlap with a given {@code Interval} out. */ public static DynamicType createDynamicObject(AttributeType type, DynamicType source, Interval in, Interval out) { ArrayList lin = null; @@ -256,38 +287,37 @@ public static DynamicType createDynamicObject(AttributeType type, DynamicType so } /** - * Returns a deep copy of {@code source} with additional intervals - * given by {@code List} in. + * Returns a deep copy of {@code source} with additional intervals given by + * {@code List} in. * * @param source an object to copy from (could be null, then completely new - * instance is created) - * @param in intervals to add (could be null) + * instance is created) + * @param in intervals to add (could be null) * - * @return a deep copy of {@code source} with additional intervals - * given by {@code List} in. + * @return a deep copy of {@code source} with additional intervals given by + * {@code List} in. */ public static DynamicType createDynamicObject(AttributeType type, DynamicType source, List in) { return createDynamicObject(type, source, in, null); } /** - * Returns a deep copy of {@code source} with additional intervals - * given by {@code List} in. Before add it removes from the - * newly created object all intervals that overlap with intervals given by - * {@code List} out. - *

- * It can return {@code null} if type is not dynamic. + * Returns a deep copy of {@code source} with additional intervals given by + * {@code List} in. Before add it removes from the newly created + * object all intervals that overlap with intervals given by + * {@code List} out.

It can return {@code null} if type is not + * dynamic. * * @param source an object to copy from (could be null, then completely new - * instance is created) - * @param in intervals to add (could be null) - * @param out intervals to remove (could be null) - * - * @return a deep copy of {@code source} with additional intervals - * given by {@code List} in. Before add it removes from the - * newly created object all intervals that overlap with intervals given by - * {@code List} out. It can return {@code null} if type - * is not dynamic. + * instance is created) + * @param in intervals to add (could be null) + * @param out intervals to remove (could be null) + * + * @return a deep copy of {@code source} with additional intervals given by + * {@code List} in. Before add it removes from the newly created + * object all intervals that overlap with intervals given by + * {@code List} out. It can return {@code null} if type is not + * dynamic. */ public static DynamicType createDynamicObject(AttributeType type, DynamicType source, List in, List out) { @@ -530,9 +560,9 @@ public static DynamicType createDynamicObject(AttributeType type, DynamicType so } /** - * It checks intervals of the {@code source} and make it fit to the given interval, - * possibly removing intervals out of the window and - * changing low or high of intervals to fit. + * It checks intervals of the {@code source} and make it fit to the given + * interval, possibly removing intervals out of the window and changing low + * or high of intervals to fit. * * @param source a {@code DynamicType} to be performed * @param interval a given interval @@ -572,17 +602,17 @@ public static DynamicType fitToInterval(DynamicType source, Interval interval) { } /** - * It checks intervals of the {@code source} and make it fit to the given interval - * [{@code low}, {@code high}], possibly removing intervals out of the window and - * changing low or high of intervals to fit. + * It checks intervals of the {@code source} and make it fit to the given + * interval [{@code low}, {@code high}], possibly removing intervals out of + * the window and changing low or high of intervals to fit. * * @param source a {@code DynamicType} to be performed - * @param low the left endpoint - * @param high the right endpoint + * @param low the left endpoint + * @param high the right endpoint * * @return a fitted {@code DynamicType} instance. * - * @throws NullPointerException if {@code source} is null. + * @throws NullPointerException if {@code source} is null. * @throws IllegalArgumentException if {@code low} > {@code high}. */ public static DynamicType fitToInterval(DynamicType source, double low, double high) { @@ -590,8 +620,9 @@ public static DynamicType fitToInterval(DynamicType source, double low, double h } /** - * Returns the visible time interval of dynamicModel if it is not - * [-inf, +inf]. Returns null in other cases. + * Returns the visible time interval of + * dynamicModel if it is not [-inf, +inf]. Returns + * null in other cases. * * @param dynamicModel the dynamic model * @@ -621,7 +652,6 @@ public static Object getDynamicValue(Object value, double low, double high) { public static DynamicType removeOverlapping(DynamicType dynamicType) { Comparator comparator = new Comparator() { - @Override public int compare(Interval o1, Interval o2) { if (o1.getLow() < o2.getLow()) { diff --git a/FiltersImpl/manifest.mf b/FiltersImpl/manifest.mf index f658863e4a..e41f6b098f 100644 --- a/FiltersImpl/manifest.mf +++ b/FiltersImpl/manifest.mf @@ -2,5 +2,4 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.filters OpenIDE-Module-Localizing-Bundle: org/gephi/filters/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.5 - +OpenIDE-Module-Specification-Version: 0.8.0.6 diff --git a/FiltersImpl/src/org/gephi/filters/FilterModelPersistenceProvider.java b/FiltersImpl/src/org/gephi/filters/FilterModelPersistenceProvider.java index 6eed9d37d7..9f97671f0a 100644 --- a/FiltersImpl/src/org/gephi/filters/FilterModelPersistenceProvider.java +++ b/FiltersImpl/src/org/gephi/filters/FilterModelPersistenceProvider.java @@ -185,7 +185,12 @@ public void readXML(XMLStreamReader reader) throws XMLStreamException { if (parent != null) { int parentId = Integer.parseInt(parent); Query parentQuery = idMap.get(parentId); - model.setSubQuery(parentQuery, query); + + //A plugin filter may be missing, or the parent filter could not be deserialized. + //For example a partition filter, which depends on partitions, and partitions are not serialized + if (parentQuery != null) { + model.setSubQuery(parentQuery, query); + } } else { //Top query model.addFirst(query); diff --git a/FiltersPlugin/manifest.mf b/FiltersPlugin/manifest.mf index 417dd67afe..2435eea6cc 100644 --- a/FiltersPlugin/manifest.mf +++ b/FiltersPlugin/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.filters.plugin OpenIDE-Module-Localizing-Bundle: org/gephi/filters/plugin/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.7 +OpenIDE-Module-Specification-Version: 0.8.0.8 diff --git a/FiltersPlugin/src/org/gephi/filters/plugin/graph/OutDegreeRangeBuilder.java b/FiltersPlugin/src/org/gephi/filters/plugin/graph/OutDegreeRangeBuilder.java index f928fc4749..0b9d660e2a 100644 --- a/FiltersPlugin/src/org/gephi/filters/plugin/graph/OutDegreeRangeBuilder.java +++ b/FiltersPlugin/src/org/gephi/filters/plugin/graph/OutDegreeRangeBuilder.java @@ -122,7 +122,7 @@ public Number[] getValues(Graph graph) { HierarchicalDirectedGraph hgraph = (HierarchicalDirectedGraph) graph; List values = new ArrayList(((HierarchicalGraph) graph).getNodeCount()); for (Node n : hgraph.getNodes()) { - int degree = hgraph.getMutualDegree(n); + int degree = hgraph.getTotalOutDegree(n); values.add(degree); } return values.toArray(new Number[0]); diff --git a/ImportAPI/manifest.mf b/ImportAPI/manifest.mf index ba15c551a6..d6591fc663 100644 --- a/ImportAPI/manifest.mf +++ b/ImportAPI/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.io.importer.api OpenIDE-Module-Localizing-Bundle: org/gephi/io/importer/api/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.7 +OpenIDE-Module-Specification-Version: 0.8.0.8 diff --git a/ImportAPI/src/org/gephi/io/importer/impl/EdgeDraftImpl.java b/ImportAPI/src/org/gephi/io/importer/impl/EdgeDraftImpl.java index a8b9b231e2..47ef188a92 100644 --- a/ImportAPI/src/org/gephi/io/importer/impl/EdgeDraftImpl.java +++ b/ImportAPI/src/org/gephi/io/importer/impl/EdgeDraftImpl.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian -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. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian + 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.impl; @@ -203,10 +203,11 @@ public void addAttributeValue(AttributeColumn column, Object value, String dateF Double end = Double.POSITIVE_INFINITY; if (dateFrom != null && !dateFrom.isEmpty()) { try { - if (container.getTimeFormat().equals(TimeFormat.DATE) || - container.getTimeFormat().equals(TimeFormat.DATETIME)) { + if (container.getTimeFormat().equals(TimeFormat.DATETIME)) { + start = DynamicUtilities.getDoubleFromXMLDateTimeString(dateFrom); + } else if (container.getTimeFormat().equals(TimeFormat.DATE)) { start = DynamicUtilities.getDoubleFromXMLDateString(dateFrom); - } else if(container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { + } else if (container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { start = Double.parseDouble(dateFrom + "000"); } else { start = Double.parseDouble(dateFrom); @@ -217,11 +218,12 @@ public void addAttributeValue(AttributeColumn column, Object value, String dateF } if (dateTo != null && !dateTo.isEmpty()) { try { - if (container.getTimeFormat().equals(TimeFormat.DATE) || - container.getTimeFormat().equals(TimeFormat.DATETIME)) { + if (container.getTimeFormat().equals(TimeFormat.DATETIME)) { + end = DynamicUtilities.getDoubleFromXMLDateTimeString(dateTo); + } else if (container.getTimeFormat().equals(TimeFormat.DATE)) { end = DynamicUtilities.getDoubleFromXMLDateString(dateTo); - } else if(container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { - start = Double.parseDouble(dateTo + "000"); + } else if (container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { + end = Double.parseDouble(dateTo + "000"); } else { end = Double.parseDouble(dateTo); } @@ -262,10 +264,11 @@ public void addTimeInterval(String dateFrom, String dateTo, boolean startOpen, b Double end = null; if (dateFrom != null && !dateFrom.isEmpty()) { try { - if (container.getTimeFormat().equals(TimeFormat.DATE) || - container.getTimeFormat().equals(TimeFormat.DATETIME)) { + if (container.getTimeFormat().equals(TimeFormat.DATE)) { start = DynamicUtilities.getDoubleFromXMLDateString(dateFrom); - } else if(container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { + } else if (container.getTimeFormat().equals(TimeFormat.DATETIME)) { + start = DynamicUtilities.getDoubleFromXMLDateTimeString(dateFrom); + } else if (container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { start = Double.parseDouble(dateFrom + "000"); } else { start = Double.parseDouble(dateFrom); @@ -277,11 +280,12 @@ public void addTimeInterval(String dateFrom, String dateTo, boolean startOpen, b } if (dateTo != null && !dateTo.isEmpty()) { try { - if (container.getTimeFormat().equals(TimeFormat.DATE) || - container.getTimeFormat().equals(TimeFormat.DATETIME)) { + if (container.getTimeFormat().equals(TimeFormat.DATE)) { end = DynamicUtilities.getDoubleFromXMLDateString(dateTo); - } else if(container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { - start = Double.parseDouble(dateTo + "000"); + } else if (container.getTimeFormat().equals(TimeFormat.DATETIME)) { + end = DynamicUtilities.getDoubleFromXMLDateTimeString(dateTo); + } else if (container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { + end = Double.parseDouble(dateTo + "000"); } else { end = Double.parseDouble(dateTo); } diff --git a/ImportAPI/src/org/gephi/io/importer/impl/ImportContainerImpl.java b/ImportAPI/src/org/gephi/io/importer/impl/ImportContainerImpl.java index 83f5d0d7f8..df12a49d3f 100644 --- a/ImportAPI/src/org/gephi/io/importer/impl/ImportContainerImpl.java +++ b/ImportAPI/src/org/gephi/io/importer/impl/ImportContainerImpl.java @@ -415,34 +415,34 @@ public TimeFormat getTimeFormat() { } public void setTimeIntervalMax(String timeIntervalMax) { - if (timeFormat.equals(TimeFormat.DATE) || timeFormat.equals(TimeFormat.DATETIME)) { - try { + try { + if (timeFormat.equals(TimeFormat.DATE)) { this.timeIntervalMax = DynamicUtilities.getDoubleFromXMLDateString(timeIntervalMax); - } catch (Exception ex) { - report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_TimeInterval_ParseError", timeIntervalMax), Level.SEVERE)); - } - } else { - try { + } else if (timeFormat.equals(TimeFormat.DATETIME)) { + this.timeIntervalMax = DynamicUtilities.getDoubleFromXMLDateTimeString(timeIntervalMax); + } else if (timeFormat.equals(TimeFormat.TIMESTAMP)) { + this.timeIntervalMax = Double.parseDouble(timeIntervalMax + "000"); + } else { this.timeIntervalMax = Double.parseDouble(timeIntervalMax); - } catch (Exception ex) { - report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_TimeInterval_ParseError", timeIntervalMax), Level.SEVERE)); } + } catch (Exception ex) { + report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_TimeInterval_ParseError", timeIntervalMax), Level.SEVERE)); } } public void setTimeIntervalMin(String timeIntervalMin) { - if (timeFormat.equals(TimeFormat.DATE) || timeFormat.equals(TimeFormat.DATETIME)) { - try { + try { + if (timeFormat.equals(TimeFormat.DATE)) { this.timeIntervalMin = DynamicUtilities.getDoubleFromXMLDateString(timeIntervalMin); - } catch (Exception ex) { - report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_TimeInterval_ParseError", timeIntervalMin), Level.SEVERE)); - } - } else { - try { + } else if (timeFormat.equals(TimeFormat.DATETIME)) { + this.timeIntervalMin = DynamicUtilities.getDoubleFromXMLDateTimeString(timeIntervalMin); + } else if (timeFormat.equals(TimeFormat.TIMESTAMP)) { + this.timeIntervalMin = Double.parseDouble(timeIntervalMin + "000"); + } else { this.timeIntervalMin = Double.parseDouble(timeIntervalMin); - } catch (Exception ex) { - report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_TimeInterval_ParseError", timeIntervalMin), Level.SEVERE)); } + } catch (Exception ex) { + report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_TimeInterval_ParseError", timeIntervalMin), Level.SEVERE)); } } @@ -688,7 +688,6 @@ public void closeLoader() { LinkedHashMap sortedNodeMap = new LinkedHashMap(); ArrayList sortedMapValues = new ArrayList(nodeMap.values()); Collections.sort(sortedMapValues, new Comparator() { - public int compare(NodeDraftImpl o1, NodeDraftImpl o2) { return new Integer(o2.getHeight()).compareTo(o1.getHeight()); } diff --git a/ImportAPI/src/org/gephi/io/importer/impl/NodeDraftImpl.java b/ImportAPI/src/org/gephi/io/importer/impl/NodeDraftImpl.java index 14183a6840..a76fa2ee9c 100644 --- a/ImportAPI/src/org/gephi/io/importer/impl/NodeDraftImpl.java +++ b/ImportAPI/src/org/gephi/io/importer/impl/NodeDraftImpl.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian -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. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian + 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.impl; @@ -247,10 +247,11 @@ public void addAttributeValue(AttributeColumn column, Object value, String dateF Double end = Double.POSITIVE_INFINITY; if (dateFrom != null && !dateFrom.isEmpty()) { try { - if (container.getTimeFormat().equals(TimeFormat.DATE) || - container.getTimeFormat().equals(TimeFormat.DATETIME)) { + if (container.getTimeFormat().equals(TimeFormat.DATETIME)) { + start = DynamicUtilities.getDoubleFromXMLDateTimeString(dateFrom); + } else if (container.getTimeFormat().equals(TimeFormat.DATE)) { start = DynamicUtilities.getDoubleFromXMLDateString(dateFrom); - } else if(container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { + } else if (container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { start = Double.parseDouble(dateFrom + "000"); } else { start = Double.parseDouble(dateFrom); @@ -261,11 +262,12 @@ public void addAttributeValue(AttributeColumn column, Object value, String dateF } if (dateTo != null && !dateTo.isEmpty()) { try { - if (container.getTimeFormat().equals(TimeFormat.DATE) || - container.getTimeFormat().equals(TimeFormat.DATETIME)) { + if (container.getTimeFormat().equals(TimeFormat.DATETIME)) { + end = DynamicUtilities.getDoubleFromXMLDateTimeString(dateTo); + } else if (container.getTimeFormat().equals(TimeFormat.DATE)) { end = DynamicUtilities.getDoubleFromXMLDateString(dateTo); - } else if(container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { - start = Double.parseDouble(dateTo + "000"); + } else if (container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { + end = Double.parseDouble(dateTo + "000"); } else { end = Double.parseDouble(dateTo); } @@ -307,26 +309,27 @@ public void addTimeInterval(String dateFrom, String dateTo, boolean startOpen, b Double end = null; if (dateFrom != null && !dateFrom.isEmpty()) { try { - if (container.getTimeFormat().equals(TimeFormat.DATE) || - container.getTimeFormat().equals(TimeFormat.DATETIME)) { + if (container.getTimeFormat().equals(TimeFormat.DATETIME)) { + start = DynamicUtilities.getDoubleFromXMLDateTimeString(dateFrom); + } else if (container.getTimeFormat().equals(TimeFormat.DATE)) { start = DynamicUtilities.getDoubleFromXMLDateString(dateFrom); - } else if(container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { + } else if (container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { start = Double.parseDouble(dateFrom + "000"); } else { start = Double.parseDouble(dateFrom); } - } catch (Exception ex) { throw new IllegalArgumentException(NbBundle.getMessage(NodeDraftImpl.class, "ImportContainerException_TimeInterval_ParseError", dateFrom)); } } if (dateTo != null && !dateTo.isEmpty()) { try { - if (container.getTimeFormat().equals(TimeFormat.DATE) || - container.getTimeFormat().equals(TimeFormat.DATETIME)) { + if (container.getTimeFormat().equals(TimeFormat.DATETIME)) { + end = DynamicUtilities.getDoubleFromXMLDateTimeString(dateTo); + } else if (container.getTimeFormat().equals(TimeFormat.DATE)) { end = DynamicUtilities.getDoubleFromXMLDateString(dateTo); - } else if(container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { - start = Double.parseDouble(dateTo + "000"); + } else if (container.getTimeFormat().equals(TimeFormat.TIMESTAMP)) { + end = Double.parseDouble(dateTo + "000"); } else { end = Double.parseDouble(dateTo); } diff --git a/ImportPlugin/manifest.mf b/ImportPlugin/manifest.mf index 085bddf1da..30e5e28503 100644 --- a/ImportPlugin/manifest.mf +++ b/ImportPlugin/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.io.importer.plugin OpenIDE-Module-Localizing-Bundle: org/gephi/io/importer/plugin/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.7 +OpenIDE-Module-Specification-Version: 0.8.0.8 diff --git a/ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterDOT.java b/ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterDOT.java index 8db2b8e224..cd9e598ecf 100644 --- a/ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterDOT.java +++ b/ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterDOT.java @@ -75,6 +75,12 @@ public class ImporterDOT implements FileImporter, LongTask { private Map colorTable = new HashMap(); private String graphName = ""; + private static class ParseException extends RuntimeException { + public ParseException() { + super("Parse error while parsing DOT file"); + } + } + public boolean execute(ContainerLoader container) { this.container = container; this.report = new Report(); @@ -191,6 +197,27 @@ protected NodeDraft getOrCreateNode(String id) { return container.getNode(id); } + protected Color parseColor(StreamTokenizer streamTokenizer) throws Exception { + if (streamTokenizer.ttype == '#') { + streamTokenizer.nextToken(); + return new Color(Integer.parseInt(streamTokenizer.sval, 16), true); + } else if (streamTokenizer.ttype == '"' && streamTokenizer.sval.startsWith("#")) { + return new Color(Integer.parseInt(streamTokenizer.sval.substring(1), 16), true); + } else if (streamTokenizer.ttype != StreamTokenizer.TT_WORD && streamTokenizer.ttype != '"') { + throw new ParseException(); + } else if (colorTable.containsKey(streamTokenizer.sval)) { + return colorTable.get(streamTokenizer.sval); + } else { + String[] colors = streamTokenizer.sval.split(" "); + if (colors.length != 3) + colors = streamTokenizer.sval.split(","); + if (colors.length != 3) + throw new ParseException(); + + return Color.getHSBColor(Float.parseFloat(colors[0]), Float.parseFloat(colors[1]), Float.parseFloat(colors[2])); + } + } + protected void nodeAttributes(StreamTokenizer streamTokenizer, final NodeDraft nodeDraft) throws Exception { streamTokenizer.nextToken(); @@ -216,17 +243,9 @@ protected void nodeAttributes(StreamTokenizer streamTokenizer, final NodeDraft n streamTokenizer.nextToken(); if (streamTokenizer.ttype == '=') { streamTokenizer.nextToken(); - if (streamTokenizer.ttype == StreamTokenizer.TT_WORD || streamTokenizer.ttype == '"') { - if (colorTable.containsKey(streamTokenizer.sval)) { - nodeDraft.setColor(colorTable.get(streamTokenizer.sval)); - } else { - try { - String[] colors = streamTokenizer.sval.split(" "); - nodeDraft.setColor(Float.parseFloat(colors[0]), Float.parseFloat(colors[1]), Float.parseFloat(colors[2])); - } catch (Exception e) { - } - } - } else { + try { + nodeDraft.setColor(parseColor(streamTokenizer)); + } catch (ParseException e) { report.logIssue(new Issue(NbBundle.getMessage(ImporterDOT.class, "importerDOT_error_colorunreachable", streamTokenizer.lineno()), Issue.Level.WARNING)); streamTokenizer.pushBack(); } @@ -363,18 +382,10 @@ protected void edgeAttributes(StreamTokenizer streamTokenizer, final EdgeDraft e streamTokenizer.nextToken(); if (streamTokenizer.ttype == '=') { streamTokenizer.nextToken(); - if (streamTokenizer.ttype == StreamTokenizer.TT_WORD || streamTokenizer.ttype == '"') { - if (colorTable.containsKey(streamTokenizer.sval)) { - edge.setColor(colorTable.get(streamTokenizer.sval)); - } else { - try { - String[] colors = streamTokenizer.sval.split(" "); - edge.setColor(Float.parseFloat(colors[0]), Float.parseFloat(colors[1]), Float.parseFloat(colors[2])); - } catch (Exception e) { - } - } - } else { - report.logIssue(new Issue(NbBundle.getMessage(ImporterDOT.class, "importerDOT_color_labelunreachable", streamTokenizer.lineno()), Issue.Level.WARNING)); + try { + edge.setColor(parseColor(streamTokenizer)); + } catch (ParseException e) { + report.logIssue(new Issue(NbBundle.getMessage(ImporterDOT.class, "importerDOT_error_colorunreachable", streamTokenizer.lineno()), Issue.Level.WARNING)); streamTokenizer.pushBack(); } } else { diff --git a/PartitionAPI/manifest.mf b/PartitionAPI/manifest.mf index 8ae4987d6b..9988898aa5 100644 --- a/PartitionAPI/manifest.mf +++ b/PartitionAPI/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.partition.api OpenIDE-Module-Localizing-Bundle: org/gephi/partition/api/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8 +OpenIDE-Module-Specification-Version: 0.8.0.1 diff --git a/PartitionAPI/src/org/gephi/partition/impl/PartitionFactory.java b/PartitionAPI/src/org/gephi/partition/impl/PartitionFactory.java index 05309e1f7f..048fa5571a 100644 --- a/PartitionAPI/src/org/gephi/partition/impl/PartitionFactory.java +++ b/PartitionAPI/src/org/gephi/partition/impl/PartitionFactory.java @@ -261,6 +261,8 @@ public Part getPart(Node element) { public void setParts(PartImpl[] parts) { this.parts = parts; + nodeMap.clear(); + valueMap.clear(); List colors = getSequenceColors(parts.length); int i = 0; for (PartImpl p : parts) { diff --git a/ProjectAPI/manifest.mf b/ProjectAPI/manifest.mf index 22b9d8bba2..158273ca36 100644 --- a/ProjectAPI/manifest.mf +++ b/ProjectAPI/manifest.mf @@ -3,5 +3,5 @@ AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.project.api OpenIDE-Module-Layer: org/gephi/project/api/layer.xml OpenIDE-Module-Localizing-Bundle: org/gephi/project/api/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.1.1 +OpenIDE-Module-Specification-Version: 0.8.1.2 diff --git a/ProjectAPI/src/org/gephi/project/io/SaveTask.java b/ProjectAPI/src/org/gephi/project/io/SaveTask.java index 55a51417b5..30fd80a612 100644 --- a/ProjectAPI/src/org/gephi/project/io/SaveTask.java +++ b/ProjectAPI/src/org/gephi/project/io/SaveTask.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian -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. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian + 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.project.io; @@ -81,6 +81,7 @@ public SaveTask(Project project, File file) { public void run() { //System.out.println("Save " + dataObject.getName()); ZipOutputStream zipOut = null; + BufferedOutputStream bufferedOutputStream = null; boolean useTempFile = false; File writeFile = null; try { @@ -106,7 +107,7 @@ public void run() { //Create Writer and write project XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.FALSE); - BufferedOutputStream bufferedOutputStream=new BufferedOutputStream(zipOut); + bufferedOutputStream = new BufferedOutputStream(zipOut); XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bufferedOutputStream, "UTF-8"); gephiWriter.writeAll(project, writer); writer.close(); @@ -145,6 +146,12 @@ public void run() { } catch (IOException ex1) { } } + if(bufferedOutputStream!=null){ + try { + bufferedOutputStream.close(); + } catch (IOException ex1) { + } + } if (useTempFile && writeFile != null) { writeFile.delete(); } diff --git a/StatisticsAPI/src/org/gephi/statistics/spi/StatisticsUI.java b/StatisticsAPI/src/org/gephi/statistics/spi/StatisticsUI.java index e36e774d8d..c4065ddbb8 100644 --- a/StatisticsAPI/src/org/gephi/statistics/spi/StatisticsUI.java +++ b/StatisticsAPI/src/org/gephi/statistics/spi/StatisticsUI.java @@ -103,6 +103,12 @@ public interface StatisticsUI { */ public String getDisplayName(); + /** + * Returns this statistics short description + * @return this statistics' short description. + */ + public String getShortDescription(); + /** * Returns the category of this metric. Default category can be used, see *

    diff --git a/StatisticsPlugin/manifest.mf b/StatisticsPlugin/manifest.mf index bae319b92e..32c6644fb5 100644 --- a/StatisticsPlugin/manifest.mf +++ b/StatisticsPlugin/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.statistics.plugin OpenIDE-Module-Localizing-Bundle: org/gephi/statistics/plugin/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.7 +OpenIDE-Module-Specification-Version: 0.8.0.8 diff --git a/StatisticsPlugin/src/org/gephi/statistics/plugin/WeightedDegree.java b/StatisticsPlugin/src/org/gephi/statistics/plugin/WeightedDegree.java index 087e215248..0b2a670da7 100644 --- a/StatisticsPlugin/src/org/gephi/statistics/plugin/WeightedDegree.java +++ b/StatisticsPlugin/src/org/gephi/statistics/plugin/WeightedDegree.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2011 Gephi -Authors : Sebastien Heymann -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. + Copyright 2008-2011 Gephi + Authors : Sebastien Heymann + 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.statistics.plugin; @@ -81,9 +81,9 @@ public class WeightedDegree implements Statistics, LongTask { private boolean isCanceled; private ProgressTicket progress; private double avgWDegree; - private Map degreeDist; - private Map inDegreeDist; - private Map outDegreeDist; + private Map degreeDist; + private Map inDegreeDist; + private Map outDegreeDist; public double getAverageDegree() { return avgWDegree; @@ -97,23 +97,23 @@ public void execute(GraphModel graphModel, AttributeModel attributeModel) { public void execute(HierarchicalGraph graph, AttributeModel attributeModel) { isDirected = graph instanceof DirectedGraph; isCanceled = false; - degreeDist = new HashMap(); - inDegreeDist = new HashMap(); - outDegreeDist = new HashMap(); + degreeDist = new HashMap(); + inDegreeDist = new HashMap(); + outDegreeDist = new HashMap(); AttributeTable nodeTable = attributeModel.getNodeTable(); AttributeColumn degCol = nodeTable.getColumn(WDEGREE); AttributeColumn inCol = nodeTable.getColumn(WINDEGREE); AttributeColumn outCol = nodeTable.getColumn(WOUTDEGREE); if (degCol == null) { - degCol = nodeTable.addColumn(WDEGREE, "Weighted Degree", AttributeType.INT, AttributeOrigin.COMPUTED, 0); + degCol = nodeTable.addColumn(WDEGREE, "Weighted Degree", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, 0.0); } if (isDirected) { if (inCol == null) { - inCol = nodeTable.addColumn(WINDEGREE, "Weighted In-Degree", AttributeType.INT, AttributeOrigin.COMPUTED, 0); + inCol = nodeTable.addColumn(WINDEGREE, "Weighted In-Degree", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, 0.0); } if (outCol == null) { - outCol = nodeTable.addColumn(WOUTDEGREE, "Weighted Out-Degree", AttributeType.INT, AttributeOrigin.COMPUTED, 0); + outCol = nodeTable.addColumn(WOUTDEGREE, "Weighted Out-Degree", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, 0.0); } } @@ -124,17 +124,17 @@ public void execute(HierarchicalGraph graph, AttributeModel attributeModel) { for (Node n : graph.getNodes()) { AttributeRow row = (AttributeRow) n.getNodeData().getAttributes(); - float totalWeight = 0; + double totalWeight = 0; if (isDirected) { HierarchicalDirectedGraph hdg = graph.getGraphModel().getHierarchicalDirectedGraph(); - float totalInWeight = 0; - float totalOutWeight = 0; + double totalInWeight = 0; + double totalOutWeight = 0; for (Iterator it = graph.getEdgesAndMetaEdges(n).iterator(); it.hasNext();) { Edge e = (Edge) it.next(); - if (e.getSource().equals(n)) { + if (e.getSource().getNodeData().equals(n.getNodeData())) { totalOutWeight += e.getWeight(); } - if (e.getTarget().equals(n)) { + if (e.getTarget().getNodeData().equals(n.getNodeData())) { totalInWeight += e.getWeight(); } } @@ -178,7 +178,7 @@ public void execute(HierarchicalGraph graph, AttributeModel attributeModel) { public String getReport() { String report = ""; - + if (isDirected) { report = getDirectedReport(); } else { @@ -208,7 +208,7 @@ public String getReport() { + "
    " + "

    Results:

    " + "Average Weighted Degree: " + f.format(avgWDegree) - + "

    "+degreeImageFile + + "

    " + degreeImageFile + ""; } return report; @@ -219,10 +219,10 @@ public String getDirectedReport() { XYSeries dSeries = ChartUtils.createXYSeries(degreeDist, "Degree Distribution"); XYSeries idSeries = ChartUtils.createXYSeries(inDegreeDist, "In-Degree Distribution"); XYSeries odSeries = ChartUtils.createXYSeries(outDegreeDist, "Out-Degree Distribution"); - + XYSeriesCollection dataset1 = new XYSeriesCollection(); dataset1.addSeries(dSeries); - + XYSeriesCollection dataset2 = new XYSeriesCollection(); dataset2.addSeries(idSeries); @@ -267,16 +267,16 @@ public String getDirectedReport() { ChartUtils.decorateChart(chart3); ChartUtils.scaleChart(chart3, dSeries, false); String outdegreeImageFile = ChartUtils.renderChart(chart3, "outdegree-distribution.png"); - + NumberFormat f = new DecimalFormat("#0.000"); String report = "

    Weighted Degree Report

    " + "
    " + "

    Results:

    " + "Average Weighted Degree: " + f.format(avgWDegree) - + "

    "+degreeImageFile - + "

    "+indegreeImageFile - + "

    "+outdegreeImageFile + + "

    " + degreeImageFile + + "

    " + indegreeImageFile + + "

    " + outdegreeImageFile + ""; return report; diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/Bundle.properties b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/Bundle.properties index 32d03eaf08..eb5a013a43 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/Bundle.properties +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/Bundle.properties @@ -64,17 +64,29 @@ EigenvectorCentralityPanel.undirectedButton.text=UnDirected GraphDistancePanel.normalizeButton.text=Normalize Centralities in [0,1] ConnectedComponentUI.name=Connected Components +ConnectedComponentUI.shortDescription=Determines the number of connected components in the network. ClusteringCoefficientUI.name=Avg. Clustering Coefficient +ClusteringCoefficientUI.shortDescription=Averages how nodes are embedded in their neighborhood. DegreeDistributionUI.name=Degree Power Law +DegreeDistributionUI.shortDescription=Measures the distribution of degrees amongst all of the nodes within the network. EigenvectorCentralityUI.name=Eigenvector Centrality +EigenvectorCentralityUI.shortDescription=A measure of node importance in a network based on a node's connections. GraphDensityUI.name=Graph Density +GraphDensityUI.shortDescription=Measures how close the network is to complete. DiameterUI.name=Network Diameter +DiameterUI.shortDescription=Network Diameter HitsUI.name=HITS +HitsUI.shortDescription=Computes two values for each node: How valuable information stored at that node is & the quality of the nodes links. InOutDegreeUI.name=Average Degree +InOutDegreeUI.shortDescription=Average Degree ModularityUI.name=Modularity +ModularityUI.shortDescription=Community detection algorithm. PageRankUI.name=PageRank +PageRankUI.shortDescription=Ranks nodes "pages" according to how often a user following links will non-randomly reach the node "page". PathLengthUI.name=Avg. Path Length +PathLengthUI.shortDescription=Avg. Path Length WeightedDegreeUI.name=Avg. Weighted Degree +WeightedDegreeUI.shortDescription=Avg. Weighted Degree PageRankPanel.edgeWeightCheckbox.text=Use edge weight ModularityPanel.useWeightCheckbox.text=Use weights ModularityPanel.jLabel1.text=Resolution: diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ClusteringCoefficientUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ClusteringCoefficientUI.java index 27c2cd7ad5..ee9d824fd4 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ClusteringCoefficientUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ClusteringCoefficientUI.java @@ -99,4 +99,8 @@ public String getCategory() { public int getPosition() { return 300; } + + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "ClusteringCoefficientUI.shortDescription"); + } } diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ConnectedComponentUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ConnectedComponentUI.java index c876196db6..e6f814a69c 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ConnectedComponentUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ConnectedComponentUI.java @@ -99,4 +99,8 @@ public String getCategory() { public int getPosition() { return 900; } + + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "ConnectedComponentUI.shortDescription"); + } } diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/DegreeUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/DegreeUI.java index ab22d78a60..3aacb3a428 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/DegreeUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/DegreeUI.java @@ -90,4 +90,8 @@ public String getCategory() { public int getPosition() { return 1; } + + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "InOutDegreeUI.shortDescription"); + } } diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/DiameterUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/DiameterUI.java index ff266ee897..86e46f4073 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/DiameterUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/DiameterUI.java @@ -97,4 +97,8 @@ public String getCategory() { public int getPosition() { return 100; } + + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "DiameterUI.shortDescription"); + } } diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/EigenvectorCentralityUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/EigenvectorCentralityUI.java index 4dbac34702..3b3be618ad 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/EigenvectorCentralityUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/EigenvectorCentralityUI.java @@ -103,6 +103,10 @@ public int getPosition() { return 1000; } + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "EigenvectorCentralityUI.shortDescription"); + } + private static class StatSettings { private int mNumRuns = 100; diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/GraphDensityUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/GraphDensityUI.java index 9c96b28bdd..bbbaed74fe 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/GraphDensityUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/GraphDensityUI.java @@ -97,4 +97,8 @@ public String getCategory() { public int getPosition() { return 200; } + + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "GraphDensityUI.shortDescription"); + } } diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/HitsUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/HitsUI.java index 5663fb9d04..66e042018e 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/HitsUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/HitsUI.java @@ -103,6 +103,10 @@ public int getPosition() { return 500; } + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "HitsUI.shortDescription"); + } + private static class StatSettings { private double epsilon = 0.0001; diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ModularityUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ModularityUI.java index 4c23e7e79a..32adbd8d5b 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ModularityUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/ModularityUI.java @@ -103,6 +103,10 @@ public int getPosition() { return 600; } + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "ModularityUI.shortDescription"); + } + private static class StatSettings { private boolean randomize = true; diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/PageRankUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/PageRankUI.java index 9078bf557f..99129ca3f6 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/PageRankUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/PageRankUI.java @@ -103,6 +103,10 @@ public int getPosition() { return 800; } + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "PageRankUI.shortDescription"); + } + private static class StatSettings { private double epsilon = 0.001; diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/PathLengthUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/PathLengthUI.java index 81abf2d45f..52375c6dac 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/PathLengthUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/PathLengthUI.java @@ -97,4 +97,8 @@ public String getCategory() { public int getPosition() { return 200; } + + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "PathLengthUI.shortDescription"); + } } diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/WeightedDegreeUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/WeightedDegreeUI.java index 84d068fc35..1f5633531a 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/WeightedDegreeUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/WeightedDegreeUI.java @@ -90,4 +90,8 @@ public String getCategory() { public int getPosition() { return 1; } + + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "WeightedDegreeUI.shortDescription"); + } } diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/Bundle.properties b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/Bundle.properties index b3590c18e2..b05403d073 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/Bundle.properties +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/Bundle.properties @@ -2,6 +2,10 @@ DynamicDegreeUI.name=Degree DynamicNbNodesUI.name=# Nodes DynamicNbEdgesUI.name=# Edges DynamicClusteringCoefficientUI.name=Clustering Coefficient +DynamicDegreeUI.shortDescription=Degree of each node and the average of the network over time. +DynamicNbNodesUI.shortDescription=Number of nodes in the network over time. +DynamicNbEdgesUI.shortDescription=Number of edges in the network over time. +DynamicClusteringCoefficientUI.shortDescription=Clustering coefficient of each node and the average of the network over time. DynamicDegreePanel.header.description=Degree of each node and the average of the network over time. It is the number of links that have a node, and is an indicator of centrality. DynamicDegreePanel.header.title=Dynamic Degree diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicClusteringCoefficientUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicClusteringCoefficientUI.java index 0a221bf2d1..3a32907968 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicClusteringCoefficientUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicClusteringCoefficientUI.java @@ -102,6 +102,10 @@ public int getPosition() { return 400; } + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "DynamicClusteringCoefficientUI.shortDescription"); + } + private static class StatSettings { private boolean averageOnly = false; diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicDegreeUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicDegreeUI.java index f08784a3f4..585ce44241 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicDegreeUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicDegreeUI.java @@ -103,6 +103,10 @@ public int getPosition() { return 300; } + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "DynamicDegreeUI.shortDescription"); + } + private static class StatSettings { private boolean averageOnly = false; diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicNbEdgesUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicNbEdgesUI.java index 9f6f0c95cd..7654d558dc 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicNbEdgesUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicNbEdgesUI.java @@ -98,6 +98,10 @@ public int getPosition() { return 200; } + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "DynamicNbEdgesUI.shortDescription"); + } + private static class StatSettings { private double window = 0.0; diff --git a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicNbNodesUI.java b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicNbNodesUI.java index 87afcb4295..fca83cf975 100644 --- a/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicNbNodesUI.java +++ b/StatisticsPluginUI/src/org/gephi/ui/statistics/plugin/dynamic/DynamicNbNodesUI.java @@ -98,6 +98,10 @@ public int getPosition() { return 100; } + public String getShortDescription() { + return NbBundle.getMessage(getClass(), "DynamicNbNodesUI.shortDescription"); + } + private static class StatSettings { private double window = 0.0; diff --git a/ToolsPlugin/manifest.mf b/ToolsPlugin/manifest.mf index 2d87e56290..494cce4b25 100644 --- a/ToolsPlugin/manifest.mf +++ b/ToolsPlugin/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Essential-Module: true OpenIDE-Module: org.gephi.tools.plugin OpenIDE-Module-Localizing-Bundle: org/gephi/tools/plugin/Bundle.properties -OpenIDE-Module-Specification-Version: 0.8.0.6 +OpenIDE-Module-Specification-Version: 0.8.0.7 diff --git a/ToolsPlugin/src/org/gephi/tools/plugin/HeatMap.java b/ToolsPlugin/src/org/gephi/tools/plugin/HeatMap.java index dee1304624..5afb534b43 100644 --- a/ToolsPlugin/src/org/gephi/tools/plugin/HeatMap.java +++ b/ToolsPlugin/src/org/gephi/tools/plugin/HeatMap.java @@ -139,8 +139,8 @@ public void clickNodes(Node[] nodes) { maxDistance++; //+1 to have the maxdistance nodes a ratio<1 } if (maxDistance > 0) { - for (Entry entry : algorithm.getDistances().entrySet()) { - NodeData node = entry.getKey().getNodeData(); + for (Entry entry : algorithm.getDistances().entrySet()) { + NodeData node = entry.getKey(); if (!Double.isInfinite(entry.getValue())) { float ratio = (float) (entry.getValue() / maxDistance); Color c = linearGradient.getValue(ratio); diff --git a/ToolsPlugin/src/org/gephi/tools/plugin/ShortestPath.java b/ToolsPlugin/src/org/gephi/tools/plugin/ShortestPath.java index 3d2dbb3117..7362c96277 100644 --- a/ToolsPlugin/src/org/gephi/tools/plugin/ShortestPath.java +++ b/ToolsPlugin/src/org/gephi/tools/plugin/ShortestPath.java @@ -116,7 +116,7 @@ public void clickNodes(Node[] nodes) { GraphController gc = Lookup.getDefault().lookup(GraphController.class); AbstractShortestPathAlgorithm algorithm; - if (gc.getModel().getGraphVisible() instanceof DirectedGraph) { + if (gc.getModel().getGraphVisible() instanceof DirectedGraph) { algorithm = new BellmanFordShortestPathAlgorithm((DirectedGraph) gc.getModel().getGraphVisible(), sourceNode); } else { algorithm = new DijkstraShortestPathAlgorithm(gc.getModel().getGraphVisible(), sourceNode); @@ -124,12 +124,12 @@ public void clickNodes(Node[] nodes) { algorithm.compute(); double distance; - if ((distance = algorithm.getDistances().get(targetNode)) != Double.POSITIVE_INFINITY) { + if ((distance = algorithm.getDistances().get(targetNode.getNodeData())) != Double.POSITIVE_INFINITY) { targetNode.getNodeData().setColor(colorArray[0], colorArray[1], colorArray[2]); VizController.getInstance().selectNode(targetNode); Edge predecessorEdge = algorithm.getPredecessorIncoming(targetNode); Node predecessor = algorithm.getPredecessor(targetNode); - while (predecessorEdge != null && predecessor != sourceNode) { + while (predecessorEdge != null && predecessor.getNodeData() != sourceNode.getNodeData()) { predecessorEdge.getEdgeData().setColor(colorArray[0], colorArray[1], colorArray[2]); VizController.getInstance().selectEdge(predecessorEdge); predecessor.getNodeData().setColor(colorArray[0], colorArray[1], colorArray[2]); diff --git a/VisualizationModule/src/org/gephi/visualization/component/Bundle.properties b/VisualizationModule/src/org/gephi/visualization/component/Bundle.properties index 91f4bf1667..231ececd13 100644 --- a/VisualizationModule/src/org/gephi/visualization/component/Bundle.properties +++ b/VisualizationModule/src/org/gephi/visualization/component/Bundle.properties @@ -7,20 +7,24 @@ CollapsePanel.extendButton.text= GraphTopComponent.waitingLabel.text=Initializing... VizToolbar.Global.background = Background color (left click to switch black-white, right click to choose color) +VizToolbar.Global.groupBarTitle = Global VizToolbar.Global.screenshot = Take screenshot VizToolbar.Global.screenshot.configure = Configure... +VizToolbar.Nodes.groupBarTitle = Nodes VizToolbar.Nodes.showLabels = Show Node Labels VizToolbar.Nodes.showHulls = Show Hulls VizToolbar.Edges.showEdges = Show Edges VizToolbar.Edges.edgeNodeColor = Edges have source node color VizToolbar.Edges.showLabels = Show Edge Labels VizToolbar.Edges.edgeScale = Edge weight scale +VizToolbar.Edges.groupBarTitle = Edges VizToolbar.Labels.font = Font VizToolbar.Labels.defaultColor = Default color VizToolbar.Labels.sizeMode = Size mode VizToolbar.Labels.colorMode = Color mode VizToolbar.Labels.attributes = Attributes VizToolbar.Labels.fontScale = Font size scale +VizToolbar.Labels.groupBarTitle = Labels NodeSettingsPanel.adjustTextCheckbox.text=Adjust to text NodeSettingsPanel.labelShape.text=Default shape: NodeSettingsPanel.defaultShape.message3d=This shape is a 3d shape, the engine will be reinitialized. Do you want to proceed ? diff --git a/VisualizationModule/src/org/gephi/visualization/component/VizBarController.java b/VisualizationModule/src/org/gephi/visualization/component/VizBarController.java index c8fa870e14..ce700c99ab 100644 --- a/VisualizationModule/src/org/gephi/visualization/component/VizBarController.java +++ b/VisualizationModule/src/org/gephi/visualization/component/VizBarController.java @@ -126,7 +126,7 @@ public VizExtendedBar getExtendedBar() { private static class GlobalGroupBar implements VizToolbarGroup { public String getName() { - return "Global"; + return NbBundle.getMessage(VizBarController.class, "VizToolbar.Global.groupBarTitle"); } public JComponent[] getToolbarComponents() { @@ -204,7 +204,7 @@ private static class NodeGroupBar implements VizToolbarGroup { JComponent[] components = new JComponent[2]; public String getName() { - return "Nodes"; + return NbBundle.getMessage(VizBarController.class, "VizToolbar.Nodes.groupBarTitle"); } public void setModelValues(VizModel vizModel) { @@ -285,7 +285,7 @@ private static class EdgeGroupBar implements VizToolbarGroup { JComponent[] components = new JComponent[4]; public String getName() { - return "Edges"; + return NbBundle.getMessage(VizBarController.class, "VizToolbar.Edges.groupBarTitle"); } public void setModelValues(VizModel vizModel) { @@ -420,7 +420,7 @@ private static class LabelGroupBar implements VizToolbarGroup { JComponent[] components = new JComponent[6]; public String getName() { - return "Labels"; + return NbBundle.getMessage(VizBarController.class, "VizToolbar.Labels.groupBarTitle"); } public void setModelValues(VizModel vizModel) { diff --git a/overview.html b/overview.html index ac7e4bb914..17ac579521 100644 --- a/overview.html +++ b/overview.html @@ -13,6 +13,8 @@

    API Changes

      +
    • (April 10 2012) Add a getShortDescription() method to the StatisticsUI API. It enables to get a short description of statistics (used to display tooltips). +
    • (March 26 2012) Add a needsItemBuilder method to Renderer in Preview API. This helps to avoid building unnecessary items while refreshing preview.