7 Commits

Autor SHA1 Mensagem Data
Eduardo Ramos 4eb53b9f6a Add observers to graph and tables for auto-refreshing tables.
Fix occasional bug when changing workspace in data laboratory (wrong graphstore columns were used).
Re factor some code.
2014-08-20 01:57:29 +02:00
Eduardo Ramos 7bec4105c0 Merge branch 'master' of github.com:gephi/gephi into datalab 2014-08-19 21:21:12 +02:00
Eduardo Ramos b6ac01fcf4 Merge branch 'master' into datalab 2014-01-13 21:17:59 +01:00
Eduardo Ramos 36d88adae9 Minor details for data laboratory 2013-12-30 00:08:15 +01:00
Eduardo Ramos 7998f14102 Merge branch 'master' of github.com:gephi/gephi into datalab
Remove fake id columns from data laboratory since now they are real columns.
2013-12-25 22:36:36 +01:00
Eduardo Ramos 2b8ebcbf18 Merge branch 'master' of github.com:gephi/gephi into datalab 2013-12-25 21:15:16 +01:00
Eduardo Ramos 182b7da555 Working on adapting Data Laboratory to new GraphStore
Still TODO:
   Mainly Dynamics
   Listen to Graph events so tables can be updated
   Test Data Laboratory features
