Skip to content

Commit

Permalink
Adapt LinkfluencePlugin to 0.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
eduramiba committed Jan 12, 2013
1 parent 3a426e0 commit e728263
Show file tree
Hide file tree
Showing 29 changed files with 1,650 additions and 10 deletions.
8 changes: 8 additions & 0 deletions LinkfluencePlugin/build.xml
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="org.gephi.linkfluence" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project org.gephi.linkfluence.</description>
<import file="nbproject/build-impl.xml"/>
</project>
5 changes: 5 additions & 0 deletions LinkfluencePlugin/manifest.mf
@@ -0,0 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module: org.gephi.linkfluence
OpenIDE-Module-Localizing-Bundle: org/gephi/linkfluence/Bundle.properties
OpenIDE-Module-Specification-Version: 1.0

45 changes: 45 additions & 0 deletions LinkfluencePlugin/nbproject/build-impl.xml
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="org.gephi.linkfluence-impl" basedir="..">
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<property file="nbproject/private/suite-private.properties"/>
<property file="nbproject/suite.properties"/>
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
<property file="${suite.dir}/nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="property"/>
<attribute name="value"/>
<sequential>
<property name="@{property}" value="@{value}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
<condition>
<not>
<contains string="${cluster.path.evaluated}" substring="platform"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/build.xml"/>
</project>
8 changes: 8 additions & 0 deletions LinkfluencePlugin/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
build.xml.data.CRC32=e6dffe29
build.xml.script.CRC32=888e7be4
build.xml.stylesheet.CRC32=a56c6a5b@2.50.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=e6dffe29
nbproject/build-impl.xml.script.CRC32=99768815
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.50.1
6 changes: 6 additions & 0 deletions LinkfluencePlugin/nbproject/project.properties
@@ -0,0 +1,6 @@
javac.source=1.5
javac.compilerargs=-Xlint -Xlint:-serial
license.file=../gpl-3.0.txt
nbm.homepage=linkfluence.net
nbm.module.author=Eduardo Ramos Ib\u00e1\u00f1ez
nbm.needs.restart=true
85 changes: 85 additions & 0 deletions LinkfluencePlugin/nbproject/project.xml
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>org.gephi.linkfluence</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>org.gephi.data.attributes.api</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>0.7.1.3</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.gephi.datalab.api</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>0.7.1.6</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.gephi.graph.api</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>0.7.1.4</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.gephi.project.api</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>0.7.1.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.gephi.ui.library.wrapper</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>0.8.2</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.gephi.visualization.api</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>0.7.1.3</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.awt</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.23.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>8.6.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.lookup</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>8.3.1</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
</data>
</configuration>
</project>
1 change: 1 addition & 0 deletions LinkfluencePlugin/nbproject/suite.properties
@@ -0,0 +1 @@
suite.dir=${basedir}/..
18 changes: 18 additions & 0 deletions LinkfluencePlugin/src/org/gephi/linkfluence/Bundle.properties
@@ -0,0 +1,18 @@
OpenIDE-Module-Display-Category=Plugin
OpenIDE-Module-Long-Description=\
This plugin provides some extra features for Overview and Data Laboratory such as nodes massive tagging, opening of urls from nodes and copying columns to clipboard.
OpenIDE-Module-Name=Linkfluence Plugin
OpenIDE-Module-Short-Description=Plugin for Linkfluence with some extra data manipulation features
TagEdges.name.single=Tag edge...
TagEdges.name.multiple=Tag edges...

TagNodes.name.multiple=Tag nodes...
TagNodes.name.single=Tag node...
CopyDataToClipboard.name=Copy selected node(s) column to clipboard...
CopyDataToClipboard.message=Column:

GraphContextMenu_OpenURL = Open in web browser
GraphContextMenu_OpenURL.description = Open URL in an attribute of the node
GraphContextMenu_OpenURLSubItem = Choose column...
GraphContextMenu_OpenURLSubItem.message = Column:
GraphContextMenu_OpenURLLastItem = Last column opened ({0})
130 changes: 130 additions & 0 deletions LinkfluencePlugin/src/org/gephi/linkfluence/CopyDataToClipboard.java
@@ -0,0 +1,130 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
Gephi is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
Gephi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Gephi. If not, see <http://www.gnu.org/licenses/>.
*/
package org.gephi.linkfluence;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import javax.swing.Icon;
import javax.swing.JOptionPane;
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.spi.ContextMenuItemManipulator;
import org.gephi.datalab.spi.ManipulatorUI;
import org.gephi.datalab.spi.nodes.NodesManipulator;
import org.gephi.graph.api.HierarchicalGraph;
import org.gephi.graph.api.Node;
import org.gephi.project.api.ProjectController;
import org.gephi.visualization.spi.GraphContextMenuItem;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;

/**
* Nodes manipulator that copies the given column data of multiple nodes to clipboard.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class CopyDataToClipboard implements NodesManipulator, GraphContextMenuItem {

private Node[] nodes;

public void setup(Node[] nodes, Node clickedNode) {
this.nodes = nodes;
}

public void setup(HierarchicalGraph graph, Node[] nodes) {
this.nodes = nodes;
}

public void execute() {
final AttributeColumn[] availableColumns = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable().getColumns();
AttributeColumn initialSelection;
LastColumnUsed lc = Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().getLookup().lookup(LastColumnUsed.class);
if (lc != null) {
AttributeTable table = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
initialSelection = table.getColumn(lc.column);
} else {
initialSelection = null;
}

AttributeColumn selection = (AttributeColumn) JOptionPane.showInputDialog(null, NbBundle.getMessage(CopyDataToClipboard.class, "CopyDataToClipboard.message"), getName(), JOptionPane.QUESTION_MESSAGE, null, availableColumns, initialSelection);
if (selection != null) {
final int columnIndex = selection.getIndex();
final StringBuilder sb = new StringBuilder();
for (Node node : nodes) {
sb.append(node.getNodeData().getAttributes().getValue(columnIndex));
sb.append('\n');
}
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection ss = new StringSelection(sb.toString());
clipboard.setContents(ss, ss);

if (lc == null) {
Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().add(new LastColumnUsed(selection.getTitle()));
} else {
lc.column = selection.getTitle();
}
}
}

public String getName() {
return NbBundle.getMessage(CopyDataToClipboard.class, "CopyDataToClipboard.name");
}

public String getDescription() {
return "";
}

public boolean canExecute() {
return nodes.length > 0;
}

public ManipulatorUI getUI() {
return null;
}

public int getType() {
return 200;
}

public int getPosition() {
return 300;
}

public Icon getIcon() {
return ImageUtilities.loadImageIcon("org/gephi/linkfluence/resources/clipboard.png", true);
}

@Override
public Integer getMnemonicKey() {
return KeyEvent.VK_R;
}

public ContextMenuItemManipulator[] getSubItems() {
return null;
}

public boolean isAvailable() {
return true;
}
}
@@ -0,0 +1,37 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
Gephi is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
Gephi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Gephi. If not, see <http://www.gnu.org/licenses/>.
*/
package org.gephi.linkfluence;

import org.gephi.datalab.spi.nodes.NodesManipulator;
import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
import org.openide.util.lookup.ServiceProvider;

/**
* Builder for CopyDataToClipboard nodes manipulator.
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
@ServiceProvider(service=NodesManipulatorBuilder.class)
public class CopyDataToClipboardBuilder implements NodesManipulatorBuilder{

public NodesManipulator getNodesManipulator() {
return new CopyDataToClipboard();
}
}
@@ -0,0 +1,42 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
Gephi is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
Gephi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Gephi. If not, see <http://www.gnu.org/licenses/>.
*/
package org.gephi.linkfluence;

import org.gephi.visualization.spi.GraphContextMenuItem;
import org.openide.util.lookup.ServiceProvider;

/**
* Same action as CopyDataToClipboard but with different position (for graph view)
* @author Eduardo
*/
@ServiceProvider(service=GraphContextMenuItem.class)
public class CopyDataToClipboardForGaphView extends CopyDataToClipboard {

@Override
public int getType() {
return 400;
}

@Override
public int getPosition() {
return 400;
}
}

0 comments on commit e728263

Please sign in to comment.