Author: laylaoesper
Date: 2010-09-26 10:19:19 -0700 (Sun, 26 Sep 2010)
New Revision: 22067
Modified:
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/jars/WordCloud.jar
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/CloudDisplayPanel.java
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/CreateCloudAction.java
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SaveCloudAction.java
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SemanticSummaryInputPanel.java
Log:
Fixes from Gary's comments. Right now has 2 places to save as file from, but
doesn't resize to whole cloud.
Modified:
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/jars/WordCloud.jar
===================================================================
(Binary files differ)
Modified:
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/CloudDisplayPanel.java
===================================================================
---
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/CloudDisplayPanel.java
2010-09-26 10:44:51 UTC (rev 22066)
+++
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/CloudDisplayPanel.java
2010-09-26 17:19:19 UTC (rev 22067)
@@ -32,6 +32,7 @@
import java.util.TreeSet;
import javax.swing.BorderFactory;
+import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@@ -56,6 +57,8 @@
JPanel tagCloudFlowPanel;//add JLabels here for words
JScrollPane cloudScroll;
CloudParameters curCloud;
+ JPanel saveCloudPanel;
+ JButton saveCloudButton;
//CONSTRUCTORS
@@ -68,6 +71,16 @@
cloudScroll = new JScrollPane(tagCloudFlowPanel);
cloudScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
add(cloudScroll, BorderLayout.CENTER);
+
+
+ saveCloudButton = new JButton("Export Cloud to File");
+ saveCloudButton.setEnabled(false);
+ saveCloudButton.setToolTipText("Saves the current cloud as an
image file");
+ saveCloudButton.addActionListener(new SaveCloudAction());
+
+ saveCloudPanel = new JPanel(new BorderLayout());
+ saveCloudPanel.add(saveCloudButton,BorderLayout.EAST);
+ add(saveCloudPanel, BorderLayout.SOUTH);
}
//METHODS
@@ -215,5 +228,10 @@
{
curCloud = params;
}
+
+ public JButton getSaveCloudButton()
+ {
+ return saveCloudButton;
+ }
}
Modified:
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/CreateCloudAction.java
===================================================================
---
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/CreateCloudAction.java
2010-09-26 10:44:51 UTC (rev 22066)
+++
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/CreateCloudAction.java
2010-09-26 17:19:19 UTC (rev 22067)
@@ -161,6 +161,9 @@
inputPanel.getCreateNetworkButton().setEnabled(true);
inputPanel.getSaveCloudButton().setEnabled(true);
+ CloudDisplayPanel displayPanel =
SemanticSummaryManager.getInstance().getCloudWindow();
+ displayPanel.getSaveCloudButton().setEnabled(true);
+
//Update the list of filter words and checkbox
inputPanel.refreshNetworkSettings();
Modified:
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SaveCloudAction.java
===================================================================
---
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SaveCloudAction.java
2010-09-26 10:44:51 UTC (rev 22066)
+++
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SaveCloudAction.java
2010-09-26 17:19:19 UTC (rev 22067)
@@ -26,6 +26,7 @@
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics2D;
+import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import java.io.File;
@@ -34,6 +35,8 @@
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import cytoscape.Cytoscape;
@@ -100,19 +103,95 @@
CloudDisplayPanel panel =
SemanticSummaryManager.getInstance().getCloudWindow();
String cloudName =
SemanticSummaryManager.getInstance().getCurCloud().getCloudName();
+ //Get Data panel??
+ CytoPanel cytoPanel =
Cytoscape.getDesktop().getCytoPanel(SwingConstants.SOUTH);
+ Dimension curSize = cytoPanel.getSelectedComponent().getSize();
+
+
+ //Can I make it work with just the flow panel
+ //Gives exact copy of what is visible (includes scroll bars) -
KEEPER
+ JScrollPane scroll = panel.cloudScroll;
+ JFrame frame = new JFrame(cloudName);
+ scroll.setPreferredSize(curSize);
+ frame.getContentPane().add(scroll);
+ scroll.revalidate();
+ frame.pack();
+ frame.setLocation(-100, -100);
+ frame.setVisible(true);
+
+ /*
+ //Gives exact copy of what is visible (includes scroll bars) -
KEEPER
+ JFrame frame = new JFrame(cloudName);
+ panel.setPreferredSize(curSize);
+ frame.getContentPane().add(panel);
+ panel.revalidate();
+ frame.pack();
+ frame.setLocation(-100, -100);
+ frame.setVisible(true);
+ */
+
+
+
+ //Almost right width, adds scroll bars
+ /*
+ JFrame frame = new JFrame(cloudName);
+ frame.setPreferredSize(curSize);
+ frame.getContentPane().add(panel);
+ panel.revalidate();
+ frame.pack();
+ frame.setLocation(-100, -100);
+ frame.setVisible(true);
+ */
+
+ /*
+ panel.revalidate();
+ JPanel flowPanel = panel.getTagCloudFlowPanel();
+ JScrollPane scroll = panel.cloudScroll;
+ flowPanel.revalidate();
+
+ Dimension size = flowPanel.getSize();
+ Dimension preferredSize = flowPanel.getPreferredSize();
+ JFrame frame = new JFrame(cloudName);
+ Insets frameInset = frame.getInsets();
+ Insets panelInset = panel.getInsets();
+ Insets scrollInset = scroll.getInsets();
+ int width = size.width + frameInset.left + frameInset.right +
panelInset.left + panelInset.right + 25 + scrollInset.left + scrollInset.right;
+ int height = size.height + frameInset.top + frameInset.bottom +
panelInset.top + panelInset.bottom + 30 + scrollInset.top + scrollInset.bottom;
+ //frame.setPreferredSize(new Dimension(width, height));
+ frame.getContentPane().add(panel);
+ frame.pack();
+ frame.setLocation(-100, -100);
+ frame.setVisible(true);
+ flowPanel.revalidate();
+ panel.revalidate();
+ size = flowPanel.getSize();
+ width = size.width + frameInset.left + frameInset.right +
panelInset.left + panelInset.right + 25 + + scrollInset.left +
scrollInset.right;
+ height = size.height + frameInset.top + frameInset.bottom +
panelInset.top + panelInset.bottom + 30 + + scrollInset.top +
scrollInset.bottom;
+ //frame.setPreferredSize(new Dimension(width, height));
+ flowPanel.revalidate();
+ panel.revalidate();
+ frame.pack();
+ */
+
+ /*
//Testing
Dimension size = panel.getPreferredSize();
- Dimension newSize = new Dimension(size.width + 40, size.height
+ 15);
- panel.setPreferredSize(newSize);
+ //Dimension newSize = new Dimension(size.width + 40,
size.height + 15);
+ //panel.setPreferredSize(newSize);
JFrame frame = new JFrame(cloudName);
- frame.setSize(newSize);
+ //frame.setSize(newSize);
frame.getContentPane().add(panel);
frame.pack();
frame.setLocation(-100, -100);
frame.setVisible(true);
- Dimension imageSize = frame.getPreferredSize();
+ panel.revalidate();
+ frame.setPreferredSize(panel.getPreferredSize());
+ panel.revalidate();
+ */
+ //Dimension imageSize = frame.getPreferredSize();
+ Dimension imageSize = frame.getSize();
BufferedImage b = new BufferedImage(imageSize.width,
imageSize.height ,BufferedImage.TYPE_INT_RGB); /* change sizes of course */
Graphics2D g = b.createGraphics();
@@ -121,6 +200,10 @@
frame.dispose();
+ //Trial - add back to regular display
+ panel.add(scroll, BorderLayout.CENTER);
+
+
new SemanticSummaryPluginAction().loadCloudPanel();
}
Modified:
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SemanticSummaryInputPanel.java
===================================================================
---
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SemanticSummaryInputPanel.java
2010-09-26 10:44:51 UTC (rev 22066)
+++
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SemanticSummaryInputPanel.java
2010-09-26 17:19:19 UTC (rev 22067)
@@ -937,16 +937,20 @@
useNetworkCounts.setEnabled(true);
}
+ CloudDisplayPanel displayPanel =
SemanticSummaryManager.getInstance().getCloudWindow();
+
//Enable button based on cloud
if
(params.equals(SemanticSummaryManager.getInstance().getNullCloudParameters()))
{
createNetworkButton.setEnabled(false);
saveCloudButton.setEnabled(false);
+ displayPanel.getSaveCloudButton().setEnabled(false);
}
else
{
createNetworkButton.setEnabled(true);
saveCloudButton.setEnabled(true);
+ displayPanel.getSaveCloudButton().setEnabled(true);
}
SemanticSummaryManager.getInstance().setCurCloud(params);
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.