Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix Issue #605

  • Loading branch information...
commit f9c4a628ac60d9ec8a92bfe5d55159ef903501a8 1 parent 8af3d3e
Eduardo Ramos eduramiba authored
2  DesktopPreview/manifest.mf
View
@@ -2,5 +2,5 @@ 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.7
+OpenIDE-Module-Specification-Version: 0.8.1.8
19 DesktopPreview/src/org/gephi/desktop/preview/PreviewTopComponent.java
View
@@ -47,6 +47,8 @@ Development and Distribution License("CDDL") (collectively, the
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BorderFactory;
@@ -142,6 +144,14 @@ public void actionPerformed(ActionEvent e) {
this.model = m;
initTarget(model);
}
+
+ sketchPanel.addComponentListener(new ComponentAdapter() {
+
+ @Override
+ public void componentResized(ComponentEvent e) {
+ Lookup.getDefault().lookup(PreviewUIController.class).refreshPreview();
+ }
+ });
}
public void propertyChange(PropertyChangeEvent evt) {
@@ -257,10 +267,13 @@ public void run() {
});
}
+ @Override
+ protected void componentActivated() {
+ Lookup.getDefault().lookup(PreviewUIController.class).refreshPreview();
+ }
+
/**
- * 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
33 DesktopPreview/src/org/gephi/desktop/preview/PreviewUIControllerImpl.java
View
@@ -170,8 +170,7 @@ public void disable() {
}
/**
- * Shows the refresh notification when the structure of the workspace graph
- * has changed.
+ * Shows the refresh notification when the structure of the workspace graph has changed.
*
* @param event
* @see GraphListener#graphChanged(org.gephi.graph.api.GraphEvent)
@@ -188,23 +187,25 @@ public void graphChanged(GraphEvent event) {
* Refreshes the preview applet.
*/
public void refreshPreview() {
- Thread refreshThread = new Thread(new Runnable() {
+ if (model != null) {
+ Thread refreshThread = new Thread(new Runnable() {
- public void run() {
- model.setRefreshing(true);
- fireEvent(REFRESHING, true);
+ public void run() {
+ model.setRefreshing(true);
+ fireEvent(REFRESHING, true);
- previewController.getModel().getProperties().putValue(PreviewProperty.VISIBILITY_RATIO, model.getVisibilityRatio());
- previewController.refreshPreview();
+ previewController.getModel().getProperties().putValue(PreviewProperty.VISIBILITY_RATIO, model.getVisibilityRatio());
+ previewController.refreshPreview();
- fireEvent(REFRESHED, model);
+ fireEvent(REFRESHED, model);
- model.setRefreshing(false);
- fireEvent(REFRESHING, false);
- fireEvent(GRAPH_CHANGED, false);
- }
- }, "Refresh Preview");
- refreshThread.start();
+ model.setRefreshing(false);
+ fireEvent(REFRESHING, false);
+ fireEvent(GRAPH_CHANGED, false);
+ }
+ }, "Refresh Preview");
+ refreshThread.start();
+ }
}
/**
@@ -259,7 +260,7 @@ public void savePreset(String name) {
for (PreviewProperty p : previewModel.getProperties().getProperties()) {
map.put(p.getName(), p.getValue());
}
- for(Entry<String,Object> p:previewModel.getProperties().getSimpleValues()){
+ for (Entry<String, Object> p : previewModel.getProperties().getSimpleValues()) {
map.put(p.getKey(), p.getValue());
}
PreviewPreset preset = new PreviewPreset(name, map);
Please sign in to comment.
Something went wrong with that request. Please try again.