2013-10-31 00:19:07 +01:00
150 arquivos alterados com 3454 adições e 4267 exclusões
+9 -12
Ver Arquivo
@@ -20,10 +20,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>utils</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dynamic-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>graph-api</artifactId>
@@ -44,6 +40,13 @@
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util-lookup</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>
<build>
@@ -55,14 +58,8 @@
<publicPackages>
<publicPackage>org.gephi.datalab.api</publicPackage>
<publicPackage>org.gephi.datalab.api.datatables</publicPackage>
<publicPackage>org.gephi.datalab.spi</publicPackage>
<publicPackage>org.gephi.datalab.spi.columns</publicPackage>
<publicPackage>org.gephi.datalab.spi.columns.merge</publicPackage>
<publicPackage>org.gephi.datalab.spi.edges</publicPackage>
<publicPackage>org.gephi.datalab.spi.general</publicPackage>
<publicPackage>org.gephi.datalab.spi.nodes</publicPackage>
<publicPackage>org.gephi.datalab.spi.rows.merge</publicPackage>
<publicPackage>org.gephi.datalab.spi.values</publicPackage>
<publicPackage>org.gephi.datalab.spi.*</publicPackage>
<publicPackage>org.gephi.datalab.utils</publicPackage>
</publicPackages>
</configuration>
</plugin>
@@ -47,12 +47,11 @@ import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.spi.rows.merge.AttributeRowsMergeStrategy;
import org.gephi.graph.api.Attributes;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Element;
import org.gephi.graph.api.Node;
/**
@@ -72,7 +71,7 @@ public interface AttributeColumnsController {
* @param column Column
* @return True if the value was set, false otherwise
*/
boolean setAttributeValue(Object value, Attributes row, AttributeColumn column);
boolean setAttributeValue(Object value, Element row, Column column);
/**
* <p>Adds a new column to the specified table with the given title and type of column.</p>
@@ -87,11 +86,11 @@ public interface AttributeColumnsController {
* @param type Type for the new column
* @return The created column or null if the column could not be created
*/
AttributeColumn addAttributeColumn(AttributeTable table, String title, AttributeType type);
Column addAttributeColumn(Table table, String title, Class type);
/**
* <p>Duplicates a given column of a table and copies al row values.</p>
* <p>If the <code>AttributeType</code> for the new column is different from the old column type, it will try to parse each value. If it is not possible, the value will be set to null.</p>
* <p>If the <code>Class</code> for the new column is different from the old column type, it will try to parse each value. If it is not possible, the value will be set to null.</p>
* <p>The title for the new column can't be repeated in the table, null or an empty string.</p>.
* <p>The id of the column will be set to the title.</p>
* <p>The <code>AttributeOrigin</code> of the column will be set to <code>DATA</code>.</p>
@@ -99,27 +98,27 @@ public interface AttributeColumnsController {
* @param table Table of the column to duplicate
* @param column Column to duplicate
* @param title Title for the new column
* @param type AttributeType for the new column
* @param type Class for the new column
* @return The created column or null if the column could not be created
*/
AttributeColumn duplicateColumn(AttributeTable table, AttributeColumn column, String title, AttributeType type);
Column duplicateColumn(Table table, Column column, String title, Class type);
/**
* <p>Copies all row values of a column to another column.</p>
* <p>If the <code>AttributeType</code> for the target is different from the source column type, it will try to parse each value. If it is not possible, the value will be set to null.</p>
* <p>If the <code>Class</code> for the target is different from the source column type, it will try to parse each value. If it is not possible, the value will be set to null.</p>
* <p>Source and target columns must be different.</p>
* @param table Table of the columns
* @param sourceColumn Source column
* @param targetColumn Target column
*/
void copyColumnDataToOtherColumn(AttributeTable table, AttributeColumn sourceColumn, AttributeColumn targetColumn);
void copyColumnDataToOtherColumn(Table table, Column sourceColumn, Column targetColumn);
/**
* <p>Deletes the specified column from a table if the table has the column and data laboratory behaviour allows to delete it (see <code>canDeleteColumn</code> method).</p>
* @param table Table to delete the column
* @param column Column to delete
*/
void deleteAttributeColumn(AttributeTable table, AttributeColumn column);
void deleteAttributeColumn(Table table, Column column);
/**
* <p>Converts and replaces a table column with a dynamic column preserving original column values.</p>
@@ -129,11 +128,9 @@ public interface AttributeColumnsController {
* @param column Column to convert and replace
* @param low Low bound for default interval
* @param high High bound for default interval
* @param lopen Open low bound for default interval
* @param ropen Open high bound for default interval
* @return The new column
*/
AttributeColumn convertAttributeColumnToDynamic(AttributeTable table, AttributeColumn column, double low, double high, boolean lopen, boolean ropen);
Column convertAttributeColumnToDynamic(Table table, Column column, double low, double high);
/**
* <p>Converts a table column into a new dynamic column preserving original column values. The original column is kept intact</p>
@@ -142,49 +139,47 @@ public interface AttributeColumnsController {
* @param column Column to convert to dynamic
* @param low Low bound for default interval
* @param high High bound for default interval
* @param lopen Open low bound for default interval
* @param ropen Open high bound for default interval
* @param newColumnTitle Title for the new dynamic column
* @return The new column
*/
AttributeColumn convertAttributeColumnToNewDynamicColumn(AttributeTable table, AttributeColumn column, double low, double high, boolean lopen, boolean ropen, String newColumnTitle);
Column convertAttributeColumnToNewDynamicColumn(Table table, Column column, double low, double high, String newColumnTitle);
/**
* <p>Fills the data values of a given column of a table with a value as a String,
* parsing it for the <code>AttributeType</code> of the column. If it is not possible to parse,
* parsing it for the <code>Class</code> of the column. If it is not possible to parse,
* the value will be set to null.</p>
* @param table Table of the column
* @param column Column to fill
* @param value String representation of the value for each row of the column
*/
void fillColumnWithValue(AttributeTable table, AttributeColumn column, String value);
void fillColumnWithValue(Table table, Column column, String value);
/**
* <p>Fills the data values of a given column of the indicated nodes with a value as a String,
* parsing it for the <code>AttributeType</code> of the column. If it is not possible to parse,
* parsing it for the <code>Class</code> of the column. If it is not possible to parse,
* the value will be set to null.</p>
* @param nodes Nodes to fill
* @param column Column to fill
* @param value String representation of the value for the column for each node
*/
void fillNodesColumnWithValue(Node[] nodes, AttributeColumn column, String value);
void fillNodesColumnWithValue(Node[] nodes, Column column, String value);
/**
* <p>Fills the data values of a given column of the indicated edges with a value as a String,
* parsing it for the <code>AttributeType</code> of the column. If it is not possible to parse,
* parsing it for the <code>Class</code> of the column. If it is not possible to parse,
* the value will be set to null.</p>
* @param edges Edges to fill
* @param column Column to fill
* @param value String representation of the value for the column for each edge
*/
void fillEdgesColumnWithValue(Edge[] edges, AttributeColumn column, String value);
void fillEdgesColumnWithValue(Edge[] edges, Column column, String value);
/**
* <p>Clears all rows data for a given column of a table (nodes table or edges table)</p>
* @param table Table to clear column data
* @param column Column to clear data
*/
void clearColumnData(AttributeTable table, AttributeColumn column);
void clearColumnData(Table table, Column column);
/**
* <p>Calculates the absolute frequency of appearance of each value of the given column and returns a Map containing each different value mapped to its frequency of appearance.</p>
@@ -192,7 +187,7 @@ public interface AttributeColumnsController {
* @param column Column to calculate values frequencies
* @return Map containing each different value mapped to its frequency of appearance
*/
Map<Object, Integer> calculateColumnValuesFrequencies(AttributeTable table, AttributeColumn column);
Map<Object, Integer> calculateColumnValuesFrequencies(Table table, Column column);
/**
* <p>Creates a new <code>BOOLEAN</code> column from the given column and regular expression
@@ -204,15 +199,15 @@ public interface AttributeColumnsController {
* @param pattern Regular expression to match
* @return New created column or null if title is not correct
*/
AttributeColumn createBooleanMatchesColumn(AttributeTable table, AttributeColumn column, String newColumnTitle, Pattern pattern);
Column createBooleanMatchesColumn(Table table, Column column, String newColumnTitle, Pattern pattern);
/**
* <p>Negates not null values of a given <code>BOOLEAN</code> or <code>LIST_BOOLEAN</code>column.</p>
* <p>Throws IllegalArgumentException if the column does not have <code>BOOLEAN</code> or <code>LIST_BOOLEAN</code> <code>AttributeType</code>.</p>
* <p>Throws IllegalArgumentException if the column does not have <code>BOOLEAN</code> or <code>LIST_BOOLEAN</code> <code>Class</code>.</p>
* @param table Table of the column to negate
* @param column Boolean column to negate
*/
void negateBooleanColumn(AttributeTable table, AttributeColumn column);
void negateBooleanColumn(Table table, Column column);
/**
* <p>Creates a new <code>LIST_STRING</code> column from the given column and regular expression with values that are
@@ -224,7 +219,7 @@ public interface AttributeColumnsController {
* @param pattern Regular expression to match
* @return New created column or null if title is not correct
*/
AttributeColumn createFoundGroupsListColumn(AttributeTable table, AttributeColumn column, String newColumnTitle, Pattern pattern);
Column createFoundGroupsListColumn(Table table, Column column, String newColumnTitle, Pattern pattern);
/**
* <p>Clears all node attributes except computed attributes and id, checking first that the node is in the graph.</p>
@@ -232,7 +227,7 @@ public interface AttributeColumnsController {
* @param node Node to clear data
* @param columnsToClear Columns of the node to clear. All columns will be cleared if it is null
*/
void clearNodeData(Node node, AttributeColumn[] columnsToClear);
void clearNodeData(Node node, Column[] columnsToClear);
/**
* <p>Clears all the nodes attributes except computed attributes and id.</p>
@@ -240,7 +235,7 @@ public interface AttributeColumnsController {
* @param nodes Array of nodes to clear data
* @param columnsToClear Columns of the nodes to clear. All columns will be cleared if it is null
*/
void clearNodesData(Node[] nodes, AttributeColumn[] columnsToClear);
void clearNodesData(Node[] nodes, Column[] columnsToClear);
/**
* <p>Clears all edge attributes except computed attributes and id.</p>
@@ -248,7 +243,7 @@ public interface AttributeColumnsController {
* @param edge Edge to clear data
* @param columnsToClear Columns of the edge to clear. All columns will be cleared if it is null
*/
void clearEdgeData(Edge edge, AttributeColumn[] columnsToClear);
void clearEdgeData(Edge edge, Column[] columnsToClear);
/**
* <p>Clears all the edges attributes except computed attributes and id, checking first that the edges are in the graph.</p>
@@ -256,7 +251,7 @@ public interface AttributeColumnsController {
* @param edges Array of edges to clear data
* @param columnsToClear Columns of the edges to clear. All columns will be cleared if it is null
*/
void clearEdgesData(Edge[] edges, AttributeColumn[] columnsToClear);
void clearEdgesData(Edge[] edges, Column[] columnsToClear);
/**
* <p>Clears row attributes except computed attributes and id if node/edge row.</p>
@@ -264,7 +259,7 @@ public interface AttributeColumnsController {
* @param row Array of rows to clear data
* @param columnsToClear Columns of the row to clear. All columns will be cleared if it is null
*/
void clearRowData(Attributes row, AttributeColumn[] columnsToClear);
void clearRowData(Element row, Column[] columnsToClear);
/**
* <p>Copies attributes data of the given node to the other rows except computed attributes and id.</p>
@@ -273,7 +268,7 @@ public interface AttributeColumnsController {
* @param otherNodes Nodes to copy data to
* @param columnsToCopy Columns of the node to copy. All columns will be copied if it is null
*/
void copyNodeDataToOtherNodes(Node node, Node[] otherNodes, AttributeColumn[] columnsToCopy);
void copyNodeDataToOtherNodes(Node node, Node[] otherNodes, Column[] columnsToCopy);
/**
* <p>Copies attributes data of the given edge to the other rows except computed attributes and id.</p>
@@ -282,7 +277,7 @@ public interface AttributeColumnsController {
* @param otherEdges Edges to copy data to
* @param columnsToCopy Columns of the edge to copy. All columns will be copied if it is null
*/
void copyEdgeDataToOtherEdges(Edge edge, Edge[] otherEdges, AttributeColumn[] columnsToCopy);
void copyEdgeDataToOtherEdges(Edge edge, Edge[] otherEdges, Column[] columnsToCopy);
/**
* <p>Copies attributes data of the given row to the other rows except computed attributes and id if node/edge.</p>
@@ -291,7 +286,7 @@ public interface AttributeColumnsController {
* @param otherRows Rows to copy data to
* @param columnsToCopy Columns of the row to copy. All columns will be copied if it is null
*/
void copyRowDataToOtherRows(Attributes row, Attributes[] otherRows, AttributeColumn[] columnsToCopy);
void copyRowDataToOtherRows(Element row, Element[] otherRows, Column[] columnsToCopy);
/**
* <p>Returns all rows of a given table (node or edges table).</p>
@@ -299,7 +294,7 @@ public interface AttributeColumnsController {
* @param table Table to get attribute rows
* @return Array of attribute rows of the table
*/
Attributes[] getTableAttributeRows(AttributeTable table);
Element[] getTableAttributeRows(Table table);
/**
* <p>Counts the number of rows of a table (nodes or edges table) and returns the result.</p>
@@ -307,19 +302,25 @@ public interface AttributeColumnsController {
* @param table
* @return the number of rows in <code>table</code>
*/
int getTableRowsCount(AttributeTable table);
int getTableRowsCount(Table table);
/**
* <p>Checks if the given table is nodes table.</p>
* @return True if the table is nodes table, false otherwise
*/
boolean isNodeTable(AttributeTable table);
boolean isNodeTable(Table table);
/**
* <p>Checks if the given table is edges table.</p>
* @return True if the table is edges table, false otherwise
*/
boolean isEdgeTable(AttributeTable table);
boolean isEdgeTable(Table table);
boolean isTableColumn(Table table, Column column);
boolean isNodeColumn(Column column);
boolean isEdgeColumn(Column column);
/**
* <p>Indicates if the Data Laboratory API behaviour allows to delete the given column of a table.</p>
@@ -327,7 +328,7 @@ public interface AttributeColumnsController {
* @param column Column to check if it can be deleted
* @return True if it can be deleted, false otherwise
*/
boolean canDeleteColumn(AttributeColumn column);
boolean canDeleteColumn(Column column);
/**
* <p>Indicates if the Data Laboratory API behaviour allows to change a value of the given column of a table.</p>
@@ -335,7 +336,7 @@ public interface AttributeColumnsController {
* @param column Column to check if values can be changed
* @return True if the column values can be changed, false otherwise
*/
boolean canChangeColumnData(AttributeColumn column);
boolean canChangeColumnData(Column column);
/**
* <p>Indicates if the Data Laboratory API behaviour allows to set as null a value of the given column of a table.</p>
@@ -343,7 +344,7 @@ public interface AttributeColumnsController {
* @param column Column to check if values can be changed
* @return True if the column values can be changed, false otherwise
*/
boolean canClearColumnData(AttributeColumn column);
boolean canClearColumnData(Column column);
/**
* <p>Indicates if the Data Laboratory API behaviour allows to convert an existing column into its dynamic equivalent.</p>
@@ -351,7 +352,7 @@ public interface AttributeColumnsController {
* @param column Column to check if can be converted
* @return True if the column can be converted to dynamic, false otherwise
*/
boolean canConvertColumnToDynamic(AttributeColumn column);
boolean canConvertColumnToDynamic(Column column);
/**
* <p>Calculates all statistics at once from a number/number list column using <code>MathUtils</code> class.</p>
@@ -373,7 +374,7 @@ public interface AttributeColumnsController {
* @param column Column to get statistics
* @return Array with statistics
*/
BigDecimal[] getNumberOrNumberListColumnStatistics(AttributeTable table, AttributeColumn column);
BigDecimal[] getNumberOrNumberListColumnStatistics(Table table, Column column);
/**
* <p>Prepares an array with all not null numbers of all the rows of a given column.</p>
@@ -383,7 +384,7 @@ public interface AttributeColumnsController {
* @param column Column to get numbers
* @return Array with all numbers.
*/
Number[] getColumnNumbers(AttributeTable table, AttributeColumn column);
Number[] getColumnNumbers(Table table, Column column);
/**
* <p>Prepares an array <b>only</b> with all not null numbers the indicated rows of a given column.</p>
@@ -393,7 +394,7 @@ public interface AttributeColumnsController {
* @param column Column to get numbers
* @return Array with all numbers.
*/
Number[] getRowsColumnNumbers(Attributes[] rows, AttributeColumn column);
Number[] getRowsColumnNumbers(Element[] rows, Column column);
/**
* <p>Prepares an array with all not null numbers of a row using only the given columns.</p>
@@ -404,7 +405,7 @@ public interface AttributeColumnsController {
* @param columns Columns of the row to use
* @return Array with all numbers
*/
Number[] getRowNumbers(Attributes row, AttributeColumn[] columns);
Number[] getRowNumbers(Element row, Column[] columns);
/**
* <p>Method for importing CSV file data to nodes table.</p>
@@ -419,7 +420,7 @@ public interface AttributeColumnsController {
* @param columnTypes Types of the columns in the CSV file to use when creating columns
* @param assignNewNodeIds Indicates if nodes should be assigned new ids when the ids are already in nodes table or not provided.
*/
void importCSVToNodesTable(File file, Character separator, Charset charset, String[] columnNames, AttributeType[] columnTypes, boolean assignNewNodeIds);
void importCSVToNodesTable(File file, Character separator, Charset charset, String[] columnNames, Class[] columnTypes, boolean assignNewNodeIds);
/**
* <p>Method for importing csv data to edges table.</p>
@@ -442,7 +443,7 @@ public interface AttributeColumnsController {
* @param columnTypes Types of the columns in the CSV file to use when creating columns
* @param createNewNodes Indicates if missing nodes should be created when an edge declares a source or target id not already existing
*/
void importCSVToEdgesTable(File file, Character separator, Charset charset, String[] columnNames, AttributeType[] columnTypes, boolean createNewNodes);
void importCSVToEdgesTable(File file, Character separator, Charset charset, String[] columnNames, Class[] columnTypes, boolean createNewNodes);
/**
* <p>Merges the given rows values to the given result row using one merge strategy for each column of the table.</p>
@@ -455,7 +456,7 @@ public interface AttributeColumnsController {
* @param selectedRow Main selected row or null (first row will be used in case selectedRow is null)
* @param resultRow Already existing row to put the values on
*/
void mergeRowsValues(AttributeTable table, AttributeRowsMergeStrategy[] mergeStrategies, Attributes[] rows, Attributes selectedRow, Attributes resultRow);
void mergeRowsValues(Table table, AttributeRowsMergeStrategy[] mergeStrategies, Element[] rows, Element selectedRow, Element resultRow);
/**
* <p>Finds and returns nodes duplicates based on the values of a given column of nodes table</p>
@@ -465,5 +466,5 @@ public interface AttributeColumnsController {
* @param caseSensitive Case insensitivity when comparing the column values
* @return List of node duplicates groups (at least 2 nodes in each group)
*/
List<List<Node>> detectNodeDuplicatesByColumn(AttributeColumn column, boolean caseSensitive);
List<List<Node>> detectNodeDuplicatesByColumn(Column column, boolean caseSensitive);
}
@@ -42,9 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.api;
import java.text.SimpleDateFormat;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
/**
* This interface defines part of the Data Laboratory API basic actions.
@@ -74,7 +73,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param separator Separator to put between each value
* @return The new created column
*/
AttributeColumn joinWithSeparatorMerge(AttributeTable table, AttributeColumn[] columnsToMerge, AttributeType newColumnType, String newColumnTitle, String separator);
Column joinWithSeparatorMerge(Table table, Column[] columnsToMerge, Class newColumnType, String newColumnTitle, String separator);
/**
* <p>Merge 1 or 2 columns creating a time interval for each row. Values of the columns will be expected as numbers</p>
@@ -94,7 +93,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param defaultEnd Default end value
* @return Time interval column
*/
AttributeColumn mergeNumericColumnsToTimeInterval(AttributeTable table, AttributeColumn startColumn, AttributeColumn endColumn, double defaultStart, double defaultEnd);
Column mergeNumericColumnsToTimeInterval(Table table, Column startColumn, Column endColumn, double defaultStart, double defaultEnd);
/**
* <p>Merge 1 or 2 columns creating a time interval for each row. Values of the columns will be expected as dates in the given date format</p>
@@ -116,7 +115,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param defaultEndDate Default date to use as end if it can be parsed
* @return Time interval column
*/
AttributeColumn mergeDateColumnsToTimeInterval(AttributeTable table, AttributeColumn startColumn, AttributeColumn endColumn, SimpleDateFormat dateFormat, String defaultStartDate, String defaultEndDate);
Column mergeDateColumnsToTimeInterval(Table table, Column startColumn, Column endColumn, SimpleDateFormat dateFormat, String defaultStartDate, String defaultEndDate);
/**
* <p>Strategy to apply only to all boolean columns. Merges various columns into a new boolean column
@@ -128,7 +127,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn booleanLogicOperationsMerge(AttributeTable table, AttributeColumn[] columnsToMerge, BooleanOperations[] booleanOperations, String newColumnTitle);
Column booleanLogicOperationsMerge(Table table, Column[] columnsToMerge, BooleanOperations[] booleanOperations, String newColumnTitle);
/**
* <p>Merges any combination of number or number list columns, calculating the average of all not null values
@@ -138,7 +137,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn averageNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle);
Column averageNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle);
/**
* <p>Merges any combination of number or number list columns, calculating the first quartile (Q1) of all not null values
@@ -148,7 +147,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn firstQuartileNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle);
Column firstQuartileNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle);
/**
* <p>Merges any combination of number or number list columns, calculating the median of all not null values
@@ -158,7 +157,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn medianNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle);
Column medianNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle);
/**
* <p>Merges any combination of number or number list columns, calculating the third quartile (Q3) of all not null values
@@ -168,7 +167,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn thirdQuartileNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle);
Column thirdQuartileNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle);
/**
* <p>Merges any combination of number or number list columns, calculating the interquartile range (IQR) of all not null values
@@ -178,7 +177,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn interQuartileRangeNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle);
Column interQuartileRangeNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle);
/**
* <p>Merges any combination of number or number list columns, calculating the sum of all not null values
@@ -188,7 +187,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn sumNumbersMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle);
Column sumNumbersMerge(Table table, Column[] columnsToMerge, String newColumnTitle);
/**
* Merges any combination of number or number list columns, calculating the minimum value of all not null values
@@ -198,7 +197,7 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn minValueNumbersMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle);
Column minValueNumbersMerge(Table table, Column[] columnsToMerge, String newColumnTitle);
/**
* <p>Merges any combination of number or number list columns, calculating the maximum value of all not null values
@@ -208,5 +207,5 @@ public interface AttributeColumnsMergeStrategiesController {
* @param newColumnTitle Title for the new column
* @return The new created column
*/
AttributeColumn maxValueNumbersMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle);
Column maxValueNumbersMerge(Table table, Column[] columnsToMerge, String newColumnTitle);
}
@@ -53,8 +53,8 @@ import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.Manipulator;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -319,7 +319,7 @@ public class DataLaboratoryHelper {
* @param table Table of the column
* @param column Column to manipulate
*/
public void executeAttributeColumnsManipulator(final AttributeColumnsManipulator m, final AttributeTable table, final AttributeColumn column) {
public void executeAttributeColumnsManipulator(final AttributeColumnsManipulator m, final Table table, final Column column) {
if (m.canManipulateColumn(table, column)) {
SwingUtilities.invokeLater(new Runnable() {
@@ -361,7 +361,7 @@ public class DataLaboratoryHelper {
}
}
private void executeAttributeColumnsManipulatorInOtherThread(final AttributeColumnsManipulator m, final AttributeTable table, final AttributeColumn column) {
private void executeAttributeColumnsManipulatorInOtherThread(final AttributeColumnsManipulator m, final Table table, final Column column) {
new Thread() {
@Override
@@ -155,53 +155,6 @@ public interface GraphElementsController {
*/
void deleteEdgesWithNodes(Edge[] edges, boolean deleteSource, boolean deleteTarget);
/**
* Groups an array of nodes if it is possible.
* @param nodes Array of nodes to group
* @return True if the nodes were succesfully grouped, false otherwise
*/
boolean groupNodes(Node[] nodes);
/**
* Checks if an array of nodes can form a group.
* @param nodes Array of nodes to check
* @return True if the nodes can form a group, false otherwise
*/
boolean canGroupNodes(Node[] nodes);
/**
* Ungroups a node if it forms a group.
* @param node Node to ungroup
* @return True if the node was succesfully ungrouped, false otherwise
*/
boolean ungroupNode(Node node);
/**
* Tries to ungroup every node un the array of nodes checking first they form a group.
* @param nodes Array of nodes to ungroup
*/
void ungroupNodes(Node[] nodes);
/**
* Ungroups a node if it forms a group and also ungroups all its descendant.
* @param node Node to ungroup recursively
* @return True if the node was succesfully ungrouped, false otherwise
*/
boolean ungroupNodeRecursively(Node node);
/**
* Tries to ungroup every node un the array of nodes checking first they form a group.
* @param nodes Array of nodes to ungroup
*/
void ungroupNodesRecursively(Node[] nodes);
/**
* Checks if the node can be ungrouped (it forms a group of nodes).
* @param node Node to check
* @return True if the node can be ungrouped, false otherwise
*/
boolean canUngroupNode(Node node);
/**
* Merges 2 or more nodes into a new one node that has all the edges of the merged nodes.
* An AttributeRowsMergeStrategy must be provided for each column of the nodes.
@@ -213,60 +166,6 @@ public interface GraphElementsController {
*/
Node mergeNodes(Node[] nodes, Node selectedNode, AttributeRowsMergeStrategy[] mergeStrategies, boolean deleteMergedNodes);
/**
* Moves a node to a group of nodes if it is possible.
* To move a node to a group node, they must be different, have the same parent and the node to be the group has to be a group of nodes.
* @param node Node to move to group
* @param group Group of nodes to move the node
* @return True if the node was moved, false otherwise
*/
boolean moveNodeToGroup(Node node, Node group);
/**
* Tries to move each node of the nodes array to the group node.
* @param nodes Array of nodes to move
* @param group Group node
*/
void moveNodesToGroup(Node[] nodes, Node group);
/**
* <p>Prepares and returns an array with the groups that the given nodes can be moved to.</p>
* <p>These groups are the nodes that have the same parent as the given nodes and are not in the given nodes array.</p>
* @param nodes Nodes to get available groups to be moved
* @return Available groups array of null if the nodes don't all have the same parent
*/
Node[] getAvailableGroupsToMoveNodes(Node[] nodes);
/**
* Indicates if a given node can be moved to a group node.
* To move a node to a group, they must have the same parent and the group node has to be a group of nodes.
* @param node Node to check if can be moved
* @param group Group node
* @return True if it can be moved, false otherwise
*/
boolean canMoveNodeToGroup(Node node, Node group);
/**
* Removes a node from its group if the node is in a group (has a parent).
* Also breaks the group if the last node is removed.
* @param node Node to remove from its group
* @return True if the node was removed from a group, false otherwise
*/
boolean removeNodeFromGroup(Node node);
/**
* Tries to remove every node in the array from its group checking first they are in a group.
* Also breaks groups when the last node is removed.
* @param nodes Arrays of nodes to remove from its group
*/
void removeNodesFromGroup(Node[] nodes);
/**
* Checks if the node is in a group (has a parent).
* @return True if the node is in a group, false otherwise
*/
boolean isNodeInGroup(Node node);
/**
* Sets the fixed state of a node to the indicated.
* @param node Node to set fixed state
@@ -45,10 +45,10 @@ import org.gephi.datalab.api.datatables.DataTablesController;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.attribute.api.Column;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.Node;
import org.openide.util.Lookup;
@@ -133,13 +133,13 @@ public interface SearchReplaceController {
*/
private void checkNodesToSearch() {
if (nodesToSearch == null || nodesToSearch.length == 0) {
HierarchicalGraph hg;
Graph graph;
if (Lookup.getDefault().lookup(DataTablesController.class).isShowOnlyVisible()) {
hg = Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraphVisible();
graph = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraphVisible();
} else {
hg = Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraph();
graph = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph();
}
nodesToSearch = hg.getNodesTree().toArray();
nodesToSearch = graph.getNodes().toArray();
}
}
@@ -149,11 +149,11 @@ public interface SearchReplaceController {
*/
private void checkEdgesToSearch() {
if (edgesToSearch == null || edgesToSearch.length == 0) {
HierarchicalGraph hg;
Graph hg;
if (Lookup.getDefault().lookup(DataTablesController.class).isShowOnlyVisible()) {
hg = Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraphVisible();
hg = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraphVisible();
} else {
hg = Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraph();
hg = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph();
}
edgesToSearch = hg.getEdges().toArray();
}
@@ -273,10 +273,10 @@ public interface SearchReplaceController {
* If columnsToSearch is empty, all columns will be used to search.
* @param columnsToSearch It is safe to specify invalid columns, they will be ignored
*/
public void setColumnsToSearch(AttributeColumn[] columnsToSearch) {
public void setColumnsToSearch(Column[] columnsToSearch) {
this.columnsToSearch.clear();
if (columnsToSearch != null) {
for (AttributeColumn c : columnsToSearch) {
for (Column c : columnsToSearch) {
this.columnsToSearch.add(c.getIndex());
}
}
@@ -46,10 +46,10 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.graph.api.Attributable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Element;
public class AttributeTableCSVExporter {
@@ -68,18 +68,17 @@ public class AttributeTableCSVExporter {
* @param columnsToExport Indicates the indexes of the columns to export. All columns will be exported if null
* @throws IOException When an error happens while writing the file
*/
public static void writeCSVFile(AttributeTable table, File file, Character separator, Charset charset, Integer[] columnsToExport, Attributable[] rows) throws IOException {
public static void writeCSVFile(Table table, File file, Character separator, Charset charset, Integer[] columnsToExport, Element[] rows) throws IOException {
FileOutputStream out = new FileOutputStream(file);
if (separator == null) {
separator = DEFAULT_SEPARATOR;
}
AttributeColumn columns[] = table.getColumns();
if (columnsToExport == null) {
columnsToExport = new Integer[columns.length];
columnsToExport = new Integer[table.countColumns()];
for (int i = 0; i < columnsToExport.length; i++) {
columnsToExport[i] = columns[i].getIndex();
columnsToExport[i] = table.getColumn(i).getIndex();
}
}
@@ -112,13 +111,13 @@ public class AttributeTableCSVExporter {
int columnIndex = columnsToExport[column];
if (columnIndex == FAKE_COLUMN_EDGE_SOURCE) {
value = ((Edge)rows[row]).getSource().getNodeData().getId();
value = ((Edge)rows[row]).getSource().getId();
} else if (columnIndex == FAKE_COLUMN_EDGE_TARGET) {
value = ((Edge)rows[row]).getTarget().getNodeData().getId();
value = ((Edge)rows[row]).getTarget().getId();
} else if (columnIndex == FAKE_COLUMN_EDGE_TYPE) {
value = ((Edge)rows[row]).isDirected() ? "Directed" : "Undirected";
} else {
value = rows[row].getAttributes().getValue(columnIndex);
value = rows[row].getAttribute(table.getColumn(columnIndex));
}
if (value != null) {
@@ -41,7 +41,7 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.api.datatables;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Table;
/**
* <p>This interface defines part of the Data Laboratory API.</p>
@@ -56,7 +56,7 @@ public interface DataTablesController extends DataTablesCommonInterface {
* Request the tables implementation to show the given table (nodes or edges table)
* @param table Table to show
*/
void selectTable(AttributeTable table);
void selectTable(Table table);
/**
* Register a listener for these requests.
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
@@ -45,17 +45,15 @@ import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.gephi.data.attributes.api.AttributeColumn;
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.api.AttributeUtils;
import org.gephi.data.attributes.type.TimeInterval;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Origin;
import org.gephi.attribute.api.Table;
import org.gephi.attribute.time.TimestampSet;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.dynamic.api.DynamicController;
import org.gephi.dynamic.api.DynamicModel;
import org.gephi.graph.api.Attributes;
import org.gephi.graph.api.Element;
import org.gephi.graph.store.GraphStoreConfiguration;
import org.gephi.utils.StatisticsUtils;
import org.openide.util.Lookup;
import org.openide.util.lookup.ServiceProvider;
@@ -69,20 +67,18 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = AttributeColumnsMergeStrategiesController.class)
public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeColumnsMergeStrategiesController {
public AttributeColumn joinWithSeparatorMerge(AttributeTable table, AttributeColumn[] columnsToMerge, AttributeType newColumnType, String newColumnTitle, String separator) {
public Column joinWithSeparatorMerge(Table table, Column[] columnsToMerge, Class newColumnType, String newColumnTitle, String separator) {
if (table == null || columnsToMerge == null) {
throw new IllegalArgumentException("Table or columns can't be null");
}
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, newColumnType != null ? newColumnType : AttributeType.STRING);//Create as STRING column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, newColumnType != null ? newColumnType : String.class);//Create as STRING column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
if (separator == null) {
separator = "";
}
@@ -91,10 +87,10 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
StringBuilder sb;
final int columnsCount = columnsToMerge.length;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
sb = new StringBuilder();
for (int i = 0; i < columnsCount; i++) {
value = row.getValue(columnsToMerge[i].getIndex());
value = row.getAttribute(columnsToMerge[i]);
if (value != null) {
sb.append(value.toString());
if (i < columnsCount - 1) {
@@ -102,35 +98,38 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
}
}
}
row.setValue(newColumnIndex, sb.toString());
row.setAttribute(newColumn, sb.toString());
}
return newColumn;
}
public AttributeColumn booleanLogicOperationsMerge(AttributeTable table, AttributeColumn[] columnsToMerge, BooleanOperations[] booleanOperations, String newColumnTitle) {
AttributeUtils attributeUtils = AttributeUtils.getDefault();
public Column booleanLogicOperationsMerge(Table table, Column[] columnsToMerge, BooleanOperations[] booleanOperations, String newColumnTitle) {
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
if (table == null || columnsToMerge == null || !attributeUtils.areAllColumnsOfType(columnsToMerge, AttributeType.BOOLEAN) || booleanOperations == null || booleanOperations.length != columnsToMerge.length - 1) {
throw new IllegalArgumentException("All columns have to be boolean columns, table, columns or operations can't be null and operations length must be columns length -1");
if (table == null || columnsToMerge == null || booleanOperations == null || booleanOperations.length != columnsToMerge.length - 1) {
throw new IllegalArgumentException("table, columns or operations can't be null and operations length must be columns length -1");
}
for (Column column : columnsToMerge) {
if(!column.getTypeClass().equals(Boolean.class)){
throw new IllegalArgumentException("All columns have to be boolean columns");
}
}
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BOOLEAN);
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, Boolean.class);
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
Boolean value;
Boolean secondValue;
for (Attributes row : ac.getTableAttributeRows(table)) {
value = (Boolean) row.getValue(columnsToMerge[0].getIndex());
for (Element row : ac.getTableAttributeRows(table)) {
value = (Boolean) row.getAttribute(columnsToMerge[0]);
value = value != null ? value : false;//Use false if null
for (int i = 0; i < booleanOperations.length; i++) {
secondValue = (Boolean) row.getValue(columnsToMerge[i + 1].getIndex());
secondValue = (Boolean) row.getAttribute(columnsToMerge[i + 1]);
secondValue = secondValue != null ? secondValue : false;//Use false if null
switch (booleanOperations[i]) {
case AND:
@@ -150,29 +149,28 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
break;
}
}
row.setValue(newColumnIndex, value);
row.setAttribute(newColumn, value);
}
return newColumn;
}
public AttributeColumn mergeNumericColumnsToTimeInterval(AttributeTable table, AttributeColumn startColumn, AttributeColumn endColumn, double defaultStart, double defaultEnd) {
public Column mergeNumericColumnsToTimeInterval(Table table, Column startColumn, Column endColumn, double defaultStart, double defaultEnd) {
checkTableAndOneColumn(table, startColumn, endColumn);
AttributeColumn timeIntervalColumn = getTimeIntervalColumn(table);
final int timeIntervalColumnIndex = timeIntervalColumn.getIndex();
Column timeIntervalColumn = getTimeIntervalColumn(table);
final int startColumnIndex = startColumn != null ? startColumn.getIndex() : -1;
final int endColumnIndex = endColumn != null ? endColumn.getIndex() : -1;
final boolean isStartColumnNumeric = startColumn != null ? AttributeUtils.getDefault().isNumberColumn(startColumn) : false;
final boolean isEndColumnNumeric = endColumn != null ? AttributeUtils.getDefault().isNumberColumn(endColumn) : false;
final boolean isStartColumnNumeric = startColumn != null ? (!AttributeUtils.isDynamicType(startColumn.getTypeClass()) && AttributeUtils.isNumberType(startColumn.getTypeClass())) : false;
final boolean isEndColumnNumeric = endColumn != null ? (!AttributeUtils.isDynamicType(endColumn.getTypeClass()) && AttributeUtils.isNumberType(endColumn.getTypeClass())) : false;
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
Object value;
double start, end;
TimeInterval timeInterval;
for (Attributes row : ac.getTableAttributeRows(table)) {
TimestampSet timeInterval;
for (Element row : ac.getTableAttributeRows(table)) {
if (startColumnIndex != -1) {
value = row.getValue(startColumnIndex);
value = row.getAttribute(startColumn);
if (value != null) {
if (isStartColumnNumeric) {
start = ((Number) value).doubleValue();
@@ -186,7 +184,7 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
start = defaultStart;
}
if (endColumnIndex != -1) {
value = row.getValue(endColumnIndex);
value = row.getAttribute(endColumn);
if (value != null) {
if (isEndColumnNumeric) {
end = ((Number) value).doubleValue();
@@ -210,21 +208,20 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
end = Double.POSITIVE_INFINITY;
}
}
timeInterval = new TimeInterval(start, end);
row.setValue(timeIntervalColumnIndex, timeInterval);
row.addTimestamp(start);
row.addTimestamp(end);
}
Lookup.getDefault().lookup(DynamicController.class).setTimeFormat(DynamicModel.TimeFormat.DOUBLE);
return timeIntervalColumn;
}
public AttributeColumn mergeDateColumnsToTimeInterval(AttributeTable table, AttributeColumn startColumn, AttributeColumn endColumn, SimpleDateFormat dateFormat, String defaultStartDate, String defaultEndDate) {
public Column mergeDateColumnsToTimeInterval(Table table, Column startColumn, Column endColumn, SimpleDateFormat dateFormat, String defaultStartDate, String defaultEndDate) {
checkTableAndOneColumn(table, startColumn, endColumn);
if (dateFormat == null) {
throw new IllegalArgumentException("Date format can't be null can't be null");
}
AttributeColumn timeIntervalColumn = getTimeIntervalColumn(table);
final int timeIntervalColumnIndex = timeIntervalColumn.getIndex();
Column timeIntervalColumn = getTimeIntervalColumn(table);
final int startColumnIndex = startColumn != null ? startColumn.getIndex() : -1;
final int endColumnIndex = endColumn != null ? endColumn.getIndex() : -1;
double defaultStart = parseDateToDouble(dateFormat, defaultStartDate, Double.NEGATIVE_INFINITY);
@@ -233,16 +230,16 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
Object value;
double start, end;
TimeInterval timeInterval;
for (Attributes row : ac.getTableAttributeRows(table)) {
TimestampSet timeInterval;
for (Element row : ac.getTableAttributeRows(table)) {
if (startColumnIndex != -1) {
value = row.getValue(startColumnIndex);
value = row.getAttribute(startColumn);
start = parseDateToDouble(dateFormat, value != null ? value.toString() : null, defaultStart);
} else {
start = defaultStart;
}
if (endColumnIndex != -1) {
value = row.getValue(endColumnIndex);
value = row.getAttribute(endColumn);
end = parseDateToDouble(dateFormat, value != null ? value.toString() : null, defaultEnd);
} else {
end = defaultEnd;
@@ -258,64 +255,57 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
end = Double.POSITIVE_INFINITY;
}
}
timeInterval = new TimeInterval(start, end);
row.setValue(timeIntervalColumnIndex, timeInterval);
row.addTimestamp(start);
row.addTimestamp(end);
}
Lookup.getDefault().lookup(DynamicController.class).setTimeFormat(DynamicModel.TimeFormat.DATE);
return timeIntervalColumn;
}
public AttributeColumn averageNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle) {
public Column averageNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle) {
checkTableAndColumnsAreNumberOrNumberList(table, columnsToMerge);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BIGDECIMAL);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, BigDecimal.class);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
BigDecimal average;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
average = StatisticsUtils.average(ac.getRowNumbers(row, columnsToMerge));
row.setValue(newColumnIndex, average);
row.setAttribute(newColumn, average);
}
return newColumn;
}
public AttributeColumn firstQuartileNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle) {
public Column firstQuartileNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle) {
checkTableAndColumnsAreNumberOrNumberList(table, columnsToMerge);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BIGDECIMAL);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, BigDecimal.class);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
BigDecimal Q1;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
Q1 = StatisticsUtils.quartile1(ac.getRowNumbers(row, columnsToMerge));
row.setValue(newColumnIndex, Q1);
row.setAttribute(newColumn, Q1);
}
return newColumn;
}
public AttributeColumn medianNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle) {
public Column medianNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle) {
checkTableAndColumnsAreNumberOrNumberList(table, columnsToMerge);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BIGDECIMAL);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, BigDecimal.class);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
@@ -323,50 +313,46 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
final int newColumnIndex = newColumn.getIndex();
BigDecimal median;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
median = StatisticsUtils.median(ac.getRowNumbers(row, columnsToMerge));
row.setValue(newColumnIndex, median);
row.setAttribute(newColumn, median);
}
return newColumn;
}
public AttributeColumn thirdQuartileNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle) {
public Column thirdQuartileNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle) {
checkTableAndColumnsAreNumberOrNumberList(table, columnsToMerge);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BIGDECIMAL);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, BigDecimal.class);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
BigDecimal Q3;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
Q3 = StatisticsUtils.quartile3(ac.getRowNumbers(row, columnsToMerge));
row.setValue(newColumnIndex, Q3);
row.setAttribute(newColumn, Q3);
}
return newColumn;
}
public AttributeColumn interQuartileRangeNumberMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle) {
public Column interQuartileRangeNumberMerge(Table table, Column[] columnsToMerge, String newColumnTitle) {
checkTableAndColumnsAreNumberOrNumberList(table, columnsToMerge);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BIGDECIMAL);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, BigDecimal.class);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
BigDecimal IQR, Q1, Q3;
Number[] rowNumbers;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
rowNumbers = ac.getRowNumbers(row, columnsToMerge);
Q3 = StatisticsUtils.quartile3(rowNumbers);
Q1 = StatisticsUtils.quartile1(rowNumbers);
@@ -375,80 +361,74 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
} else {
IQR = null;
}
row.setValue(newColumnIndex, IQR);
row.setAttribute(newColumn, IQR);
}
return newColumn;
}
public AttributeColumn sumNumbersMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle) {
public Column sumNumbersMerge(Table table, Column[] columnsToMerge, String newColumnTitle) {
checkTableAndColumnsAreNumberOrNumberList(table, columnsToMerge);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BIGDECIMAL);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, BigDecimal.class);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
BigDecimal sum;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
sum = StatisticsUtils.sum(ac.getRowNumbers(row, columnsToMerge));
row.setValue(newColumnIndex, sum);
row.setAttribute(newColumn, sum);
}
return newColumn;
}
public AttributeColumn minValueNumbersMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle) {
public Column minValueNumbersMerge(Table table, Column[] columnsToMerge, String newColumnTitle) {
checkTableAndColumnsAreNumberOrNumberList(table, columnsToMerge);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BIGDECIMAL);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, BigDecimal.class);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
BigDecimal min;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
min = StatisticsUtils.minValue(ac.getRowNumbers(row, columnsToMerge));
row.setValue(newColumnIndex, min);
row.setAttribute(newColumn, min);
}
return newColumn;
}
public AttributeColumn maxValueNumbersMerge(AttributeTable table, AttributeColumn[] columnsToMerge, String newColumnTitle) {
public Column maxValueNumbersMerge(Table table, Column[] columnsToMerge, String newColumnTitle) {
checkTableAndColumnsAreNumberOrNumberList(table, columnsToMerge);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumn newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BIGDECIMAL);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
Column newColumn;
newColumn = ac.addAttributeColumn(table, newColumnTitle, BigDecimal.class);//Create as BIGDECIMAL column by default. Then it can be duplicated to other type.
if (newColumn == null) {
return null;
}
final int newColumnIndex = newColumn.getIndex();
BigDecimal max;
for (Attributes row : ac.getTableAttributeRows(table)) {
for (Element row : ac.getTableAttributeRows(table)) {
max = StatisticsUtils.maxValue(ac.getRowNumbers(row, columnsToMerge));
row.setValue(newColumnIndex, max);
row.setAttribute(newColumn, max);
}
return newColumn;
}
/*************Private methods:*************/
private AttributeColumn getTimeIntervalColumn(AttributeTable table) {
AttributeColumn column = table.getColumn(DynamicModel.TIMEINTERVAL_COLUMN);
private Column getTimeIntervalColumn(Table table) {
Column column = table.getColumn(GraphStoreConfiguration.ELEMENT_TIMESTAMP_INDEX);
if (column == null) {
column = table.addColumn(DynamicModel.TIMEINTERVAL_COLUMN, "Time Interval", AttributeType.TIME_INTERVAL, AttributeOrigin.PROPERTY, null);
column = table.addColumn("timestamp", TimestampSet.class, Origin.PROPERTY);
}
return column;
}
@@ -478,7 +458,7 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
}
}
private void checkTableAndOneColumn(AttributeTable table, AttributeColumn startColumn, AttributeColumn endColumn) {
private void checkTableAndOneColumn(Table table, Column startColumn, Column endColumn) {
if (table == null) {
throw new IllegalArgumentException("Table can't be null");
}
@@ -487,16 +467,21 @@ public class AttributeColumnsMergeStrategiesControllerImpl implements AttributeC
}
}
private void checkTableAndColumnsAreNumberOrNumberList(AttributeTable table, AttributeColumn[] columns) {
private void checkTableAndColumnsAreNumberOrNumberList(Table table, Column[] columns) {
if (table == null) {
throw new IllegalArgumentException("Table can't be null");
}
checkColumnsAreNumberOrNumberList(columns);
}
private void checkColumnsAreNumberOrNumberList(AttributeColumn[] columns) {
if (columns == null || !AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns)) {
private void checkColumnsAreNumberOrNumberList(Column[] columns) {
if (columns == null) {
throw new IllegalArgumentException("All columns have to be number or number list columns and can't be null");
}
for (Column column : columns) {
if(!AttributeUtils.isNumberType(column.getTypeClass())){
throw new IllegalArgumentException("All columns have to be number or number list columns and can't be null");
}
}
}
}
@@ -41,8 +41,8 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.impl;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.api.datatables.DataTablesEventListener;
import org.gephi.datalab.api.datatables.DataTablesEventListenerBuilder;
@@ -86,13 +86,12 @@ public class DataTablesControllerImpl implements DataTablesController {
}
}
public void selectTable(AttributeTable table) {
public void selectTable(Table table) {
if (listener != null) {
AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
if (ac.getModel().getNodeTable() == table) {
selectNodesTable();
} else {
if (Lookup.getDefault().lookup(AttributeColumnsController.class).isEdgeTable(table)) {
selectEdgesTable();
} else {
selectNodesTable();
}
}
}
@@ -41,30 +41,23 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.impl;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.properties.PropertiesColumn;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.spi.rows.merge.AttributeRowsMergeStrategy;
import org.gephi.graph.api.Attributes;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.Node;
import org.gephi.graph.api.NodeData;
import org.gephi.graph.api.UndirectedGraph;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
@@ -77,6 +70,7 @@ import org.openide.util.lookup.ServiceProvider;
public class GraphElementsControllerImpl implements GraphElementsController {
private static final float DEFAULT_NODE_SIZE = 10f;
private static final int DEFAULT_EDGE_TYPE = 1;
private static final float DEFAULT_EDGE_WEIGHT = 1f;
public Node createNode(String label) {
@@ -97,9 +91,9 @@ public class GraphElementsControllerImpl implements GraphElementsController {
}
public Node duplicateNode(Node node) {
HierarchicalGraph hg = getHierarchicalGraph();
Graph g = getGraph();
Node copy = copyNodeRecursively(node, hg.getParent(node), hg);//Add copy to the same level as the original node
Node copy = copyNode(node, g);
return copy;
}
@@ -197,101 +191,9 @@ public class GraphElementsControllerImpl implements GraphElementsController {
}
}
public boolean groupNodes(Node[] nodes) {
if (canGroupNodes(nodes)) {
HierarchicalGraph graph = getHierarchicalGraph();
try {
float centroidX = 0;
float centroidY = 0;
int len = 0;
float sizes = 0;
float r = 0;
float g = 0;
float b = 0;
Node group = graph.groupNodes(nodes);
group.getNodeData().setLabel(NbBundle.getMessage(GraphElementsControllerImpl.class, "Group.nodeCount.label", nodes.length));
group.getNodeData().setSize(10f);
for (Node child : nodes) {
centroidX += child.getNodeData().x();
centroidY += child.getNodeData().y();
len++;
sizes += child.getNodeData().getSize() / 10f;
r += child.getNodeData().r();
g += child.getNodeData().g();
b += child.getNodeData().b();
}
centroidX /= len;
centroidY /= len;
group.getNodeData().setSize(sizes);
group.getNodeData().setColor(r / len, g / len, b / len);
group.getNodeData().setX(centroidX);
group.getNodeData().setY(centroidY);
} catch (Exception e) {
graph.readUnlockAll();
NotifyDescriptor.Message nd = new NotifyDescriptor.Message(e.getMessage());
DialogDisplayer.getDefault().notifyLater(nd);
return false;
}
return true;
} else {
return false;
}
}
public boolean canGroupNodes(Node[] nodes) {
HierarchicalGraph hg = getHierarchicalGraph();
Node parent = hg.getParent(nodes[0]);
for (Node n : nodes) {
if (hg.getParent(n) != parent) {
return false;
}
}
return true;
}
public boolean ungroupNode(Node node) {
if (canUngroupNode(node)) {
HierarchicalGraph hg = getHierarchicalGraph();
hg.ungroupNodes(node);
return true;
} else {
return false;
}
}
public void ungroupNodes(Node[] nodes) {
for (Node n : nodes) {
ungroupNode(n);
}
}
public boolean ungroupNodeRecursively(Node node) {
if (canUngroupNode(node)) {
HierarchicalGraph hg = getHierarchicalGraph();
//We can get directly all descendant nodes withoud using recursion and break the groups:
ungroupNodes(hg.getDescendant(node).toArray());
ungroupNode(node);
return true;
} else {
return false;
}
}
public void ungroupNodesRecursively(Node[] nodes) {
for (Node n : nodes) {
ungroupNodeRecursively(n);
}
}
public boolean canUngroupNode(Node node) {
boolean canUngroup;
HierarchicalGraph hg = getHierarchicalGraph();
canUngroup = getNodeChildrenCount(hg, node) > 0;//The node has children
return canUngroup;
}
public Node mergeNodes(Node[] nodes, Node selectedNode, AttributeRowsMergeStrategy[] mergeStrategies, boolean deleteMergedNodes) {
AttributeTable nodesTable = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
Table nodesTable = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable();
Table edgesTable = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable();
if (selectedNode == null) {
selectedNode = nodes[0];//Use first node as selected node if null
}
@@ -300,24 +202,20 @@ public class GraphElementsControllerImpl implements GraphElementsController {
Node newNode = createNode("");
//Set properties (position, size and color) using the selected node properties:
NodeData newNodeData = newNode.getNodeData();
NodeData selectedNodeData = selectedNode.getNodeData();
newNodeData.setX(selectedNodeData.x());
newNodeData.setY(selectedNodeData.y());
newNodeData.setZ(selectedNodeData.z());
newNodeData.setSize(selectedNodeData.getSize());
newNodeData.setColor(selectedNodeData.r(), selectedNodeData.g(), selectedNodeData.b());
newNodeData.setAlpha(selectedNodeData.alpha());
//Prepare node rows:
Attributes[] rows = new Attributes[nodes.length];
for (int i = 0; i < nodes.length; i++) {
rows[i] = nodes[i].getAttributes();
}
newNode.setX(selectedNode.x());
newNode.setY(selectedNode.y());
newNode.setZ(selectedNode.z());
newNode.setSize(selectedNode.size());
newNode.setR(selectedNode.r());
newNode.setG(selectedNode.g());
newNode.setB(selectedNode.b());
newNode.setAlpha(selectedNode.alpha());
//Merge attributes:
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
ac.mergeRowsValues(nodesTable, mergeStrategies, rows, selectedNode.getAttributes(), newNode.getAttributes());
ac.mergeRowsValues(nodesTable, mergeStrategies, nodes, selectedNode, newNode);
Set<Node> nodesSet=new HashSet<Node>();
nodesSet.addAll(Arrays.asList(nodes));
@@ -342,11 +240,8 @@ public class GraphElementsControllerImpl implements GraphElementsController {
if (newEdge != null) {//Edge may not be created if repeated
//Copy edge attributes:
AttributeRow row = (AttributeRow) edge.getAttributes();
for (int i = 0; i < row.countValues(); i++) {
if (row.getAttributeValueAt(i).getColumn().getIndex() != PropertiesColumn.EDGE_ID.getIndex()) {
newEdge.getAttributes().setValue(i, row.getValue(i));
}
for (Column column : edgesTable) {
newEdge.setAttribute(column, edge.getAttribute(column));
}
}
}
@@ -360,86 +255,8 @@ public class GraphElementsControllerImpl implements GraphElementsController {
return newNode;
}
public boolean moveNodeToGroup(Node node, Node group) {
if (canMoveNodeToGroup(node, group)) {
getHierarchicalGraph().moveToGroup(node, group);
return true;
} else {
return false;
}
}
public void moveNodesToGroup(Node[] nodes, Node group) {
for (Node n : nodes) {
moveNodeToGroup(n, group);
}
}
public Node[] getAvailableGroupsToMoveNodes(Node[] nodes) {
if (canGroupNodes(nodes)) {
HierarchicalGraph hg = getHierarchicalGraph();
Set<Node> nodesSet = new HashSet<Node>();
nodesSet.addAll(Arrays.asList(nodes));
//All have the same parent, get children and check what of them are groups and are not in the nodes array:
Node parent = hg.getParent(nodes[0]);
Node[] possibleGroups;
//If no parent, get nodes at level 0:
if (parent != null) {
possibleGroups = hg.getChildren(parent).toArray();
} else {
possibleGroups = hg.getNodes(0).toArray();
}
ArrayList<Node> availableGroups = new ArrayList<Node>();
for (Node n : possibleGroups) {
if (!nodesSet.contains(n) && getNodeChildrenCount(hg, n) > 0) {
availableGroups.add(n);
}
}
return availableGroups.toArray(new Node[0]);
} else {
return null;
}
}
public boolean canMoveNodeToGroup(Node node, Node group) {
HierarchicalGraph hg = getHierarchicalGraph();
return node != group && hg.getParent(node) == hg.getParent(group) && canUngroupNode(group);
}
public boolean removeNodeFromGroup(Node node) {
if (isNodeInGroup(node)) {
HierarchicalGraph hg = getHierarchicalGraph();
Node parent = hg.getParent(node);
hg.readLock();
int childrenCount = hg.getChildrenCount(parent);
hg.readUnlock();
if (childrenCount == 1) {
hg.ungroupNodes(parent);//Break group when the last child is removed.
} else {
hg.removeFromGroup(node);
}
return true;
} else {
return false;
}
}
public void removeNodesFromGroup(Node[] nodes) {
for (Node n : nodes) {
removeNodeFromGroup(n);
}
}
public boolean isNodeInGroup(Node node) {
HierarchicalGraph hg = getHierarchicalGraph();
return hg.getParent(node) != null;
}
public void setNodeFixed(Node node, boolean fixed) {
node.getNodeData().setFixed(fixed);
node.setFixed(fixed);
}
public void setNodesFixed(Node[] nodes, boolean fixed) {
@@ -449,7 +266,7 @@ public class GraphElementsControllerImpl implements GraphElementsController {
}
public boolean isNodeFixed(Node node) {
return node.getNodeData().isFixed();
return node.isFixed();
}
public Node[] getNodeNeighbours(Node node) {
@@ -506,79 +323,62 @@ public class GraphElementsControllerImpl implements GraphElementsController {
/************Private methods : ************/
private Graph getGraph() {
return Lookup.getDefault().lookup(GraphController.class).getModel().getGraph();
return Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph();
}
private DirectedGraph getDirectedGraph() {
return Lookup.getDefault().lookup(GraphController.class).getModel().getDirectedGraph();
return Lookup.getDefault().lookup(GraphController.class).getGraphModel().getDirectedGraph();
}
private UndirectedGraph getUndirectedGraph() {
return Lookup.getDefault().lookup(GraphController.class).getModel().getUndirectedGraph();
}
private HierarchicalGraph getHierarchicalGraph() {
return Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraph();
return Lookup.getDefault().lookup(GraphController.class).getGraphModel().getUndirectedGraph();
}
private Node buildNode(String label) {
Node newNode = Lookup.getDefault().lookup(GraphController.class).getModel().factory().newNode();
newNode.getNodeData().setSize(DEFAULT_NODE_SIZE);
newNode.getNodeData().setLabel(label);
Node newNode = Lookup.getDefault().lookup(GraphController.class).getGraphModel().factory().newNode();
newNode.setSize(DEFAULT_NODE_SIZE);
newNode.setLabel(label);
return newNode;
}
private Node buildNode(String label, String id) {
Node newNode = Lookup.getDefault().lookup(GraphController.class).getModel().factory().newNode(id);
newNode.getNodeData().setSize(DEFAULT_NODE_SIZE);
newNode.getNodeData().setLabel(label);
Node newNode = Lookup.getDefault().lookup(GraphController.class).getGraphModel().factory().newNode(id);
newNode.setSize(DEFAULT_NODE_SIZE);
newNode.setLabel(label);
return newNode;
}
private Edge buildEdge(Node source, Node target, boolean directed) {
Edge newEdge = Lookup.getDefault().lookup(GraphController.class).getModel().factory().newEdge(source, target, DEFAULT_EDGE_WEIGHT, directed);
Edge newEdge = Lookup.getDefault().lookup(GraphController.class).getGraphModel().factory().newEdge(source, target, DEFAULT_EDGE_TYPE, DEFAULT_EDGE_WEIGHT, directed);
return newEdge;
}
private Edge buildEdge(String id, Node source, Node target, boolean directed) {
Edge newEdge = Lookup.getDefault().lookup(GraphController.class).getModel().factory().newEdge(id, source, target, DEFAULT_EDGE_WEIGHT, directed);
Edge newEdge = Lookup.getDefault().lookup(GraphController.class).getGraphModel().factory().newEdge(id, source, target, DEFAULT_EDGE_TYPE, DEFAULT_EDGE_WEIGHT, directed);
return newEdge;
}
private Node copyNodeRecursively(Node node, Node parent, HierarchicalGraph hg) {
NodeData nodeData = node.getNodeData();
Node copy = buildNode(nodeData.getLabel());
NodeData copyData = copy.getNodeData();
private Node copyNode(Node node, Graph g) {
Node copy = buildNode(node.getLabel());
//Copy properties (position, size and color):
copyData.setX(nodeData.x());
copyData.setY(nodeData.y());
copyData.setZ(nodeData.z());
copyData.setSize(nodeData.getSize());
copyData.setColor(nodeData.r(), nodeData.g(), nodeData.b());
copyData.setAlpha(nodeData.alpha());
copy.setX(node.x());
copy.setY(node.y());
copy.setZ(node.z());
copy.setSize(node.size());
copy.setR(node.r());
copy.setG(node.g());
copy.setB(node.b());
copy.setAlpha(node.alpha());
Table nodeTable = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable();
//Copy attributes:
AttributeRow row = (AttributeRow) nodeData.getAttributes();
for (int i = 0; i < row.countValues(); i++) {
if (row.getAttributeValueAt(i).getColumn().getIndex() != PropertiesColumn.NODE_ID.getIndex()) {
copyData.getAttributes().setValue(i, row.getValue(i));
}
for (Column column : nodeTable) {
copy.setAttribute(column, node.getAttribute(column));
}
if (parent != null) {
hg.addNode(copy, parent);
} else {
hg.addNode(copy);
}
//Copy the children of the original node if any:
Node[] children = hg.getChildren(node).toArray();
if (children != null) {
for (Node child : children) {
copyNodeRecursively(child, copy, hg);
}
}
g.addNode(copy);
return copy;
}
@@ -590,11 +390,4 @@ public class GraphElementsControllerImpl implements GraphElementsController {
private void removeEdge(Edge edge, Graph graph) {
graph.removeEdge(edge);
}
private int getNodeChildrenCount(HierarchicalGraph hg, Node n) {
hg.readLock();
int childrenCount = hg.getChildrenCount(n);
hg.readUnlock();
return childrenCount;
}
}
@@ -43,16 +43,15 @@ package org.gephi.datalab.impl;
import java.util.Set;
import java.util.regex.Matcher;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.api.SearchReplaceController;
import org.gephi.datalab.api.SearchReplaceController.SearchResult;
import org.gephi.graph.api.Attributes;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Element;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.Node;
import org.openide.util.Lookup;
import org.openide.util.lookup.ServiceProvider;
@@ -100,14 +99,14 @@ public class SearchReplaceControllerImpl implements SearchReplaceController {
}
public boolean canReplace(SearchResult result) {
AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
AttributeTable table;
AttributeColumn column;
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
Table table;
Column column;
if (result.getFoundNode() != null) {
table = ac.getModel().getNodeTable();
table = gc.getAttributeModel().getNodeTable();
column = table.getColumn(result.getFoundColumnIndex());
} else {
table = ac.getModel().getEdgeTable();
table = gc.getAttributeModel().getEdgeTable();
column = table.getColumn(result.getFoundColumnIndex());
}
return Lookup.getDefault().lookup(AttributeColumnsController.class).canChangeColumnData(column);
@@ -118,14 +117,14 @@ public class SearchReplaceControllerImpl implements SearchReplaceController {
throw new IllegalArgumentException();
}
if (!canReplace(result)) {
//Data has changed and the replacement can't be done, continue finding.
//Data has changed and the replacement can't be done, continue looking.
return findNext(result);//Go to next search result
}
AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
Object value;
String str;
Attributes attributes;
AttributeColumn column;
Element attributes;
Column column;
if (!result.getSearchOptions().isUseRegexReplaceMode()) {
replacement = Matcher.quoteReplacement(replacement);//Avoid using groups and other regex aspects in the replacement
@@ -134,13 +133,13 @@ public class SearchReplaceControllerImpl implements SearchReplaceController {
try {
//Get value to re-match and replace:
if (result.getFoundNode() != null) {
attributes = result.getFoundNode().getNodeData().getAttributes();
column = ac.getModel().getNodeTable().getColumn(result.getFoundColumnIndex());
attributes = result.getFoundNode();
column = gc.getAttributeModel().getNodeTable().getColumn(result.getFoundColumnIndex());
} else {
attributes = result.getFoundEdge().getEdgeData().getAttributes();
column = ac.getModel().getEdgeTable().getColumn(result.getFoundColumnIndex());
attributes = result.getFoundEdge();
column = gc.getAttributeModel().getEdgeTable().getColumn(result.getFoundColumnIndex());
}
value = attributes.getValue(result.getFoundColumnIndex());
value = attributes.getAttribute(column);
str = value != null ? value.toString() : "";
StringBuffer sb = new StringBuffer();
@@ -156,14 +155,14 @@ public class SearchReplaceControllerImpl implements SearchReplaceController {
Lookup.getDefault().lookup(AttributeColumnsController.class).setAttributeValue(str, attributes, column);
return findNext(result);//Go to next search result
} else {
//Data has changed and the replacement can't be done, continue finding.
//Data has changed and the replacement can't be done, continue looking.
return findNext(result);//Go to next search result
}
} catch (Exception ex) {
if (ex instanceof IndexOutOfBoundsException) {
throw new IndexOutOfBoundsException();//Rethrow the exception when it is caused by a bad regex replacement
}
//Data has changed (a lot of different errors can happen) and the replacement can't be done, continue finding.
//Data has changed (a lot of different errors can happen) and the replacement can't be done, continue looking.
return findNext(result);//Go to next search result
}
}
@@ -191,17 +190,21 @@ public class SearchReplaceControllerImpl implements SearchReplaceController {
SearchResult result = null;
Set<Integer> columnsToSearch = searchOptions.getColumnsToSearch();
boolean searchAllColumns = columnsToSearch.isEmpty();
Table table = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable();
Node[] nodes = searchOptions.getNodesToSearch();
AttributeRow row;
Node row;
Column column;
Object value;
for (; rowIndex < nodes.length; rowIndex++) {
if (!gec.isNodeInGraph(nodes[rowIndex])) {
continue;//Make sure node is still in graph when continuing a search
}
row = (AttributeRow) nodes[rowIndex].getNodeData().getAttributes();
for (; columnIndex < row.countValues(); columnIndex++) {
row = nodes[rowIndex];
for (; columnIndex < table.countColumns(); columnIndex++) {
if (searchAllColumns || columnsToSearch.contains(columnIndex)) {
value = row.getValue(columnIndex);
column = table.getColumn(columnIndex);
value = row.getAttribute(column);
result = matchRegex(value, searchOptions, rowIndex, columnIndex);
if (result != null) {
result.setFoundNode(nodes[rowIndex]);
@@ -221,17 +224,21 @@ public class SearchReplaceControllerImpl implements SearchReplaceController {
SearchResult result = null;
Set<Integer> columnsToSearch = searchOptions.getColumnsToSearch();
boolean searchAllColumns = columnsToSearch.isEmpty();
Table table = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable();
Edge[] edges = searchOptions.getEdgesToSearch();
AttributeRow row;
Edge row;
Column column;
Object value;
for (; rowIndex < edges.length; rowIndex++) {
if (!gec.isEdgeInGraph(edges[rowIndex])) {
continue;//Make sure edge is still in graph when continuing a search
}
row = (AttributeRow) edges[rowIndex].getEdgeData().getAttributes();
for (; columnIndex < row.countValues(); columnIndex++) {
row = edges[rowIndex];
for (; columnIndex < table.countColumns(); columnIndex++) {
if (searchAllColumns || columnsToSearch.contains(columnIndex)) {
value = row.getValue(columnIndex);
column = table.getColumn(columnIndex);
value = row.getAttribute(column);
result = matchRegex(value, searchOptions, rowIndex, columnIndex);
if (result != null) {
result.setFoundEdge(edges[rowIndex]);
@@ -1,61 +1,62 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.spi.columns;
import java.awt.Image;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
/**
* <p>Manipulation action to use for Data Laboratory column manipulator buttons.</p>
* <p>This special type of manipulator does not need any builder, implementations can be published simply with <code>@ServiceProvider(service = AttributeColumnsManipulator.class)</code> annotation</p>
* <p>This special type of manipulator does not need any builder, implementations can be published simply with
* <code>@ServiceProvider(service = AttributeColumnsManipulator.class)</code> annotation</p>
* <p>These are shown as drop down buttons and are able to:</p>
* <ul>
* <li>Execute an action with 1 column</li>
* <li>Provide a name, description, type and order of appearance (position in group of its type)</li>
* <li>Indicate wether they can be executed on a specific AttributeColumn or not</li>
* <li>Provide and UI or not</li>
* <li>Provide and icon or not</li>
* <li>Execute an action with 1 column</li>
* <li>Provide a name, description, type and order of appearance (position in group of its type)</li>
* <li>Indicate wether they can be executed on a specific AttributeColumn or not</li>
* <li>Provide and UI or not</li>
* <li>Provide and icon or not</li>
* </ul>
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@@ -63,53 +64,59 @@ public interface AttributeColumnsManipulator {
/**
* Execute this AttributeColumnsManipulator with the indicated table and column
*
* @param table AttributeTable of the column
* @param column AttributeColumn of the table to manipulate
*/
void execute(AttributeTable table,AttributeColumn column);
void execute(Table table, Column column);
/**
* Return name to show for this AttributeColumnsManipulator on the ui.
*
* @return Name to show in UI
*/
String getName();
/**
* Description of the AttributeColumnsManipulator.
*
* @return Description
*/
String getDescription();
/**
* Indicates if this AttributeColumnsManipulator can manipulate a specific AttributeColumn.
*
* @return True if it can manipulate the column, false otherwise
*/
boolean canManipulateColumn(AttributeTable table,AttributeColumn column);
boolean canManipulateColumn(Table table, Column column);
/**
* Returns a ManipulatorUI for this Manipulator if it needs one.
*
* @param table AttributeTable of the column
* @param column AttributeColumn of the table to manipulate
* @return ManipulatorUI for this Manipulator or null
*/
AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column);
AttributeColumnsManipulatorUI getUI(Table table, Column column);
/**
* Type of manipulator. This is used for separating the manipulators
* in groups when shown. First types to show will be the lesser.
* Type of manipulator. This is used for separating the manipulators in groups when shown. First types to show will be the lesser.
*
* @return Type of this manipulator
*/
int getType();
/**
* Returns a position value that indicates the position
* of this AttributeColumnsManipulator in its type group. Less means upper.
* Returns a position value that indicates the position of this AttributeColumnsManipulator in its type group. Less means upper.
*
* @return This AttributeColumnsManipulator position
*/
int getPosition();
/**
* Returns an icon for this AttributeColumnsManipulator if necessary.
*
* @return Icon for the manipulator or null
*/
Image getIcon();
@@ -43,8 +43,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.spi.columns;
import javax.swing.JPanel;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.spi.DialogControls;
/**
@@ -63,7 +63,7 @@ public interface AttributeColumnsManipulatorUI {
* @param column Column to manipulate
* @param dialogControls Used to enable/disable the dialog controls
*/
void setup(AttributeColumnsManipulator m, AttributeTable table, AttributeColumn column, DialogControls dialogControls);
void setup(AttributeColumnsManipulator m, Table table, Column column, DialogControls dialogControls);
/**
* Called when the window is closed or accepted.
@@ -41,8 +41,8 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.spi.columns.merge;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.spi.Manipulator;
/**
@@ -59,5 +59,5 @@ public interface AttributeColumnsMergeStrategy extends Manipulator{
* @param table Table of the columns
* @param columns Columns to merge
*/
void setup(AttributeTable table, AttributeColumn[] columns);
void setup(Table table, Column[] columns);
}
@@ -41,9 +41,9 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.spi.rows.merge;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.spi.Manipulator;
import org.gephi.graph.api.Attributes;
import org.gephi.graph.api.Element;
/**
* <p>Service for defining strategies for merging a column of rows of a table.</p>
@@ -61,7 +61,7 @@ public interface AttributeRowsMergeStrategy extends Manipulator{
* @param selectedRow Main row of the row group to merge
* @param column Column to merge
*/
void setup(Attributes[] rows, Attributes selectedRow, AttributeColumn column);
void setup(Element[] rows, Element selectedRow, Column column);
/**
* This method is always called after the strategy is set up and executed.
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.spi.values;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeRow;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.spi.Manipulator;
import org.gephi.graph.api.Element;
/**
* Manipulator for a single AttributeValue (cells) on right click.
@@ -58,5 +58,5 @@ public interface AttributeValueManipulator extends Manipulator{
* @param row Row
* @param column Column
*/
void setup (AttributeRow row, AttributeColumn column);
void setup (Element row, Column column);
}
@@ -0,0 +1,144 @@
/*
Copyright 2008-2013 Gephi
Authors : Eduardo Ramos<eduramiba@gmail.com>
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.datalab.utils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.gephi.attribute.api.AttributeUtils;
/**
* Simple wrapper class for column type selection in UI.
* @author Eduardo Ramos<eduramiba@gmail.com>
*/
public class SupportedColumnTypeWrapper implements Comparable<SupportedColumnTypeWrapper> {
private final Class type;
public SupportedColumnTypeWrapper(Class type) {
this.type = type;
}
@Override
public String toString() {
String name = type.getSimpleName();
return name;
}
public Class getType() {
return type;
}
@Override
public int hashCode() {
int hash = 7;
hash = 17 * hash + (this.type != null ? this.type.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final SupportedColumnTypeWrapper other = (SupportedColumnTypeWrapper) obj;
if (this.type != other.type && (this.type == null || !this.type.equals(other.type))) {
return false;
}
return true;
}
/**
* Order for column types by name.
* Simple types appear first, then dynamic types and then array/list types.
* @param other
* @return
*/
@Override
public int compareTo(SupportedColumnTypeWrapper other) {
boolean isArray = type.isArray();
boolean isArrayOther = other.type.isArray();
if(isArray != isArrayOther){
if(isArray){
return 1;
}else{
return -1;
}
}else{
boolean isDynamic = AttributeUtils.isDynamicType(type);
boolean isDynamicOther = AttributeUtils.isDynamicType(other.type);
if(isDynamic != isDynamicOther){
if(isDynamic){
return 1;
}else{
return -1;
}
}else{
return type.getSimpleName().compareTo(other.type.getSimpleName());
}
}
}
/**
* Build a list of column type wrappers from GraphStore supported types.
* @return Ordered column type wrappers list
*/
public static List<SupportedColumnTypeWrapper> buildOrderedSupportedTypesList(){
List<SupportedColumnTypeWrapper> supportedTypesWrappers = new ArrayList<SupportedColumnTypeWrapper>();
for (Class type : AttributeUtils.getSupportedTypes()) {
if(AttributeUtils.isStandardizedType(type)){
supportedTypesWrappers.add(new SupportedColumnTypeWrapper(type));
}
}
Collections.sort(supportedTypesWrappers);
return supportedTypesWrappers;
}
}
+4 -4
Ver Arquivo
@@ -16,10 +16,6 @@
<name>DataLaboratoryPlugin</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data-attributes-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>datalab-api</artifactId>
@@ -28,6 +24,10 @@
<groupId>${project.groupId}</groupId>
<artifactId>graph-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dynamic-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>core-library-wrapper</artifactId>
@@ -42,6 +42,7 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators;
import org.gephi.datalab.plugin.manipulators.nodes.CopyNodeDataToOtherNodes;
import org.gephi.graph.api.Element;
/**
* Interface in common for choosing columns to manipulate.
@@ -55,17 +56,17 @@ public interface GeneralColumnsAndRowChooser extends GeneralColumnsChooser{
* Provide rows (nodes or edges) to show in the GeneralChooseColumnsAndRowUI to be selected or not.
* @return Nodes or edges set to select one
*/
Object[] getRows();
Element[] getRows();
/**
* Provide initially selected node or edge in the GeneralChooseColumnsAndRowUI
* @return Initially selected node or edge
*/
Object getRow();
Element getRow();
/**
* The GeneralChooseColumnsAndRowUI will use this method to set the row to finally manipulate, after the GeneralChooseColumnsAndRowUI is closed.
* @param row Selected node or edge depending on the manipulator
*/
void setRow(Object row);
void setRow(Element row);
}
@@ -41,7 +41,7 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.plugin.manipulators.nodes.ClearNodesData;
/**
@@ -57,13 +57,13 @@ public interface GeneralColumnsChooser{
* Normally provide all table columns that can be manipulated.
* @return Columns to show in the GeneralChooseColumnsUI
*/
AttributeColumn[] getColumns();
Column[] getColumns();
/**
* The GeneralChooseColumnsUI will use this method to set the columns to finally manipulate, after the GeneralChooseColumnsUI is closed.
* @param columnsToClearData Columns to manipulate
*/
void setColumns(AttributeColumn[] columnsToClearData);
void setColumns(Column[] columnsToClearData);
/**
* Provide title for the GeneralChooseColumnsUI.
@@ -1,50 +1,50 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import javax.swing.JOptionPane;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -55,15 +55,15 @@ import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
* AttributeColumnsManipulator that clears all data of a AttributeColumn of a AttributeTable.
* Only allows to clear columns with DATA AttributeOrigin or the label column of nodes and edges table.
* AttributeColumnsManipulator that clears all data of a Column of a AttributeTable. Only allows to clear columns with DATA AttributeOrigin or the label column of nodes and edges table.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service = AttributeColumnsManipulator.class)
public class ClearColumnData implements AttributeColumnsManipulator {
public void execute(AttributeTable table, AttributeColumn column) {
if (JOptionPane.showConfirmDialog(null, NbBundle.getMessage(ClearColumnData.class, "ClearColumnData.confirmation.message",column.getTitle()), getName(), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
public void execute(Table table, Column column) {
if (JOptionPane.showConfirmDialog(null, NbBundle.getMessage(ClearColumnData.class, "ClearColumnData.confirmation.message", column.getTitle()), getName(), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
Lookup.getDefault().lookup(AttributeColumnsController.class).clearColumnData(table, column);
Lookup.getDefault().lookup(DataTablesController.class).selectTable(table);
}
@@ -77,14 +77,14 @@ public class ClearColumnData implements AttributeColumnsManipulator {
return "";
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
boolean result;
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
result=ac.canClearColumnData(column);
return result&&ac.getTableRowsCount(table)>0;//Also make sure that there is at least 1 row
result = ac.canClearColumnData(column);
return result && ac.getTableRowsCount(table) > 0;//Also make sure that there is at least 1 row
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table, Column column) {
return null;
}
@@ -49,8 +49,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.plugin.manipulators.columns.ui.ColumnValuesFrequencyUI;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -66,7 +66,6 @@ import org.openide.util.Exceptions;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
* AttributeColumnsManipulator that shows a report with a list of the different values of a column and their frequency of appearance.
@@ -77,7 +76,7 @@ public class ColumnValuesFrequency implements AttributeColumnsManipulator {
public static final int MAX_PIE_CHART_CATEGORIES = 100;
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
}
public String getName() {
@@ -88,12 +87,12 @@ public class ColumnValuesFrequency implements AttributeColumnsManipulator {
return NbBundle.getMessage(ColumnValuesFrequency.class, "ColumnValuesFrequency.description");
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
return ac.getTableRowsCount(table) > 0;//Make sure that there is at least 1 row
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table,Column column) {
return new ColumnValuesFrequencyUI();
}
@@ -109,7 +108,7 @@ public class ColumnValuesFrequency implements AttributeColumnsManipulator {
return ImageUtilities.loadImage("org/gephi/datalab/plugin/manipulators/resources/frequency-list.png");
}
public String getReportHTML(AttributeTable table, AttributeColumn column, Map<Object, Integer> valuesFrequencies, JFreeChart pieChart, Dimension dimension) {
public String getReportHTML(Table table, Column column, Map<Object, Integer> valuesFrequencies, JFreeChart pieChart, Dimension dimension) {
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
int totalValuesCount = ac.getTableRowsCount(table);
ArrayList<Object> values = new ArrayList<Object>(valuesFrequencies.keySet());
@@ -187,7 +186,7 @@ public class ColumnValuesFrequency implements AttributeColumnsManipulator {
sb.append("</li>");
}
public Map<Object, Integer> buildValuesFrequencies(AttributeTable table, AttributeColumn column){
public Map<Object, Integer> buildValuesFrequencies(Table table, Column column){
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
return ac.calculateColumnValuesFrequencies(table, column);
}
@@ -42,8 +42,8 @@
package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.plugin.manipulators.columns.ui.ConvertColumnToDynamicUI;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -61,14 +61,13 @@ public class ConvertColumnToDynamic implements AttributeColumnsManipulator {
private String title;
private double low, high;
private boolean lopen, ropen;
private boolean replaceColumn;
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
if (replaceColumn) {
Lookup.getDefault().lookup(AttributeColumnsController.class).convertAttributeColumnToDynamic(table, column, low, high, lopen, ropen);
Lookup.getDefault().lookup(AttributeColumnsController.class).convertAttributeColumnToDynamic(table, column, low, high);
} else {
Lookup.getDefault().lookup(AttributeColumnsController.class).convertAttributeColumnToNewDynamicColumn(table, column, low, high, lopen, ropen, title);
Lookup.getDefault().lookup(AttributeColumnsController.class).convertAttributeColumnToNewDynamicColumn(table, column, low, high, title);
}
}
@@ -80,11 +79,11 @@ public class ConvertColumnToDynamic implements AttributeColumnsManipulator {
return "";
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
return Lookup.getDefault().lookup(AttributeColumnsController.class).canConvertColumnToDynamic(column);
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table, AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table, Column column) {
return new ConvertColumnToDynamicUI();
}
@@ -124,22 +123,6 @@ public class ConvertColumnToDynamic implements AttributeColumnsManipulator {
this.high = high;
}
public boolean isLopen() {
return lopen;
}
public void setLopen(boolean lopen) {
this.lopen = lopen;
}
public boolean isRopen() {
return ropen;
}
public void setRopen(boolean ropen) {
this.ropen = ropen;
}
public boolean isReplaceColumn() {
return replaceColumn;
}
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.plugin.manipulators.columns.ui.CopyDataToOtherColumnUI;
@@ -55,16 +55,16 @@ import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
* AttributeColumnsManipulator that copies data from a AttributeColumn of a AttributeTable to other AttributeColumn.
* AttributeColumnsManipulator that copies data from a Column of a Table to other AttributeColumn.
* Allows the user to select the target column in the UI
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service = AttributeColumnsManipulator.class)
public class CopyDataToOtherColumn implements AttributeColumnsManipulator {
AttributeColumn targetColumn;
Column targetColumn;
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
if (targetColumn != null && targetColumn != column) {
Lookup.getDefault().lookup(AttributeColumnsController.class).copyColumnDataToOtherColumn(table, column, targetColumn);
Lookup.getDefault().lookup(DataTablesController.class).refreshCurrentTable();
@@ -79,11 +79,11 @@ public class CopyDataToOtherColumn implements AttributeColumnsManipulator {
return "";
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
return true;
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table,Column column) {
return new CopyDataToOtherColumnUI();
}
@@ -99,11 +99,11 @@ public class CopyDataToOtherColumn implements AttributeColumnsManipulator {
return ImageUtilities.loadImage("org/gephi/datalab/plugin/manipulators/resources/table-duplicate-column.png");
}
public AttributeColumn getTargetColumn() {
public Column getTargetColumn() {
return targetColumn;
}
public void setTargetColumn(AttributeColumn targetColumn) {
public void setTargetColumn(Column targetColumn) {
this.targetColumn = targetColumn;
}
}
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.plugin.manipulators.columns.ui.GeneralCreateColumnFromRegexUI;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -61,7 +61,7 @@ import org.openide.util.lookup.ServiceProvider;
*/
@ServiceProvider(service = AttributeColumnsManipulator.class)
public class CreateBooleanMatchesColumn extends GeneralCreateColumnFromRegex{
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
if (pattern != null) {
Lookup.getDefault().lookup(AttributeColumnsController.class).createBooleanMatchesColumn(table, column, title, pattern);
}
@@ -75,12 +75,12 @@ public class CreateBooleanMatchesColumn extends GeneralCreateColumnFromRegex{
return NbBundle.getMessage(CreateBooleanMatchesColumn.class, "CreateBooleanMatchesColumn.description");
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
return ac.getTableRowsCount(table)>0;//Make sure that there is at least 1 row
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table,Column column) {
GeneralCreateColumnFromRegexUI ui=new GeneralCreateColumnFromRegexUI();
ui.setMode(GeneralCreateColumnFromRegexUI.Mode.BOOLEAN);
return ui;
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.plugin.manipulators.columns.ui.GeneralCreateColumnFromRegexUI;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -62,7 +62,7 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = AttributeColumnsManipulator.class)
public class CreateFoundGroupsListColumn extends GeneralCreateColumnFromRegex {
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
if (pattern != null) {
Lookup.getDefault().lookup(AttributeColumnsController.class).createFoundGroupsListColumn(table, column, title, pattern);
}
@@ -76,12 +76,12 @@ public class CreateFoundGroupsListColumn extends GeneralCreateColumnFromRegex {
return NbBundle.getMessage(CreateFoundGroupsListColumn.class, "CreateFoundGroupsListColumn.description");
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
return ac.getTableRowsCount(table)>0;//Make sure that there is at least 1 row
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table,Column column) {
GeneralCreateColumnFromRegexUI ui = new GeneralCreateColumnFromRegexUI();
ui.setMode(GeneralCreateColumnFromRegexUI.Mode.MATCHING_GROUPS);
return ui;
@@ -43,8 +43,8 @@ package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import javax.swing.JOptionPane;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -55,14 +55,14 @@ import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
* AttributeColumnsManipulator that deletes a AttributeColumn of a AttributeTable.
* AttributeColumnsManipulator that deletes a Column of a AttributeTable.
* Only allows to delete columns with DATA AttributeOrigin.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service = AttributeColumnsManipulator.class)
public class DeleteColumn implements AttributeColumnsManipulator {
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
if (JOptionPane.showConfirmDialog(null, NbBundle.getMessage(ClearColumnData.class, "DeleteColumn.confirmation.message", column.getTitle()), getName(), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
Lookup.getDefault().lookup(AttributeColumnsController.class).deleteAttributeColumn(table, column);
Lookup.getDefault().lookup(DataTablesController.class).selectTable(table);
@@ -77,11 +77,11 @@ public class DeleteColumn implements AttributeColumnsManipulator {
return "";
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
return Lookup.getDefault().lookup(AttributeColumnsController.class).canDeleteColumn(column);
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table,Column column) {
return null;
}
@@ -42,9 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.plugin.manipulators.columns.ui.DuplicateColumnUI;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -55,16 +54,16 @@ import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
* AttributeColumnsManipulator that duplicate a AttributeColumn of a AttributeTable setting the same values for the rows.
* AttributeColumnsManipulator that duplicate a Column of a Table setting the same values for the rows.
* Allows the user to select the title and AttributeType of the new column in the UI
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service = AttributeColumnsManipulator.class)
public class DuplicateColumn implements AttributeColumnsManipulator {
private String title;
private AttributeType columnType;
private Class columnType;
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
Lookup.getDefault().lookup(AttributeColumnsController.class).duplicateColumn(table, column, title, columnType);
}
@@ -76,11 +75,11 @@ public class DuplicateColumn implements AttributeColumnsManipulator {
return "";
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
return true;
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table,Column column) {
return new DuplicateColumnUI();
}
@@ -104,11 +103,11 @@ public class DuplicateColumn implements AttributeColumnsManipulator {
this.title = title;
}
public AttributeType getColumnType() {
public Class getColumnType() {
return columnType;
}
public void setColumnType(AttributeType columnType) {
public void setColumnType(Class columnType) {
this.columnType = columnType;
}
}
@@ -43,8 +43,8 @@ package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import javax.swing.JOptionPane;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -55,13 +55,13 @@ import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
* AttributeColumnsManipulator that fills an AttributeColumn with the value that the user provides in the UI.
* AttributeColumnsManipulator that fills an Column with the value that the user provides in the UI.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service = AttributeColumnsManipulator.class)
public class FillColumnWithValue implements AttributeColumnsManipulator {
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
String value = JOptionPane.showInputDialog(null,NbBundle.getMessage(FillColumnWithValue.class, "FillColumnWithValue.inputDialog.text"),getName(),JOptionPane.QUESTION_MESSAGE);
if (value != null) {
Lookup.getDefault().lookup(AttributeColumnsController.class).fillColumnWithValue(table, column, value);
@@ -77,11 +77,11 @@ public class FillColumnWithValue implements AttributeColumnsManipulator {
return "";
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
return Lookup.getDefault().lookup(AttributeColumnsController.class).canChangeColumnData(column);
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table,Column column) {
return null;
}
@@ -1,50 +1,49 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -56,12 +55,13 @@ import org.openide.util.lookup.ServiceProvider;
/**
* AttributeColumnsManipulator that negates the not null values of a boolean or boolean list column.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service = AttributeColumnsManipulator.class)
public class NegateBooleanColumn implements AttributeColumnsManipulator {
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
Lookup.getDefault().lookup(AttributeColumnsController.class).negateBooleanColumn(table, column);
Lookup.getDefault().lookup(DataTablesController.class).refreshCurrentTable();
}
@@ -74,11 +74,11 @@ public class NegateBooleanColumn implements AttributeColumnsManipulator {
return "";
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
return column.getType()==AttributeType.BOOLEAN||column.getType()==AttributeType.LIST_BOOLEAN;
public boolean canManipulateColumn(Table table, Column column) {
return column.getTypeClass() == Boolean.class || column.getTypeClass() == Boolean[].class;
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table, Column column) {
return null;
}
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns;
import java.awt.Image;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.plugin.manipulators.ui.GeneralNumberListStatisticsReportUI;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -60,7 +60,7 @@ import org.openide.util.NbBundle;
//@ServiceProvider(service = AttributeColumnsManipulator.class)
public class NumberColumnStatisticsReport implements AttributeColumnsManipulator {
public void execute(AttributeTable table, AttributeColumn column) {
public void execute(Table table, Column column) {
}
public String getName() {
@@ -71,12 +71,12 @@ public class NumberColumnStatisticsReport implements AttributeColumnsManipulator
return getMessage("NumberColumnStatisticsReport.description");
}
public boolean canManipulateColumn(AttributeTable table, AttributeColumn column) {
public boolean canManipulateColumn(Table table, Column column) {
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
return AttributeUtils.getDefault().isNumberOrNumberListColumn(column) && ac.getTableRowsCount(table) > 0;//Make sure it is a number/number list column and there is at least 1 row
return AttributeUtils.isNumberType(column.getTypeClass()) && ac.getTableRowsCount(table) > 0;//Make sure it is a number/number list column and there is at least 1 row
}
public AttributeColumnsManipulatorUI getUI(AttributeTable table,AttributeColumn column) {
public AttributeColumnsManipulatorUI getUI(Table table,Column column) {
return new GeneralNumberListStatisticsReportUI(getColumnNumbers(table, column), column.getTitle(), getName());
}
@@ -92,7 +92,7 @@ public class NumberColumnStatisticsReport implements AttributeColumnsManipulator
return ImageUtilities.loadImage("org/gephi/datalab/plugin/manipulators/resources/statistics.png");
}
public Number[] getColumnNumbers(final AttributeTable table, final AttributeColumn column) {
public Number[] getColumnNumbers(final Table table, final Column column) {
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
Number[] columnNumbers = ac.getColumnNumbers(table, column);
return columnNumbers;
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -59,11 +59,11 @@ import org.openide.util.NbBundle;
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class AverageNumber implements AttributeColumnsMergeStrategy, GeneralColumnTitleChooser{
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table=table;
this.columns=columns;
}
@@ -81,7 +81,13 @@ public class AverageNumber implements AttributeColumnsMergeStrategy, GeneralColu
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if(!AttributeUtils.isNumberType(column.getTypeClass())){
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -100,7 +106,7 @@ public class AverageNumber implements AttributeColumnsMergeStrategy, GeneralColu
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/balance.png",true);
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -1,51 +1,49 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController.BooleanOperations;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.BooleanLogicOperationsUI;
@@ -56,19 +54,20 @@ import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* AttributeColumnsMergeStrategy for only all boolean columns that allows the user to select
* each operation to apply between each pair of columns to merge.
* AttributeColumnsMergeStrategy for only all boolean columns that allows the user to select each operation to apply between each pair of columns to merge.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class BooleanLogicOperations implements AttributeColumnsMergeStrategy{
private AttributeTable table;
private AttributeColumn[] columns;
private String newColumnTitle;
private BooleanOperations[] booleanOperations;
public class BooleanLogicOperations implements AttributeColumnsMergeStrategy {
public void setup(AttributeTable table, AttributeColumn[] columns) {
this.columns=columns;
this.table=table;
private Table table;
private Column[] columns;
private String newColumnTitle;
private BooleanOperations[] booleanOperations;
public void setup(Table table, Column[] columns) {
this.columns = columns;
this.table = table;
}
public void execute() {
@@ -84,8 +83,13 @@ public class BooleanLogicOperations implements AttributeColumnsMergeStrategy{
}
public boolean canExecute() {
AttributeUtils attributeUtils=AttributeUtils.getDefault();
return attributeUtils.areAllColumnsOfType(columns, AttributeType.BOOLEAN);
for (Column column : columns) {
if(column.getTypeClass() != Boolean.class){
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -101,7 +105,7 @@ public class BooleanLogicOperations implements AttributeColumnsMergeStrategy{
}
public Icon getIcon() {
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/script-binary.png",true);
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/script-binary.png", true);
}
public BooleanOperations[] getBooleanOperations() {
@@ -120,11 +124,11 @@ public class BooleanLogicOperations implements AttributeColumnsMergeStrategy{
this.newColumnTitle = newColumnTitle;
}
public AttributeColumn[] getColumns() {
public Column[] getColumns() {
return columns;
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
}
@@ -43,8 +43,8 @@ package org.gephi.datalab.plugin.manipulators.columns.merge;
import java.text.SimpleDateFormat;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.CreateTimeIntervalUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -60,9 +60,9 @@ import org.openide.util.NbBundle;
*/
public class CreateTimeInterval implements AttributeColumnsMergeStrategy {
private AttributeTable table;
private AttributeColumn[] columns;
private AttributeColumn startColumn, endColumn;
private Table table;
private Column[] columns;
private Column startColumn, endColumn;
private boolean parseNumbers=true;
//Number mode:
private double startNumber, endNumber;
@@ -70,7 +70,7 @@ public class CreateTimeInterval implements AttributeColumnsMergeStrategy {
private SimpleDateFormat dateFormat;
private String startDate, endDate;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
@@ -112,7 +112,7 @@ public class CreateTimeInterval implements AttributeColumnsMergeStrategy {
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/clock-select.png", true);
}
public AttributeColumn[] getColumns() {
public Column[] getColumns() {
return columns;
}
@@ -124,11 +124,11 @@ public class CreateTimeInterval implements AttributeColumnsMergeStrategy {
this.dateFormat = dateFormat;
}
public AttributeColumn getEndColumn() {
public Column getEndColumn() {
return endColumn;
}
public void setEndColumn(AttributeColumn endColumn) {
public void setEndColumn(Column endColumn) {
this.endColumn = endColumn;
}
@@ -156,11 +156,11 @@ public class CreateTimeInterval implements AttributeColumnsMergeStrategy {
this.parseNumbers = parseNumbers;
}
public AttributeColumn getStartColumn() {
public Column getStartColumn() {
return startColumn;
}
public void setStartColumn(AttributeColumn startColumn) {
public void setStartColumn(Column startColumn) {
this.startColumn = startColumn;
}
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -59,11 +59,11 @@ import org.openide.util.NbBundle;
*/
public class FirstQuartileNumber implements AttributeColumnsMergeStrategy, GeneralColumnTitleChooser {
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
@@ -81,7 +81,12 @@ public class FirstQuartileNumber implements AttributeColumnsMergeStrategy, Gener
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if(!AttributeUtils.isNumberType(column.getTypeClass())){
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -100,7 +105,7 @@ public class FirstQuartileNumber implements AttributeColumnsMergeStrategy, Gener
return null;
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -41,7 +41,7 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns.merge;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Table;
/**
* Interface that general merge strategies that only need to choose a title for the column to create
@@ -66,5 +66,5 @@ public interface GeneralColumnTitleChooser {
* Manipulators must provide the table to use in the UI to validate the column title with this method.
* @return Table for the new column
*/
AttributeTable getTable();
Table getTable();
}
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -59,11 +59,11 @@ import org.openide.util.NbBundle;
*/
public class InterQuartileRangeNumber implements AttributeColumnsMergeStrategy, GeneralColumnTitleChooser {
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
@@ -81,7 +81,12 @@ public class InterQuartileRangeNumber implements AttributeColumnsMergeStrategy,
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if (!AttributeUtils.isNumberType(column.getTypeClass())) {
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -100,7 +105,7 @@ public class InterQuartileRangeNumber implements AttributeColumnsMergeStrategy,
return null;
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -1,51 +1,51 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns.merge;
import java.math.BigDecimal;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -55,23 +55,25 @@ import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* AttributeColumnsMergeStrategy that joins one or more number column into a number list column with AttributeType <code>LIST_BIGDECIMAL</code>
* AttributeColumnsMergeStrategy that joins one or more number column into a number list column with AttributeType
* <code>LIST_BIGDECIMAL</code>
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class JoinNumberColumns implements AttributeColumnsMergeStrategy, GeneralColumnTitleChooser {
private static final String SEPARATOR = ",";
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
public void execute() {
Lookup.getDefault().lookup(AttributeColumnsMergeStrategiesController.class).joinWithSeparatorMerge(table, columns, AttributeType.LIST_BIGDECIMAL, columnTitle, SEPARATOR);
Lookup.getDefault().lookup(AttributeColumnsMergeStrategiesController.class).joinWithSeparatorMerge(table, columns, BigDecimal[].class, columnTitle, SEPARATOR);
}
public String getName() {
@@ -83,7 +85,12 @@ public class JoinNumberColumns implements AttributeColumnsMergeStrategy, General
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if (!AttributeUtils.isNumberType(column.getTypeClass())) {
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -102,7 +109,7 @@ public class JoinNumberColumns implements AttributeColumnsMergeStrategy, General
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/join.png", true);
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.JoinWithSeparatorUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -62,11 +62,11 @@ public class JoinWithSeparator implements AttributeColumnsMergeStrategy {
public static final String SEPARATOR_SAVED_PREFERENCES = "JoinWithSeparator_Separator";
private static final String DEFAULT_SEPARATOR = ",";
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String newColumnTitle, separator;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
separator=NbPreferences.forModule(JoinWithSeparator.class).get(SEPARATOR_SAVED_PREFERENCES, DEFAULT_SEPARATOR);
@@ -121,7 +121,7 @@ public class JoinWithSeparator implements AttributeColumnsMergeStrategy {
this.separator = separator;
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
}
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -60,11 +60,11 @@ import org.openide.util.NbBundle;
*/
public class MaximumNumber implements AttributeColumnsMergeStrategy, GeneralColumnTitleChooser {
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
@@ -82,7 +82,12 @@ public class MaximumNumber implements AttributeColumnsMergeStrategy, GeneralColu
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if(!AttributeUtils.isNumberType(column.getTypeClass())){
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -101,7 +106,7 @@ public class MaximumNumber implements AttributeColumnsMergeStrategy, GeneralColu
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/plus-white.png", true);
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -60,11 +60,11 @@ import org.openide.util.NbBundle;
*/
public class MedianNumber implements AttributeColumnsMergeStrategy, GeneralColumnTitleChooser {
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
@@ -82,7 +82,12 @@ public class MedianNumber implements AttributeColumnsMergeStrategy, GeneralColum
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if (!AttributeUtils.isNumberType(column.getTypeClass())) {
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -101,7 +106,7 @@ public class MedianNumber implements AttributeColumnsMergeStrategy, GeneralColum
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/ui-slider-050.png", true);
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -1,50 +1,50 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -54,17 +54,18 @@ import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* AttributeColumnsMergeStrategy for any combination of number or number list columns that
* calculates the minimum value of all the values and creates a new BigDecimal column with the result of each row.
* AttributeColumnsMergeStrategy for any combination of number or number list columns that calculates the minimum value of all the values and creates a new BigDecimal column with the result of each
* row.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class MinimumNumber implements AttributeColumnsMergeStrategy {
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
@@ -82,7 +83,12 @@ public class MinimumNumber implements AttributeColumnsMergeStrategy {
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if (!AttributeUtils.isNumberType(column.getTypeClass())) {
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -101,7 +107,7 @@ public class MinimumNumber implements AttributeColumnsMergeStrategy {
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/minus-white.png", true);
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -60,11 +60,11 @@ import org.openide.util.NbBundle;
*/
public class SumNumbers implements AttributeColumnsMergeStrategy, GeneralColumnTitleChooser {
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
@@ -82,7 +82,12 @@ public class SumNumbers implements AttributeColumnsMergeStrategy, GeneralColumnT
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if (!AttributeUtils.isNumberType(column.getTypeClass())) {
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -101,7 +106,7 @@ public class SumNumbers implements AttributeColumnsMergeStrategy, GeneralColumnT
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/plus-circle.png", true);
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -42,9 +42,9 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.columns.merge;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeUtils;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController;
import org.gephi.datalab.plugin.manipulators.columns.merge.ui.GeneralColumnTitleChooserUI;
import org.gephi.datalab.spi.ManipulatorUI;
@@ -59,11 +59,11 @@ import org.openide.util.NbBundle;
*/
public class ThirdQuartileNumber implements AttributeColumnsMergeStrategy {
private AttributeTable table;
private AttributeColumn[] columns;
private Table table;
private Column[] columns;
private String columnTitle;
public void setup(AttributeTable table, AttributeColumn[] columns) {
public void setup(Table table, Column[] columns) {
this.table = table;
this.columns = columns;
}
@@ -81,7 +81,12 @@ public class ThirdQuartileNumber implements AttributeColumnsMergeStrategy {
}
public boolean canExecute() {
return AttributeUtils.getDefault().areAllNumberOrNumberListColumns(columns);
for (Column column : columns) {
if (!AttributeUtils.isNumberType(column.getTypeClass())) {
return false;
}
}
return true;
}
public ManipulatorUI getUI() {
@@ -100,7 +105,7 @@ public class ThirdQuartileNumber implements AttributeColumnsMergeStrategy {
return null;
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -1,43 +1,43 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns.merge.ui;
@@ -46,8 +46,8 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsMergeStrategiesController.BooleanOperations;
import org.gephi.datalab.plugin.manipulators.columns.merge.BooleanLogicOperations;
import org.gephi.datalab.spi.DialogControls;
@@ -59,20 +59,22 @@ import org.netbeans.validation.api.ui.ValidationPanel;
/**
* UI for BooleanLogicOperations AttributeColumnsMergeStrategy
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class BooleanLogicOperationsUI extends javax.swing.JPanel implements ManipulatorUI {
private BooleanLogicOperations manipulator;
private JComboBox[] operationSelectors;
private AttributeTable table;
private Table table;
private DialogControls dialogControls;
/** Creates new form BooleanLogicOperationsUI */
/**
* Creates new form BooleanLogicOperationsUI
*/
public BooleanLogicOperationsUI() {
initComponents();
titleTextField.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
refreshOkButton();
}
@@ -85,24 +87,24 @@ public class BooleanLogicOperationsUI extends javax.swing.JPanel implements Mani
refreshOkButton();
}
private void refreshOkButton(){
String text=titleTextField.getText();
dialogControls.setOkButtonEnabled(text!=null&&!text.isEmpty()&&!table.hasColumn(text));//Title not empty and not repeated.
private void refreshOkButton() {
String text = titleTextField.getText();
dialogControls.setOkButtonEnabled(text != null && !text.isEmpty() && !table.hasColumn(text));//Title not empty and not repeated.
}
});
}
public void setup(Manipulator m, DialogControls dialogControls) {
manipulator = (BooleanLogicOperations) m;
this.dialogControls=dialogControls;
this.table=manipulator.getTable();
this.dialogControls = dialogControls;
this.table = manipulator.getTable();
prepareColumnsAndOperations();
}
public void unSetup() {
BooleanOperations[] booleanOperations=new BooleanOperations[operationSelectors.length];
BooleanOperations[] booleanOperations = new BooleanOperations[operationSelectors.length];
for (int i = 0; i < booleanOperations.length; i++) {
booleanOperations[i]=(BooleanOperations) operationSelectors[i].getSelectedItem();
booleanOperations[i] = (BooleanOperations) operationSelectors[i].getSelectedItem();
}
manipulator.setBooleanOperations(booleanOperations);
@@ -129,12 +131,12 @@ public class BooleanLogicOperationsUI extends javax.swing.JPanel implements Mani
}
private void prepareColumnsAndOperations() {
AttributeColumn[] columns = manipulator.getColumns();
Column[] columns = manipulator.getColumns();
operationSelectors = new JComboBox[columns.length - 1];
JLabel columnLabel;
for (int i = 0; i < columns.length; i++) {
columnLabel=new JLabel(columns[i].getTitle());
columnLabel = new JLabel(columns[i].getTitle());
columnLabel.setHorizontalAlignment(JLabel.CENTER);
panel.add(columnLabel);
if (i < columns.length - 1) {
@@ -149,10 +151,8 @@ public class BooleanLogicOperationsUI extends javax.swing.JPanel implements Mani
return selector;
}
/** 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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -20,7 +20,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="header" alignment="0" pref="664" max="32767" attributes="0"/>
<Component id="header" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@@ -48,7 +48,7 @@ import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.plugin.manipulators.columns.merge.CreateTimeInterval;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.Manipulator;
@@ -97,7 +97,7 @@ public class CreateTimeIntervalUI extends javax.swing.JPanel implements Manipula
dateFormatComboBox.setSelectedIndex(0);
}
private AttributeColumn getComboBoxColumn(JComboBox comboBox) {
private Column getComboBoxColumn(JComboBox comboBox) {
return ((ColumnWrapper) comboBox.getSelectedItem()).column;
}
@@ -140,7 +140,7 @@ public class CreateTimeIntervalUI extends javax.swing.JPanel implements Manipula
public void setup(Manipulator m, DialogControls dialogControls) {
this.manipulator = (CreateTimeInterval) m;
this.dialogControls = dialogControls;
AttributeColumn[] columns = manipulator.getColumns();
Column[] columns = manipulator.getColumns();
column1 = new ColumnWrapper(columns[0]);
if (columns.length == 2) {//2 columns were chosen to merge
column2 = new ColumnWrapper(columns[1]);
@@ -288,9 +288,9 @@ public class CreateTimeIntervalUI extends javax.swing.JPanel implements Manipula
private class ColumnWrapper {
private AttributeColumn column;
private Column column;
public ColumnWrapper(AttributeColumn column) {
public ColumnWrapper(Column column) {
this.column = column;
}
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -44,7 +44,7 @@ package org.gephi.datalab.plugin.manipulators.columns.merge.ui;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.plugin.manipulators.columns.merge.GeneralColumnTitleChooser;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.Manipulator;
@@ -62,7 +62,7 @@ public class GeneralColumnTitleChooserUI extends javax.swing.JPanel implements M
private GeneralColumnTitleChooser manipulator;
private DialogControls dialogControls;
private AttributeTable table;
private Table table;
private String displayName;
/** Creates new form GeneralColumnTitleChooserUI */
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -1,50 +1,50 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns.merge.ui;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.plugin.manipulators.columns.merge.JoinWithSeparator;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.Manipulator;
@@ -56,18 +56,21 @@ import org.openide.util.NbPreferences;
/**
* UI for JoinWithSeparator AttributeColumnsMergeStrategy
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class JoinWithSeparatorUI extends javax.swing.JPanel implements ManipulatorUI{
public class JoinWithSeparatorUI extends javax.swing.JPanel implements ManipulatorUI {
private JoinWithSeparator manipulator;
private DialogControls dialogControls;
private AttributeTable table;
private Table table;
/** Creates new form JoinWithSeparatorUI */
/**
* Creates new form JoinWithSeparatorUI
*/
public JoinWithSeparatorUI() {
initComponents();
titleTextField.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
refreshOkButton();
}
@@ -80,17 +83,17 @@ public class JoinWithSeparatorUI extends javax.swing.JPanel implements Manipulat
refreshOkButton();
}
private void refreshOkButton(){
String text=titleTextField.getText();
dialogControls.setOkButtonEnabled(text!=null&&!text.isEmpty()&&!table.hasColumn(text));//Title not empty and not repeated.
private void refreshOkButton() {
String text = titleTextField.getText();
dialogControls.setOkButtonEnabled(text != null && !text.isEmpty() && !table.hasColumn(text));//Title not empty and not repeated.
}
});
}
public void setup(Manipulator m, DialogControls dialogControls) {
this.manipulator=(JoinWithSeparator) m;
this.dialogControls=dialogControls;
this.table=manipulator.getTable();
this.manipulator = (JoinWithSeparator) m;
this.dialogControls = dialogControls;
this.table = manipulator.getTable();
separatorText.setText(manipulator.getSeparator());
}
@@ -119,10 +122,8 @@ public class JoinWithSeparatorUI extends javax.swing.JPanel implements Manipulat
return true;
}
/** 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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -170,8 +171,6 @@ public class JoinWithSeparatorUI extends javax.swing.JPanel implements Manipulat
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel separatorLabel;
private javax.swing.JTextField separatorText;
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -43,8 +43,8 @@ package org.gephi.datalab.plugin.manipulators.columns.ui;
import java.util.Map;
import javax.swing.JPanel;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.plugin.manipulators.columns.ColumnValuesFrequency;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -61,8 +61,8 @@ import org.openide.windows.WindowManager;
public class ColumnValuesFrequencyUI extends javax.swing.JPanel implements AttributeColumnsManipulatorUI {
private ColumnValuesFrequency manipulator;
private AttributeTable table;
private AttributeColumn column;
private Table table;
private Column column;
private Map<Object, Integer> valuesFrequencies;
private JFreeChart pieChart;
private JFreeChartDialog pieChartDialog;
@@ -73,7 +73,7 @@ public class ColumnValuesFrequencyUI extends javax.swing.JPanel implements Attri
initComponents();
}
public void setup(AttributeColumnsManipulator m, AttributeTable table, AttributeColumn column, DialogControls dialogControls) {
public void setup(AttributeColumnsManipulator m, Table table, Column column, DialogControls dialogControls) {
this.table = table;
this.column = column;
this.manipulator = (ColumnValuesFrequency) m;
@@ -26,14 +26,9 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="intervalStartText" pref="201" max="32767" attributes="0"/>
<Component id="intervalStartText" max="32767" attributes="0"/>
<Component id="intervalEndText" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="intervalStartOpenCheckbox" max="32767" attributes="0"/>
<Component id="intervalEndOpenCheckbox" max="32767" attributes="0"/>
</Group>
</Group>
<Component id="descriptionLabel" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
@@ -43,7 +38,7 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="titleLabel" min="-2" pref="30" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="titleTextField" max="32767" attributes="0"/>
<Component id="titleTextField" pref="245" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@@ -59,15 +54,13 @@
<Group type="103" groupAlignment="3" attributes="0">
<Component id="intervalStartLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="intervalStartText" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="intervalStartOpenCheckbox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="intervalEndLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="intervalEndText" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="intervalEndOpenCheckbox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="71" max="32767" attributes="0"/>
<EmptySpace pref="73" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="filler1" alignment="1" min="-2" pref="23" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@@ -156,21 +149,5 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="intervalStartOpenCheckbox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="org.openide.util.NbBundle.getMessage(ConvertColumnToDynamicUI.class, &quot;ConvertColumnToDynamicUI.intervalOpenCheckbox.text&quot;)" type="code"/>
</Property>
<Property name="horizontalTextPosition" type="int" value="10"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="intervalEndOpenCheckbox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="org.openide.util.NbBundle.getMessage(ConvertColumnToDynamicUI.class, &quot;ConvertColumnToDynamicUI.intervalOpenCheckbox.text&quot;)" type="code"/>
</Property>
<Property name="horizontalTextPosition" type="int" value="10"/>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -45,13 +45,13 @@ import java.text.ParseException;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.type.DynamicParser;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.plugin.manipulators.columns.ConvertColumnToDynamic;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulatorUI;
import org.gephi.dynamic.utils.DynamicUtilities;
import org.gephi.ui.utils.ColumnTitleValidator;
import org.gephi.ui.utils.IntervalBoundValidator;
import org.netbeans.validation.api.ui.ValidationGroup;
@@ -69,15 +69,13 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
private static final String INTERVAL_START_PREFERENCE = "ConvertColumnToDynamicUI.intervalStart";
private static final String INTERVAL_END_PREFERENCE = "ConvertColumnToDynamicUI.intervalEnd";
private static final String INTERVAL_START_OPEN_PREFERENCE = "ConvertColumnToDynamicUI.lopen";
private static final String INTERVAL_END_OPEN_PREFERENCE = "ConvertColumnToDynamicUI.ropen";
private static final String REPLACE_COLUMN_PREFERENCE = "ConvertColumnToDynamicUI.replaceColumn";
private static final String DEFAULT_INTERVAL_START = "0";
private static final String DEFAULT_INTERVAL_END = "1.0";
private ConvertColumnToDynamic manipulator;
private AttributeTable table;
private Table table;
private DialogControls dialogControls;
private ValidationPanel validationPanel;
@@ -89,8 +87,6 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
intervalStartText.setText(NbPreferences.forModule(ConvertColumnToDynamicUI.class).get(INTERVAL_START_PREFERENCE, DEFAULT_INTERVAL_START));
intervalEndText.setText(NbPreferences.forModule(ConvertColumnToDynamicUI.class).get(INTERVAL_END_PREFERENCE, DEFAULT_INTERVAL_END));
intervalStartOpenCheckbox.setSelected(NbPreferences.forModule(ConvertColumnToDynamicUI.class).getBoolean(INTERVAL_START_OPEN_PREFERENCE, false));
intervalEndOpenCheckbox.setSelected(NbPreferences.forModule(ConvertColumnToDynamicUI.class).getBoolean(INTERVAL_END_OPEN_PREFERENCE, false));
replaceColumnCheckbox.setSelected(NbPreferences.forModule(ConvertColumnToDynamicUI.class).getBoolean(REPLACE_COLUMN_PREFERENCE, false));
}
@@ -112,7 +108,7 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
});
}
public void setup(AttributeColumnsManipulator m, AttributeTable table, AttributeColumn column, DialogControls dialogControls) {
public void setup(AttributeColumnsManipulator m, Table table, Column column, DialogControls dialogControls) {
this.table = table;
this.dialogControls = dialogControls;
this.manipulator = (ConvertColumnToDynamic) m;
@@ -128,24 +124,18 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
public void unSetup() {
String intervalStart = intervalStartText.getText();
String intervalEnd = intervalEndText.getText();
boolean lopen = intervalStartOpenCheckbox.isSelected();
boolean ropen = intervalEndOpenCheckbox.isSelected();
boolean replaceColumn = replaceColumnCheckbox.isSelected();
NbPreferences.forModule(ConvertColumnToDynamicUI.class).put(INTERVAL_START_PREFERENCE, intervalStart);
NbPreferences.forModule(ConvertColumnToDynamicUI.class).put(INTERVAL_END_PREFERENCE, intervalEnd);
NbPreferences.forModule(ConvertColumnToDynamicUI.class).putBoolean(INTERVAL_START_OPEN_PREFERENCE, lopen);
NbPreferences.forModule(ConvertColumnToDynamicUI.class).putBoolean(INTERVAL_END_OPEN_PREFERENCE, ropen);
NbPreferences.forModule(ConvertColumnToDynamicUI.class).putBoolean(REPLACE_COLUMN_PREFERENCE, replaceColumn);
if (!validationPanel.isProblem()) {
manipulator.setTitle(titleTextField.getText());
try {
manipulator.setReplaceColumn(replaceColumn);
manipulator.setLow(DynamicParser.parseTime(intervalStart));
manipulator.setHigh(DynamicParser.parseTime(intervalEnd));
manipulator.setLopen(lopen);
manipulator.setRopen(ropen);
manipulator.setLow(DynamicUtilities.parseTime(intervalStart));
manipulator.setHigh(DynamicUtilities.parseTime(intervalEnd));
} catch (ParseException ex) {
Exceptions.printStackTrace(ex);
}
@@ -185,8 +175,6 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
intervalStartText = new javax.swing.JTextField();
intervalEndLabel = new javax.swing.JLabel();
intervalEndText = new javax.swing.JTextField();
intervalStartOpenCheckbox = new javax.swing.JCheckBox();
intervalEndOpenCheckbox = new javax.swing.JCheckBox();
titleLabel.setText(org.openide.util.NbBundle.getMessage(ConvertColumnToDynamicUI.class, "ConvertColumnToDynamicUI.titleLabel.text")); // NOI18N
@@ -212,12 +200,6 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
intervalEndText.setText(org.openide.util.NbBundle.getMessage(ConvertColumnToDynamicUI.class, "ConvertColumnToDynamicUI.intervalEndText.text")); // NOI18N
intervalStartOpenCheckbox.setText(org.openide.util.NbBundle.getMessage(ConvertColumnToDynamicUI.class, "ConvertColumnToDynamicUI.intervalOpenCheckbox.text"));
intervalStartOpenCheckbox.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
intervalEndOpenCheckbox.setText(org.openide.util.NbBundle.getMessage(ConvertColumnToDynamicUI.class, "ConvertColumnToDynamicUI.intervalOpenCheckbox.text"));
intervalEndOpenCheckbox.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -231,12 +213,8 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
.addComponent(intervalStartLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(intervalStartText, javax.swing.GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE)
.addComponent(intervalEndText))
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(intervalStartOpenCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(intervalEndOpenCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(intervalStartText)
.addComponent(intervalEndText)))
.addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(replaceColumnCheckbox)
@@ -245,7 +223,7 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(titleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(titleTextField)))
.addComponent(titleTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
@@ -256,14 +234,12 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(intervalStartLabel)
.addComponent(intervalStartText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(intervalStartOpenCheckbox))
.addComponent(intervalStartText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(intervalEndLabel)
.addComponent(intervalEndText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(intervalEndOpenCheckbox))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
.addComponent(intervalEndText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(filler1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@@ -281,10 +257,8 @@ public class ConvertColumnToDynamicUI extends javax.swing.JPanel implements Attr
private javax.swing.JLabel descriptionLabel;
private javax.swing.Box.Filler filler1;
private javax.swing.JLabel intervalEndLabel;
private javax.swing.JCheckBox intervalEndOpenCheckbox;
private javax.swing.JTextField intervalEndText;
private javax.swing.JLabel intervalStartLabel;
private javax.swing.JCheckBox intervalStartOpenCheckbox;
private javax.swing.JTextField intervalStartText;
private javax.swing.JCheckBox replaceColumnCheckbox;
private javax.swing.JLabel titleLabel;
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -1,53 +1,52 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns.ui;
import java.util.ArrayList;
import javax.swing.JPanel;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.plugin.manipulators.columns.CopyDataToOtherColumn;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulatorUI;
@@ -56,40 +55,44 @@ import org.openide.util.NbBundle;
/**
* UI for CopyDataToOtherColumn AttributeColumnsManipulator
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class CopyDataToOtherColumnUI extends javax.swing.JPanel implements AttributeColumnsManipulatorUI{
CopyDataToOtherColumn manipulator;
AttributeColumn[] columns;
public class CopyDataToOtherColumnUI extends javax.swing.JPanel implements AttributeColumnsManipulatorUI {
/** Creates new form CopyDataToOtherColumnUI */
CopyDataToOtherColumn manipulator;
Column[] columns;
/**
* Creates new form CopyDataToOtherColumnUI
*/
public CopyDataToOtherColumnUI() {
initComponents();
}
public void setup(AttributeColumnsManipulator m, AttributeTable table, AttributeColumn column, DialogControls dialogControls) {
this.manipulator=(CopyDataToOtherColumn) m;
public void setup(AttributeColumnsManipulator m, Table table, Column column, DialogControls dialogControls) {
this.manipulator = (CopyDataToOtherColumn) m;
sourceColumnLabel.setText(NbBundle.getMessage(CopyDataToOtherColumnUI.class, "CopyDataToOtherColumnUI.sourceColumnLabel.text",column.getTitle()));
sourceColumnLabel.setText(NbBundle.getMessage(CopyDataToOtherColumnUI.class, "CopyDataToOtherColumnUI.sourceColumnLabel.text", column.getTitle()));
AttributeColumnsController ac=Lookup.getDefault().lookup(AttributeColumnsController.class);
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
ArrayList<AttributeColumn> availableColumns=new ArrayList<AttributeColumn>();
ArrayList<Column> availableColumns = new ArrayList<Column>();
for(AttributeColumn c:table.getColumns()){
if(ac.canChangeColumnData(c)&&c!=column){
for (Column c : table) {
if (ac.canChangeColumnData(c) && c != column) {
availableColumns.add(c);
columnsComboBox.addItem(c.getTitle());
}
}
columns=availableColumns.toArray(new AttributeColumn[0]);
columns = availableColumns.toArray(new Column[0]);
}
public void unSetup() {
if(columnsComboBox.getSelectedIndex()!=-1){
if (columnsComboBox.getSelectedIndex() != -1) {
manipulator.setTargetColumn(columns[columnsComboBox.getSelectedIndex()]);
}else{
} else {
manipulator.setTargetColumn(null);
}
}
@@ -106,10 +109,8 @@ public class CopyDataToOtherColumnUI extends javax.swing.JPanel implements Attri
return true;
}
/** 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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -154,5 +155,4 @@ public class CopyDataToOtherColumnUI extends javax.swing.JPanel implements Attri
private javax.swing.JLabel descriptionLabel;
private javax.swing.JLabel sourceColumnLabel;
// End of variables declaration//GEN-END:variables
}
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -1,56 +1,57 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.columns.ui;
import java.util.List;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.plugin.manipulators.columns.DuplicateColumn;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulatorUI;
import org.gephi.datalab.utils.SupportedColumnTypeWrapper;
import org.gephi.ui.utils.ColumnTitleValidator;
import org.netbeans.validation.api.ui.ValidationGroup;
import org.netbeans.validation.api.ui.ValidationPanel;
@@ -58,15 +59,18 @@ import org.openide.util.NbBundle;
/**
* UI for DuplicateColumn AttributeColumnsManipulator.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class DuplicateColumnUI extends javax.swing.JPanel implements AttributeColumnsManipulatorUI {
private DuplicateColumn manipulator;
private AttributeTable table;
private Table table;
private DialogControls dialogControls;
/** Creates new form DuplicateColumnUI */
/**
* Creates new form DuplicateColumnUI
*/
public DuplicateColumnUI() {
initComponents();
titleTextField.getDocument().addDocumentListener(new DocumentListener() {
@@ -83,29 +87,32 @@ public class DuplicateColumnUI extends javax.swing.JPanel implements AttributeCo
refreshOkButton();
}
private void refreshOkButton(){
String text=titleTextField.getText();
dialogControls.setOkButtonEnabled(text!=null&&!text.isEmpty()&&!table.hasColumn(text));//Title not empty and not repeated.
private void refreshOkButton() {
String text = titleTextField.getText();
dialogControls.setOkButtonEnabled(text != null && !text.isEmpty() && !table.hasColumn(text));//Title not empty and not repeated.
}
});
}
public void setup(AttributeColumnsManipulator m, AttributeTable table, AttributeColumn column, DialogControls dialogControls) {
this.table=table;
this.dialogControls=dialogControls;
public void setup(AttributeColumnsManipulator m, Table table, Column column, DialogControls dialogControls) {
this.table = table;
this.dialogControls = dialogControls;
this.manipulator = (DuplicateColumn) m;
descriptionLabel.setText(NbBundle.getMessage(DuplicateColumnUI.class, "DuplicateColumnUI.descriptionLabel.text", column.getTitle()));
titleTextField.setText(NbBundle.getMessage(DuplicateColumnUI.class, "DuplicateColumnUI.new.title", column.getTitle()));
for (AttributeType type : AttributeType.values()) {
typeComboBox.addItem(type);
List<SupportedColumnTypeWrapper> supportedTypesWrappers = SupportedColumnTypeWrapper.buildOrderedSupportedTypesList();
for (SupportedColumnTypeWrapper supportedColumnTypeWrapper : supportedTypesWrappers) {
typeComboBox.addItem(supportedColumnTypeWrapper);
}
typeComboBox.setSelectedItem(column.getType());
typeComboBox.setSelectedItem(new SupportedColumnTypeWrapper(column.getTypeClass()));
}
public void unSetup() {
manipulator.setColumnType((AttributeType) typeComboBox.getSelectedItem());
manipulator.setColumnType(((SupportedColumnTypeWrapper) typeComboBox.getSelectedItem()).getType());
manipulator.setTitle(titleTextField.getText());
}
@@ -128,10 +135,8 @@ public class DuplicateColumnUI extends javax.swing.JPanel implements AttributeCo
return true;
}
/** 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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -47,8 +47,8 @@ import java.util.regex.PatternSyntaxException;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.plugin.manipulators.columns.GeneralCreateColumnFromRegex;
import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
@@ -65,7 +65,7 @@ import org.openide.util.NbBundle;
public class GeneralCreateColumnFromRegexUI extends javax.swing.JPanel implements AttributeColumnsManipulatorUI {
private DialogControls dialogControls;
private AttributeTable table;
private Table table;
public enum Mode {
@@ -110,7 +110,7 @@ public class GeneralCreateColumnFromRegexUI extends javax.swing.JPanel implement
});
}
public void setup(AttributeColumnsManipulator m, AttributeTable table, AttributeColumn column, DialogControls dialogControls) {
public void setup(AttributeColumnsManipulator m, Table table, Column column, DialogControls dialogControls) {
this.manipulator = (GeneralCreateColumnFromRegex) m;
this.table = table;
this.dialogControls = dialogControls;
@@ -43,14 +43,14 @@ package org.gephi.datalab.plugin.manipulators.edges;
import java.util.ArrayList;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.plugin.manipulators.GeneralColumnsChooser;
import org.gephi.datalab.plugin.manipulators.ui.GeneralChooseColumnsUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.GraphController;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
@@ -62,18 +62,18 @@ import org.openide.util.NbBundle;
public class ClearEdgesData extends BasicEdgesManipulator implements GeneralColumnsChooser {
private Edge[] edges;
private AttributeColumn[] columnsToClearData;
private Column[] columnsToClearData;
public void setup(Edge[] edges, Edge clickedEdge) {
this.edges = edges;
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
ArrayList<AttributeColumn> columnsToClearDataList = new ArrayList<AttributeColumn>();
for (AttributeColumn column : Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable().getColumns()) {
ArrayList<Column> columnsToClearDataList = new ArrayList<Column>();
for (Column column : Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable()) {
if (ac.canClearColumnData(column)) {
columnsToClearDataList.add(column);
}
}
columnsToClearData = columnsToClearDataList.toArray(new AttributeColumn[0]);
columnsToClearData = columnsToClearDataList.toArray(new Column[0]);
}
public void execute() {
@@ -116,11 +116,11 @@ public class ClearEdgesData extends BasicEdgesManipulator implements GeneralColu
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/clear-data.png", true);
}
public AttributeColumn[] getColumns() {
public Column[] getColumns() {
return columnsToClearData;
}
public void setColumns(AttributeColumn[] columnsToClearData) {
public void setColumns(Column[] columnsToClearData) {
this.columnsToClearData = columnsToClearData;
}
}
@@ -1,81 +1,83 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.edges;
import java.util.ArrayList;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.plugin.manipulators.GeneralColumnsAndRowChooser;
import org.gephi.datalab.plugin.manipulators.ui.GeneralChooseColumnsAndRowUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Element;
import org.gephi.graph.api.GraphController;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* Edges manipulator that copies the given columns data of one edge to the other selected edges.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class CopyEdgeDataToOtherEdges extends BasicEdgesManipulator implements GeneralColumnsAndRowChooser {
private Edge clickedEdge;
private Edge[] edges;
private AttributeColumn[] columnsToCopyData;
private Column[] columnsToCopyData;
public void setup(Edge[] edges, Edge clickedEdge) {
this.clickedEdge = clickedEdge;
this.edges = edges;
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
ArrayList<AttributeColumn> columnsToCopyDataList = new ArrayList<AttributeColumn>();
for (AttributeColumn column : Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable().getColumns()) {
ArrayList<Column> columnsToCopyDataList = new ArrayList<Column>();
for (Column column : Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable()) {
if (ac.canChangeColumnData(column)) {
columnsToCopyDataList.add(column);
}
}
columnsToCopyData = columnsToCopyDataList.toArray(new AttributeColumn[0]);
columnsToCopyData = columnsToCopyDataList.toArray(new Column[0]);
}
public void execute() {
@@ -95,11 +97,11 @@ public class CopyEdgeDataToOtherEdges extends BasicEdgesManipulator implements G
}
public boolean canExecute() {
return edges.length>1;//At least 2 edges to copy data from one to the other.
return edges.length > 1;//At least 2 edges to copy data from one to the other.
}
public ManipulatorUI getUI() {
return new GeneralChooseColumnsAndRowUI(NbBundle.getMessage(CopyEdgeDataToOtherEdges.class, "CopyEdgeDataToOtherEdges.ui.rowDescription"),NbBundle.getMessage(CopyEdgeDataToOtherEdges.class, "CopyEdgeDataToOtherEdges.ui.columnsDescription"));
return new GeneralChooseColumnsAndRowUI(NbBundle.getMessage(CopyEdgeDataToOtherEdges.class, "CopyEdgeDataToOtherEdges.ui.rowDescription"), NbBundle.getMessage(CopyEdgeDataToOtherEdges.class, "CopyEdgeDataToOtherEdges.ui.columnsDescription"));
}
public int getType() {
@@ -114,23 +116,23 @@ public class CopyEdgeDataToOtherEdges extends BasicEdgesManipulator implements G
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/broom--arrow.png", true);
}
public AttributeColumn[] getColumns() {
public Column[] getColumns() {
return columnsToCopyData;
}
public void setColumns(AttributeColumn[] columnsToClearData) {
public void setColumns(Column[] columnsToClearData) {
this.columnsToCopyData = columnsToClearData;
}
public Object[] getRows() {
public Element[] getRows() {
return edges;
}
public Object getRow() {
public Element getRow() {
return clickedEdge;
}
public void setRow(Object row) {
clickedEdge=(Edge) row;
public void setRow(Element row) {
clickedEdge = (Edge) row;
}
}
@@ -85,7 +85,7 @@ public class AddEdgeToGraph implements GeneralActionsManipulator {
}
public ManipulatorUI getUI() {
GraphModel currentGraphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
GraphModel currentGraphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
if (graphModel != currentGraphModel) {//If graph model has changed since last execution, change default mode for edges to create in UI, else keep this parameter across calls
directed = currentGraphModel.isDirected() || currentGraphModel.isMixed();//Get graph directed state. Set to true if graph is directed or mixed
graphModel = currentGraphModel;
@@ -43,8 +43,8 @@ package org.gephi.datalab.plugin.manipulators.general;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.datalab.spi.general.GeneralActionsManipulator;
import org.gephi.graph.api.Node;
@@ -41,13 +41,16 @@ Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.general;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Icon;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.plugin.manipulators.general.ui.ClearEdgesUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.datalab.spi.general.PluginGeneralActionsManipulator;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.MixedGraph;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
@@ -72,13 +75,20 @@ public class ClearEdges implements PluginGeneralActionsManipulator {
public void execute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
MixedGraph graph = Lookup.getDefault().lookup(GraphController.class).getModel().getMixedGraph();
if (deleteDirected) {
gec.deleteEdges(graph.getDirectedEdges().toArray());
}
if (deleteUndirected) {
gec.deleteEdges(graph.getUndirectedEdges().toArray());
Graph graph = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph();
List<Edge> edges = new ArrayList<Edge>();
for (Edge edge : graph.getEdges().toArray()) {
if (edge.isDirected()) {
if(deleteDirected){
edges.add(edge);
}
}else if (deleteUndirected) {
edges.add(edge);
}
}
gec.deleteEdges(edges.toArray(new Edge[0]));
}
public String getName() {
@@ -1,43 +1,43 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.general;
@@ -54,14 +54,15 @@ import org.openide.util.lookup.ServiceProvider;
/**
* PluginGeneralActionsManipulator that clears the entire graph, asking for confirmation.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service=PluginGeneralActionsManipulator.class)
@ServiceProvider(service = PluginGeneralActionsManipulator.class)
public class ClearGraph implements PluginGeneralActionsManipulator {
public void execute() {
if (JOptionPane.showConfirmDialog(null, NbBundle.getMessage(ClearGraph.class, "ClearGraph.dialog.text"), NbBundle.getMessage(ClearGraph.class, "ClearGraph.name"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
Lookup.getDefault().lookup(GraphController.class).getModel().getGraph().clear();
Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph().clear();
}
}
@@ -74,7 +75,7 @@ public class ClearGraph implements PluginGeneralActionsManipulator {
}
public boolean canExecute() {
return Lookup.getDefault().lookup(GraphElementsController.class).getNodesCount()>0;
return Lookup.getDefault().lookup(GraphElementsController.class).getNodesCount() > 0;
}
public ManipulatorUI getUI() {
@@ -43,13 +43,14 @@ package org.gephi.datalab.plugin.manipulators.general;
import java.util.List;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.plugin.manipulators.general.ui.MergeNodeDuplicatesUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.datalab.spi.general.PluginGeneralActionsManipulator;
import org.gephi.datalab.spi.rows.merge.AttributeRowsMergeStrategy;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
@@ -72,7 +73,7 @@ public class MergeNodeDuplicates implements PluginGeneralActionsManipulator {
private List<List<Node>> duplicateGroups;
private boolean deleteMergedNodes;
private boolean caseSensitive;
private AttributeColumn[] columns;
private Column[] columns;
private AttributeRowsMergeStrategy[] mergeStrategies;
public void execute() {
@@ -97,7 +98,13 @@ public class MergeNodeDuplicates implements PluginGeneralActionsManipulator {
}
public ManipulatorUI getUI() {
columns = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable().getColumns();
Table nodeTable = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable();
int cols = nodeTable.countColumns();
columns = new Column[cols];
for (int i = 0; i < cols; i++) {
columns[i] = nodeTable.getColumn(i);
}
mergeStrategies = new AttributeRowsMergeStrategy[columns.length];
deleteMergedNodes = NbPreferences.forModule(MergeNodeDuplicates.class).getBoolean(DELETE_MERGED_NODES_SAVED_PREFERENCES, true);
caseSensitive = NbPreferences.forModule(MergeNodeDuplicates.class).getBoolean(CASE_SENSITIVE_SAVED_PREFERENCES, true);
@@ -116,11 +123,11 @@ public class MergeNodeDuplicates implements PluginGeneralActionsManipulator {
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/merge.png", true);
}
public AttributeColumn[] getColumns() {
public Column[] getColumns() {
return columns;
}
public void setColumns(AttributeColumn[] columns) {
public void setColumns(Column[] columns) {
this.columns = columns;
}
@@ -42,13 +42,13 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.general;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.plugin.manipulators.general.ui.SearchReplaceUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.datalab.spi.general.GeneralActionsManipulator;
import org.gephi.graph.api.GraphController;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.util.ImageUtilities;
@@ -90,7 +90,7 @@ public class SearchReplace implements GeneralActionsManipulator {
}
public boolean canExecute() {
AttributeTable currentTable = getCurrentTable();
Table currentTable = getCurrentTable();
return currentTable != null && Lookup.getDefault().lookup(AttributeColumnsController.class).getTableRowsCount(currentTable) > 0;//Make sure that there is at least 1 row
}
@@ -110,15 +110,15 @@ public class SearchReplace implements GeneralActionsManipulator {
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/binocular--pencil.png", true);
}
private AttributeTable getCurrentTable() {
private Table getCurrentTable() {
DataTablesController dtc = Lookup.getDefault().lookup(DataTablesController.class);
if (dtc.getDataTablesEventListener() == null) {
return null;
}
if (dtc.isNodeTableMode()) {
return Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
return Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable();
} else {
return Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
return Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable();
}
}
}
@@ -81,11 +81,11 @@ public class AddEdgeToGraphUI extends javax.swing.JPanel implements ManipulatorU
undirectedRadioButton.setSelected(true);
}
graph = Lookup.getDefault().lookup(GraphController.class).getModel().getMixedGraph();
graph = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph();
nodes = graph.getNodes().toArray();
for (Node n : nodes) {
sourceNodesComboBox.addItem(n.getId() + " - " + n.getNodeData().getLabel());
sourceNodesComboBox.addItem(n.getId() + " - " + n.getLabel());
}
Node selectedSource = manipulator.getSource();
@@ -149,7 +149,7 @@ public class AddEdgeToGraphUI extends javax.swing.JPanel implements ManipulatorU
dialogControls.setOkButtonEnabled(!availableTargetNodes.isEmpty());
targetNodesComboBox.removeAllItems();
for (Node n : targetNodes) {
targetNodesComboBox.addItem(n.getId() + " - " + n.getNodeData().getLabel());
targetNodesComboBox.addItem(n.getId() + " - " + n.getLabel());
}
}
}
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -47,15 +47,17 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.attribute.api.AttributeUtils;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.plugin.manipulators.general.ui.ImportCSVUIWizardAction.Mode;
import org.gephi.datalab.utils.SupportedColumnTypeWrapper;
import org.gephi.graph.api.GraphController;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
@@ -69,9 +71,9 @@ public final class ImportCSVUIVisualPanel2 extends JPanel {
private Character separator;
private File file;
private ImportCSVUIWizardAction.Mode mode;
private ArrayList<JCheckBox> columnsCheckBoxes=new ArrayList<JCheckBox>();
private ArrayList<JComboBox> columnsComboBoxes=new ArrayList<JComboBox>();
private AttributeTable table;
private ArrayList<JCheckBox> columnsCheckBoxes = new ArrayList<JCheckBox>();
private ArrayList<JComboBox> columnsComboBoxes = new ArrayList<JComboBox>();
private Table table;
private Charset charset;
//Nodes table settings:
private JCheckBox assignNewNodeIds;
@@ -102,12 +104,12 @@ public final class ImportCSVUIVisualPanel2 extends JPanel {
loadDescription(settingsPanel);
switch (mode) {
case NODES_TABLE:
table = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
table = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable();
loadColumns(settingsPanel);
loadNodesTableSettings(settingsPanel);
break;
case EDGES_TABLE:
table = Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
table = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable();
loadColumns(settingsPanel);
loadEdgesTableSettings(settingsPanel);
break;
@@ -149,8 +151,8 @@ public final class ImportCSVUIVisualPanel2 extends JPanel {
if (columns[i].isEmpty()) {
continue;//Remove empty column headers:
}
JCheckBox columnCheckBox= new JCheckBox(columns[i], true);
JCheckBox columnCheckBox = new JCheckBox(columns[i], true);
columnsCheckBoxes.add(columnCheckBox);
settingsPanel.add(columnCheckBox, "wrap");
JComboBox columnComboBox = new JComboBox();
@@ -183,15 +185,18 @@ public final class ImportCSVUIVisualPanel2 extends JPanel {
private void fillComboBoxWithColumnTypes(String column, JComboBox comboBox) {
comboBox.removeAllItems();
for (AttributeType type : AttributeType.values()) {
comboBox.addItem(type);
List<SupportedColumnTypeWrapper> supportedTypesWrappers = SupportedColumnTypeWrapper.buildOrderedSupportedTypesList();
for (SupportedColumnTypeWrapper supportedColumnTypeWrapper : supportedTypesWrappers) {
comboBox.addItem(supportedColumnTypeWrapper);
}
if (table.hasColumn(column)) {
//Set type of the already existing column in the table and disable the edition:
comboBox.setSelectedItem(table.getColumn(column).getType());
comboBox.setSelectedItem(new SupportedColumnTypeWrapper(table.getColumn(column).getTypeClass()));
comboBox.setEnabled(false);
} else {
comboBox.setSelectedItem(AttributeType.STRING);//Set STRING by default
comboBox.setSelectedItem(new SupportedColumnTypeWrapper(String.class));//Set STRING by default
}
}
@@ -223,14 +228,14 @@ public final class ImportCSVUIVisualPanel2 extends JPanel {
return columns.toArray(new String[0]);
}
public AttributeType[] getColumnsToImportTypes() {
ArrayList<AttributeType> types = new ArrayList<AttributeType>();
public Class[] getColumnsToImportTypes() {
ArrayList<Class> types = new ArrayList<Class>();
for (int i = 0; i < columnsCheckBoxes.size(); i++) {
if (columnsCheckBoxes.get(i).isSelected()) {
types.add((AttributeType) columnsComboBoxes.get(i).getSelectedItem());
types.add((Class) columnsComboBoxes.get(i).getSelectedItem());
}
}
return types.toArray(new AttributeType[0]);
return types.toArray(new Class[0]);
}
public boolean getAssignNewNodeIds() {
@@ -47,7 +47,6 @@ import java.io.File;
import java.nio.charset.Charset;
import java.text.MessageFormat;
import javax.swing.JComponent;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.openide.DialogDisplayer;
@@ -90,7 +89,7 @@ public final class ImportCSVUIWizardAction extends CallableSystemAction {
Character separator = (Character) wizardDescriptor.getProperty("separator");
Charset charset = (Charset) wizardDescriptor.getProperty("charset");
String[] columnNames = (String[]) wizardDescriptor.getProperty("columns-names");
AttributeType[] columnTypes = (AttributeType[]) wizardDescriptor.getProperty("columns-types");
Class[] columnTypes = (Class[]) wizardDescriptor.getProperty("columns-types");
//Nodes import parameters:
Boolean assignNewNodeIds = (Boolean) wizardDescriptor.getProperty("assign-new-node-ids");
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@@ -47,6 +47,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.jar.Attributes;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
@@ -54,7 +55,7 @@ import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.DataLaboratoryHelper;
import org.gephi.datalab.plugin.manipulators.general.MergeNodeDuplicates;
@@ -62,7 +63,7 @@ import org.gephi.datalab.spi.DialogControls;
import org.gephi.datalab.spi.Manipulator;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.datalab.spi.rows.merge.AttributeRowsMergeStrategy;
import org.gephi.graph.api.Attributes;
import org.gephi.graph.api.Element;
import org.gephi.graph.api.Node;
import org.gephi.ui.components.richtooltip.RichTooltip;
import org.openide.util.ImageUtilities;
@@ -79,12 +80,12 @@ public final class MergeNodeDuplicatesUI extends JPanel implements ManipulatorUI
private static final ImageIcon INFO_LABELS_ICON = ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/information.png", true);
private MergeNodeDuplicates manipulator;
private DialogControls dialogControls;
private AttributeColumn[] columns;
private Column[] columns;
private List<List<Node>> duplicateGroups;
private JCheckBox deleteMergedNodesCheckBox;
private JCheckBox caseSensitiveCheckBox;
private JComboBox baseColumnComboBox;
private Attributes[] rows;
private Element[] rows;
private StrategyComboBox[] strategiesComboBoxes;
private StrategyConfigurationButton[] strategiesConfigurationButtons;
@@ -155,9 +156,9 @@ public final class MergeNodeDuplicatesUI extends JPanel implements ManipulatorUI
List<Node> nodes = duplicateGroups.get(0);//Use first group of duplicated nodes to set strategies for all of them
//Prepare node rows:
rows = new Attributes[nodes.size()];
rows = new Element[nodes.size()];
for (int i = 0; i < nodes.size(); i++) {
rows[i] = nodes.get(0).getAttributes();
rows[i] = nodes.get(i);
}
strategiesConfigurationButtons = new StrategyConfigurationButton[columns.length];
@@ -191,7 +192,7 @@ public final class MergeNodeDuplicatesUI extends JPanel implements ManipulatorUI
scrollStrategies.setViewportView(strategiesPanel);
}
private List<AttributeRowsMergeStrategy> getColumnAvailableStrategies(AttributeColumn column) {
private List<AttributeRowsMergeStrategy> getColumnAvailableStrategies(Column column) {
ArrayList<AttributeRowsMergeStrategy> availableStrategies = new ArrayList<AttributeRowsMergeStrategy>();
for (AttributeRowsMergeStrategy strategy : DataLaboratoryHelper.getDefault().getAttributeRowsMergeStrategies()) {
strategy.setup(rows, rows[0], column);
@@ -210,7 +211,7 @@ public final class MergeNodeDuplicatesUI extends JPanel implements ManipulatorUI
private void loadBaseColumn(JPanel settingsPanel) {
baseColumnComboBox = new JComboBox();
for (AttributeColumn column : columns) {
for (Column column : columns) {
baseColumnComboBox.addItem(column.getTitle());
}
settingsPanel.add(new JLabel(getMessage("MergeNodeDuplicatesUI.baseColumnText")), "split 2");
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -20,8 +20,9 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSeparator1" alignment="0" pref="379" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
@@ -58,15 +59,12 @@
</Group>
<Component id="scroll" alignment="0" pref="359" max="32767" attributes="0"/>
<Component id="resultLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="columnsToSearchLabel" min="-2" pref="164" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="columnsToSearchComboBox" pref="185" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jSeparator1" alignment="0" pref="379" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="columnsToSearchLabel" min="-2" pref="164" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="columnsToSearchComboBox" pref="185" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -47,13 +47,12 @@ import java.util.regex.PatternSyntaxException;
import javax.swing.JOptionPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.attribute.api.Column;
import org.gephi.attribute.api.Table;
import org.gephi.datalab.api.SearchReplaceController;
import org.gephi.datalab.api.SearchReplaceController.SearchOptions;
import org.gephi.datalab.api.SearchReplaceController.SearchResult;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.Node;
@@ -135,32 +134,32 @@ public final class SearchReplaceUI extends javax.swing.JPanel {
boolean onlyVisibleElements = Lookup.getDefault().lookup(DataTablesController.class).isShowOnlyVisible();
searchResult = null;
columnsToSearchComboBox.removeAllItems();
AttributeTable table;
Table table;
if (mode == Mode.NODES_TABLE) {
Node[] nodes;
if (onlyVisibleElements) {
//Search on visible nodes:
nodes = Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraphVisible().getNodesTree().toArray();
nodes = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraphVisible().getNodes().toArray();
} else {
nodes = new Node[0];//Search on all nodes
}
searchOptions = new SearchOptions(nodes, null);
table = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
table = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable();
} else {
Edge[] edges;
if (onlyVisibleElements) {
//Search on visible edges:
edges = Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraphVisible().getEdges().toArray();
edges = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraphVisible().getEdges().toArray();
} else {
edges = new Edge[0];//Search on all edges
}
searchOptions = new SearchOptions(edges, null);
table = Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
table = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable();
}
//Fill possible columns to search (first value is all columns):
columnsToSearchComboBox.addItem(NbBundle.getMessage(SearchReplaceUI.class, "SearchReplaceUI.allColumns"));
for (AttributeColumn c : table.getColumns()) {
for (Column c : table) {
columnsToSearchComboBox.addItem(new ColumnWrapper(c));
}
}
@@ -217,21 +216,24 @@ public final class SearchReplaceUI extends javax.swing.JPanel {
if (!dataTablesController.isNodeTableMode()) {
dataTablesController.selectNodesTable();
}
value = node.getNodeData().getAttributes().getValue(searchResult.getFoundColumnIndex());
Table table = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable();
value = node.getAttribute(table.getColumn(searchResult.getFoundColumnIndex()));
} else {
Edge edge = searchResult.getFoundEdge();
dataTablesController.setEdgeTableSelection(new Edge[]{edge});
if (!dataTablesController.isEdgeTableMode()) {
dataTablesController.selectEdgesTable();
}
value = edge.getEdgeData().getAttributes().getValue(searchResult.getFoundColumnIndex());
Table table = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable();
value = edge.getAttribute(table.getColumn(searchResult.getFoundColumnIndex()));
}
String columnName;
if (mode == Mode.NODES_TABLE) {
columnName = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable().getColumn(searchResult.getFoundColumnIndex()).getTitle();
columnName = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable().getColumn(searchResult.getFoundColumnIndex()).getTitle();
} else {
columnName = Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable().getColumn(searchResult.getFoundColumnIndex()).getTitle();
columnName = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getEdgeTable().getColumn(searchResult.getFoundColumnIndex()).getTitle();
}
StringBuilder sb = new StringBuilder();
@@ -270,9 +272,9 @@ public final class SearchReplaceUI extends javax.swing.JPanel {
class ColumnWrapper {
AttributeColumn column;
Column column;
public ColumnWrapper(AttributeColumn column) {
public ColumnWrapper(Column column) {
this.column = column;
}
@@ -43,13 +43,13 @@ package org.gephi.datalab.plugin.manipulators.nodes;
import java.util.ArrayList;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.plugin.manipulators.GeneralColumnsChooser;
import org.gephi.datalab.plugin.manipulators.ui.GeneralChooseColumnsUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
@@ -62,18 +62,18 @@ import org.openide.util.NbBundle;
public class ClearNodesData extends BasicNodesManipulator implements GeneralColumnsChooser {
private Node[] nodes;
private AttributeColumn[] columnsToClearData;
private Column[] columnsToClearData;
public void setup(Node[] nodes, Node clickedNode) {
this.nodes = nodes;
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
ArrayList<AttributeColumn> columnsToClearDataList = new ArrayList<AttributeColumn>();
for (AttributeColumn column : Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable().getColumns()) {
ArrayList<Column> columnsToClearDataList = new ArrayList<Column>();
for (Column column : Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable()) {
if (ac.canClearColumnData(column)) {
columnsToClearDataList.add(column);
}
}
columnsToClearData = columnsToClearDataList.toArray(new AttributeColumn[0]);
columnsToClearData = columnsToClearDataList.toArray(new Column[0]);
}
public void execute() {
@@ -116,11 +116,11 @@ public class ClearNodesData extends BasicNodesManipulator implements GeneralCol
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/clear-data.png", true);
}
public AttributeColumn[] getColumns() {
public Column[] getColumns() {
return columnsToClearData;
}
public void setColumns(AttributeColumn[] columnsToClearData) {
public void setColumns(Column[] columnsToClearData) {
this.columnsToClearData = columnsToClearData;
}
}
@@ -43,13 +43,14 @@ package org.gephi.datalab.plugin.manipulators.nodes;
import java.util.ArrayList;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.api.AttributeColumnsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.plugin.manipulators.GeneralColumnsAndRowChooser;
import org.gephi.datalab.plugin.manipulators.ui.GeneralChooseColumnsAndRowUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Element;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
@@ -63,19 +64,19 @@ public class CopyNodeDataToOtherNodes extends BasicNodesManipulator implements G
private Node clickedNode;
private Node[] nodes;
private AttributeColumn[] columnsToCopyData;
private Column[] columnsToCopyData;
public void setup(Node[] nodes, Node clickedNode) {
this.clickedNode = clickedNode;
this.nodes = nodes;
AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
ArrayList<AttributeColumn> columnsToCopyDataList = new ArrayList<AttributeColumn>();
for (AttributeColumn column : Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable().getColumns()) {
ArrayList<Column> columnsToCopyDataList = new ArrayList<Column>();
for (Column column : Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable()) {
if (ac.canChangeColumnData(column)) {
columnsToCopyDataList.add(column);
}
}
columnsToCopyData = columnsToCopyDataList.toArray(new AttributeColumn[0]);
columnsToCopyData = columnsToCopyDataList.toArray(new Column[0]);
}
public void execute() {
@@ -114,23 +115,23 @@ public class CopyNodeDataToOtherNodes extends BasicNodesManipulator implements G
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/broom--arrow.png", true);
}
public AttributeColumn[] getColumns() {
public Column[] getColumns() {
return columnsToCopyData;
}
public void setColumns(AttributeColumn[] columnsToClearData) {
public void setColumns(Column[] columnsToClearData) {
this.columnsToCopyData = columnsToClearData;
}
public Object[] getRows() {
public Element[] getRows() {
return nodes;
}
public Object getRow() {
public Element getRow() {
return clickedNode;
}
public void setRow(Object row) {
public void setRow(Element row) {
clickedNode=(Node) row;
}
}
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
@@ -1,96 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* Nodes manipulator that groups one or more nodes into a new group node hierarchically.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class Group extends BasicNodesManipulator {
private Node[] nodes;
public void setup(Node[] nodes, Node clickedNode) {
this.nodes=nodes;
}
public void execute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
gec.groupNodes(nodes);
}
public String getName() {
return NbBundle.getMessage(Group.class, "Group.name");
}
public String getDescription() {
return "";
}
public boolean canExecute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
return gec.canGroupNodes(nodes);
}
public ManipulatorUI getUI() {
return null;
}
public int getType() {
return 300;
}
public int getPosition() {
return 0;
}
public Icon getIcon() {
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/group.png", true);
}
}
@@ -1,58 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import org.gephi.datalab.spi.nodes.NodesManipulator;
import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
import org.openide.util.lookup.ServiceProvider;
/**
* Builder for Group nodes manipulator.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service=NodesManipulatorBuilder.class)
public class GroupBuilder implements NodesManipulatorBuilder{
public NodesManipulator getNodesManipulator() {
return new Group();
}
}
@@ -71,7 +71,7 @@ public class LinkNodes extends BasicNodesManipulator {
this.nodes = nodes;
this.sourceNode = clickedNode;//Choose clicked node as source by default (but the user can select it or other one in the UI)
GraphModel currentGraphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
GraphModel currentGraphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
if (graphModel != currentGraphModel) {//If graph model has changed since last execution, change default mode for edges to create in UI, else keep this parameter across calls
directed = currentGraphModel.isDirected() || currentGraphModel.isMixed();//Get graph directed state. Set to true if graph is directed or mixed
graphModel = currentGraphModel;
@@ -42,13 +42,13 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.attribute.api.Column;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.plugin.manipulators.nodes.ui.MergeNodesUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.datalab.spi.rows.merge.AttributeRowsMergeStrategy;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
@@ -73,14 +73,16 @@ public class MergeNodes extends BasicNodesManipulator {
public static final String DELETE_MERGED_NODES_SAVED_PREFERENCES = "MergeNodes_DeleteMergedNodes";
private Node[] nodes;
private Node selectedNode;
private AttributeColumn[] columns;
private Column[] columns;
private AttributeRowsMergeStrategy[] mergeStrategies;
private boolean deleteMergedNodes;
public void setup(Node[] nodes, Node clickedNode) {
this.nodes = nodes;
selectedNode = clickedNode != null ? clickedNode : nodes[0];
columns = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable().getColumns();
columns = Lookup.getDefault().lookup(GraphController.class).getAttributeModel().getNodeTable().getColumns();
mergeStrategies = new AttributeRowsMergeStrategy[columns.length];
deleteMergedNodes = NbPreferences.forModule(MergeNodes.class).getBoolean(DELETE_MERGED_NODES_SAVED_PREFERENCES, true);
}
@@ -140,7 +142,7 @@ public class MergeNodes extends BasicNodesManipulator {
this.selectedNode = selectedNode;
}
public AttributeColumn[] getColumns() {
public Column[] getColumns() {
return columns;
}
@@ -1,130 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.plugin.manipulators.nodes.ui.MoveNodeToGroupUI;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Node;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* Nodes manipulator that moves one or more nodes to a group. It shows an UI to select 1 of the available groups.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class MoveNodeToGroup extends BasicNodesManipulator {
private Node[] nodes;
private Node[] availableGroupsToMoveNodes;
private Node group=null;
public void setup(Node[] nodes, Node clickedNode) {
this.nodes = nodes;
}
public void execute() {
if (group != null) {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
gec.moveNodesToGroup(nodes, group);
}
}
public String getName() {
if (nodes.length > 1) {
return NbBundle.getMessage(MoveNodeToGroup.class, "MoveNodeToGroup.name.multiple");
} else {
return NbBundle.getMessage(MoveNodeToGroup.class, "MoveNodeToGroup.name.single");
}
}
public String getDescription() {
return "";
}
/**
* Can group nodes so it can be all moved to a group (at least 1 available)
*/
public boolean canExecute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
boolean canGroup = gec.canGroupNodes(nodes);
if (canGroup) {
availableGroupsToMoveNodes = gec.getAvailableGroupsToMoveNodes(nodes);
return availableGroupsToMoveNodes != null && availableGroupsToMoveNodes.length > 0;
} else {
return false;
}
}
public ManipulatorUI getUI() {
return new MoveNodeToGroupUI();
}
public int getType() {
return 300;
}
public int getPosition() {
return 300;
}
public Icon getIcon() {
return null;
}
public Node[] getAvailableGroupsToMoveNodes() {
return availableGroupsToMoveNodes;
}
public void setAvailableGroupsToMoveNodes(Node[] availableGroupsToMoveNodes) {
this.availableGroupsToMoveNodes = availableGroupsToMoveNodes;
}
public Node getGroup() {
return group;
}
public void setGroup(Node group) {
this.group = group;
}
}
@@ -1,58 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import org.gephi.datalab.spi.nodes.NodesManipulator;
import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
import org.openide.util.lookup.ServiceProvider;
/**
* Builder for RemoveNodeFromGroup nodes manipulator.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service=NodesManipulatorBuilder.class)
public class MoveNodeToGroupBuilder implements NodesManipulatorBuilder{
public NodesManipulator getNodesManipulator() {
return new MoveNodeToGroup();
}
}
@@ -1,105 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Node;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* Nodes manipulator that removes a node from its group if it has one. If the last node of the group is removed, breaks the group.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class RemoveNodeFromGroup extends BasicNodesManipulator {
private Node[] nodes;
public void setup(Node[] nodes, Node clickedNode) {
this.nodes = nodes;
}
public void execute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
gec.removeNodesFromGroup(nodes);//At least 1 node is in a group. And we don't have to check now every node because the removeNodesFromGroup method does it for us.
}
public String getName() {
if(nodes.length>1){
return NbBundle.getMessage(RemoveNodeFromGroup.class, "RemoveNodeFromGroup.name.multiple");
}else{
return NbBundle.getMessage(RemoveNodeFromGroup.class, "RemoveNodeFromGroup.name.single");
}
}
public String getDescription() {
return "";
}
public boolean canExecute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
for (Node n : nodes) {
if (gec.isNodeInGroup(n)) {
return true;//If any of the nodes can be removed from its group, then allow to execute this action.
}
}
return false;
}
public ManipulatorUI getUI() {
return null;
}
public int getType() {
return 300;
}
public int getPosition() {
return 400;
}
public Icon getIcon() {
return null;
}
}
@@ -1,58 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import org.gephi.datalab.spi.nodes.NodesManipulator;
import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
import org.openide.util.lookup.ServiceProvider;
/**
* Builder for RemoveNodeFromGroup nodes manipulator.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service=NodesManipulatorBuilder.class)
public class RemoveNodeFromGroupBuilder implements NodesManipulatorBuilder{
public NodesManipulator getNodesManipulator() {
return new RemoveNodeFromGroup();
}
}
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Node;
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
@@ -1,43 +1,43 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
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]"
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.
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):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.datalab.plugin.manipulators.nodes;
@@ -50,6 +50,7 @@ import org.openide.util.NbBundle;
/**
* Nodes manipulator that sets a given size for all the selected nodes.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class SetNodesSize extends BasicNodesManipulator {
@@ -59,12 +60,12 @@ public class SetNodesSize extends BasicNodesManipulator {
public void setup(Node[] nodes, Node clickedNode) {
this.nodes = nodes;
size=clickedNode.getNodeData().getSize();//Show size of the clicked node in UI
size = clickedNode.size();//Show size of the clicked node in UI
}
public void execute() {
for(Node node:nodes){
node.getNodeData().setSize(size);
for (Node node : nodes) {
node.setSize(size);
}
}
@@ -42,8 +42,8 @@ Portions Copyrighted 2011 Gephi Consortium.
package org.gephi.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.api.datatables.DataTablesController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
@@ -1,106 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* Nodes manipulator that breaks one or more selected groups.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class Ungroup extends BasicNodesManipulator {
private Node[] nodes;
public void setup(Node[] nodes, Node clickedNode) {
this.nodes = nodes;
}
public void execute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
gec.ungroupNodes(nodes);//At least 1 node is a group. And we don't have to check now every node because the ungroupNodes method does it for us.
}
public String getName() {
if (nodes.length > 1) {
return NbBundle.getMessage(Ungroup.class, "Ungroup.name.multiple");
} else {
return NbBundle.getMessage(Ungroup.class, "Ungroup.name.single");
}
}
public String getDescription() {
return "";
}
public boolean canExecute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
for (Node n : nodes) {
if (gec.canUngroupNode(n)) {
return true;//If any of the nodes can be ungrouped, then allow to execute this action.
}
}
return false;
}
public ManipulatorUI getUI() {
return null;
}
public int getType() {
return 300;
}
public int getPosition() {
return 100;
}
public Icon getIcon() {
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/ungroup.png", true);
}
}
@@ -1,59 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import org.gephi.datalab.spi.nodes.NodesManipulator;
import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
import org.openide.util.lookup.ServiceProvider;
/**
* Builder for Ungroup nodes manipulator.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service=NodesManipulatorBuilder.class)
public class UngroupBuilder implements NodesManipulatorBuilder{
public NodesManipulator getNodesManipulator() {
return new Ungroup();
}
}
@@ -1,106 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import javax.swing.Icon;
import org.gephi.datalab.api.GraphElementsController;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.graph.api.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* Nodes manipulator that breaks one or more selected groups recursively, breaking all groups formed by descendant nodes of the groups.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class UngroupRecursively extends BasicNodesManipulator{
private Node[] nodes;
public void setup(Node[] nodes, Node clickedNode) {
this.nodes = nodes;
}
public void execute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
gec.ungroupNodesRecursively(nodes);//At least 1 node is a group. And we don't have to check now every node because the ungroupNodesRecursively method does it for us.
}
public String getName() {
if (nodes.length > 1) {
return NbBundle.getMessage(Ungroup.class, "UngroupRecursively.name.multiple");
} else {
return NbBundle.getMessage(Ungroup.class, "UngroupRecursively.name.single");
}
}
public String getDescription() {
return NbBundle.getMessage(Ungroup.class, "UngroupRecursively.description");
}
public boolean canExecute() {
GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
for (Node n : nodes) {
if (gec.canUngroupNode(n)) {
return true;//If any of the nodes can be ungrouped, then allow to execute this action.
}
}
return false;
}
public ManipulatorUI getUI() {
return null;
}
public int getType() {
return 300;
}
public int getPosition() {
return 200;
}
public Icon getIcon() {
return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/ungroup.png", true);
}
}
@@ -1,59 +0,0 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
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.datalab.plugin.manipulators.nodes;
import org.gephi.datalab.spi.nodes.NodesManipulator;
import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
import org.openide.util.lookup.ServiceProvider;
/**
* Builder for UngroupRecursively nodes manipulator.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service=NodesManipulatorBuilder.class)
public class UngroupRecursivelyBuilder implements NodesManipulatorBuilder{
public NodesManipulator getNodesManipulator() {
return new UngroupRecursively();
}
}
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -23,7 +23,7 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="descriptionLabel" pref="242" max="32767" attributes="0"/>
<Component id="descriptionLabel" pref="0" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="sourceNodeLabel" min="-2" max="-2" attributes="0"/>

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais