Skip to content

Commit

Permalink
Improve details in legends, preview refreshing and mouse interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
eduramiba committed Nov 11, 2012
1 parent 4408f01 commit 8e77b1d
Show file tree
Hide file tree
Showing 16 changed files with 417 additions and 395 deletions.
4 changes: 2 additions & 2 deletions DesktopLegend/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=5d32eab8
build.xml.data.CRC32=4fef4b88
build.xml.script.CRC32=fcccf6bb
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=5d32eab8
nbproject/build-impl.xml.data.CRC32=4fef4b88
nbproject/build-impl.xml.script.CRC32=63dac4e5
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.50.1
8 changes: 8 additions & 0 deletions DesktopLegend/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
<specification-version>0.8.0.7</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.gephi.desktop.preview</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>0.8.1.9</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.gephi.graph.api</code-name-base>
<build-prerequisite/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ LegendManagerUI.rendererLabel.text=Renderer:

LegendNode.displayName = Legend Node

LegendNode.own.properties = Legend properties
LegendNode.legend.properties = Generic properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,21,0,0,1,-118"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,21,0,0,2,64"/>
</AuxValues>

<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
package org.gephi.desktop.legend.manager;

import java.awt.*;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
Expand All @@ -18,10 +16,8 @@
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.desktop.preview.api.PreviewUIController;
import org.gephi.graph.api.Graph;
import org.gephi.legend.api.LegendController;
import org.gephi.legend.api.LegendModel;
Expand All @@ -45,12 +41,16 @@
public class LegendManagerUI extends javax.swing.JPanel implements PreviewUI, PropertyChangeListener {

private final LegendController legendController;
private final PreviewUIController previewUIController;


/**
* Creates new form LegendManagerUI
*/
public LegendManagerUI() {
legendController = LegendController.getInstance();
legendController.addListener(this);
previewUIController = Lookup.getDefault().lookup(PreviewUIController.class);
initComponents();
tooltipRenderer = new ComboboxToolTipRenderer();
builderTypeComboBox.setRenderer(tooltipRenderer);
Expand Down Expand Up @@ -267,7 +267,8 @@ private void addLegendButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
JOptionPane.INFORMATION_MESSAGE,
null);
}


previewUIController.refreshPreview();
}//GEN-LAST:event_addLegendButtonActionPerformed

private void refreshPropertySheet() {
Expand Down Expand Up @@ -304,6 +305,8 @@ private void removeLegendButtonActionPerformed(java.awt.event.ActionEvent evt) {
Integer activeLegend = ((Item) activeLegendsComboBox.getSelectedItem()).getData(LegendItem.ITEM_INDEX);
legendModel.removeItem(activeLegend);
refreshActiveLegendsComboBox();

previewUIController.refreshPreview();
}//GEN-LAST:event_removeLegendButtonActionPerformed

private void activeLegendsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_activeLegendsComboBoxActionPerformed
Expand Down Expand Up @@ -377,10 +380,11 @@ private void numberOfItemsTextFieldActionPerformed(java.awt.event.ActionEvent ev
refreshPropertySheet();
}
}

previewController.refreshPreview();
}//GEN-LAST:event_numberOfItemsTextFieldActionPerformed

private void legendItemBuildersComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_legendItemBuildersComboBoxActionPerformed

// clean combobox
builderTypeComboBox.removeAllItems();
ArrayList<String> tooltips = new ArrayList<String>();
Expand All @@ -393,16 +397,15 @@ private void legendItemBuildersComboBoxActionPerformed(java.awt.event.ActionEven
}

tooltipRenderer.setTooltips(tooltips);

}//GEN-LAST:event_legendItemBuildersComboBoxActionPerformed

private void renderersComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renderersComboBoxActionPerformed
Item item = (Item) activeLegendsComboBox.getSelectedItem();
Object renderer = renderersComboBox.getSelectedItem();
if (item != null && renderer != null) {
item.setData(LegendItem.RENDERER, renderer);
System.out.println("@Var: combobox currentRenderer: " + renderer);
}
previewUIController.refreshPreview();
}//GEN-LAST:event_renderersComboBoxActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel activeLegendLabel;
Expand Down
45 changes: 27 additions & 18 deletions DesktopLegend/src/org/gephi/desktop/legend/manager/LegendNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
public class LegendNode extends AbstractNode implements PropertyChangeListener {
private final PreviewProperties previewProperties;
private PropertySet[] propertySets;

@Override
public void propertyChange(PropertyChangeEvent evt) {
Expand All @@ -37,45 +38,53 @@ public LegendNode(PropertySheet propertySheet, Item activeLegendItem, PreviewPro
this.previewProperties = previewProperties;
setDisplayName(NbBundle.getMessage(LegendNode.class, "LegendNode.displayName"));
}

@Override
protected Sheet createSheet() {

Sheet sheet = Sheet.createDefault();
// regular properties
public PropertySet[] getPropertySets() {
propertySets = new PropertySet[]{prepareLegendOwnProperties(), prepareLegendProperties()};
return propertySets;
}

private Sheet.Set prepareLegendProperties() {
PreviewProperty[] properties = activeLegendItem.getData(LegendItem.PROPERTIES);
String label = properties[0].getValue();
Sheet.Set itemSet = Sheet.createPropertiesSet();
itemSet.setDisplayName(label);
itemSet.setName(label);
Sheet.Set set = Sheet.createPropertiesSet();

// regular properties
for (PreviewProperty property : properties) {
Node.Property nodeProperty = new LegendPropertyWrapper(property, previewProperties);
itemSet.put(nodeProperty);
set.put(nodeProperty);
}

set.setName("legend");
set.setDisplayName(NbBundle.getMessage(LegendNode.class, "LegendNode.legend.properties"));

return set;
}

private Sheet.Set prepareLegendOwnProperties() {
Sheet.Set set = Sheet.createPropertiesSet();

// own properties
PreviewProperty[] ownProperties = activeLegendItem.getData(LegendItem.OWN_PROPERTIES);
for (PreviewProperty property : ownProperties) {
Node.Property nodeProperty = new LegendPropertyWrapper(property, previewProperties);
itemSet.put(nodeProperty);
set.put(nodeProperty);
}


// dynamic properties
PreviewProperty[] dynamicProperties = activeLegendItem.getData(LegendItem.DYNAMIC_PROPERTIES);
for (PreviewProperty property : dynamicProperties) {
Node.Property nodeProperty = new LegendPropertyWrapper(property, previewProperties);
itemSet.put(nodeProperty);
set.put(nodeProperty);
}

set.setName("own");
set.setDisplayName(NbBundle.getMessage(LegendNode.class, "LegendNode.own.properties"));

sheet.put(itemSet);

return sheet;
return set;
}

public static class LegendPropertyWrapper extends PropertySupport.ReadWrite {

private final PreviewProperty property;
Expand Down
16 changes: 8 additions & 8 deletions DesktopPreview/build.xml
Original file line number Diff line number Diff line change
@@ -1,8 +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.desktop.preview" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project org.gephi.desktop.preview.</description>
<import file="nbproject/build-impl.xml"/>
</project>
<?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.desktop.preview" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project org.gephi.desktop.preview.</description>
<import file="nbproject/build-impl.xml"/>
</project>
12 changes: 6 additions & 6 deletions DesktopPreview/manifest.mf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
AutoUpdate-Essential-Module: true
OpenIDE-Module: org.gephi.desktop.preview
OpenIDE-Module-Localizing-Bundle: org/gephi/desktop/preview/Bundle.properties
OpenIDE-Module-Specification-Version: 0.8.1.9

Manifest-Version: 1.0
AutoUpdate-Essential-Module: true
OpenIDE-Module: org.gephi.desktop.preview
OpenIDE-Module-Localizing-Bundle: org/gephi/desktop/preview/Bundle.properties
OpenIDE-Module-Specification-Version: 0.8.1.9
90 changes: 45 additions & 45 deletions DesktopPreview/nbproject/build-impl.xml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="org.gephi.desktop.preview-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>
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="org.gephi.desktop.preview-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>
16 changes: 8 additions & 8 deletions DesktopPreview/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=cc483289
build.xml.script.CRC32=3ccd289b
build.xml.stylesheet.CRC32=a56c6a5b@2.47.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=cc483289
nbproject/build-impl.xml.script.CRC32=9dd7e19e
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47.1
build.xml.data.CRC32=0765bb17
build.xml.script.CRC32=3ccd289b
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=0765bb17
nbproject/build-impl.xml.script.CRC32=9dd7e19e
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.50.1
Loading

0 comments on commit 8e77b1d

Please sign in to comment.