Author: kono
Date: 2012-07-23 18:56:50 -0700 (Mon, 23 Jul 2012)
New Revision: 29970
Modified:
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListMultipleHandler.java
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListSingleHandler.java
Log:
GUI panels are tweaked.
Modified:
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
===================================================================
---
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
2012-07-24 01:12:27 UTC (rev 29969)
+++
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
2012-07-24 01:56:50 UTC (rev 29970)
@@ -1,14 +1,15 @@
package org.cytoscape.work.internal.tunables;
+import java.awt.Component;
+import java.awt.Dimension;
import java.awt.Font;
+import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import java.awt.Component;
-import java.awt.Window;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -21,7 +22,6 @@
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
-import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SwingUtilities;
@@ -47,6 +47,7 @@
private static final Logger logger =
LoggerFactory.getLogger(FileHandler.class);
private static final Font FILE_NAME_FONT = new Font("SansSerif",
Font.PLAIN, 10);
+ private static final Dimension PANEL_SIZE_DIMENSION = new
Dimension(500, 80);
private final FileUtil fileUtil;
@@ -54,7 +55,6 @@
private JTextField fileTextField;
private ImageIcon image;
private JLabel titleLabel;
-// private JSeparator titleSeparator;
private MouseClick mouseClick;
private GroupLayout layout;
private SupportedFileTypesManager fileTypesManager;
@@ -164,7 +164,13 @@
//set title and textfield text for the file type
final String fileCategory = getFileCategory();
fileTextField.setText(defaultString);
- titleLabel.setText((input ? "Load " : "Save ") +
initialCaps(fileCategory) + " File");
+ String description = this.getDescription();
+ if(description == null || description.isEmpty())
+ titleLabel.setText((input ? "Load " : "Save ") +
initialCaps(fileCategory) + " File");
+ else
+ titleLabel.setText(description);
+
+ panel.setPreferredSize(PANEL_SIZE_DIMENSION);
}
private String getFileCategory() {
Modified:
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListMultipleHandler.java
===================================================================
---
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListMultipleHandler.java
2012-07-24 01:12:27 UTC (rev 29969)
+++
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListMultipleHandler.java
2012-07-24 01:56:50 UTC (rev 29970)
@@ -1,7 +1,6 @@
package org.cytoscape.work.internal.tunables;
-import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.lang.reflect.Field;
@@ -11,16 +10,17 @@
import java.util.List;
import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ListSelectionModel;
+import javax.swing.border.Border;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.cytoscape.work.Tunable;
-import org.cytoscape.work.internal.tunables.utils.GUIDefaults;
import org.cytoscape.work.swing.AbstractGUITunableHandler;
import org.cytoscape.work.util.ListMultipleSelection;
@@ -71,13 +71,15 @@
return;
}
- panel = new JPanel(new BorderLayout(GUIDefaults.hGap,
GUIDefaults.vGap));
- JTextArea jta = new JTextArea(getDescription());
- jta.setPreferredSize(new Dimension(120, 50));
+ final Border padding = BorderFactory.createEmptyBorder(5, 10,
5, 10);
+ panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+ final JTextArea jta = new JTextArea(getDescription());
+ jta.setPreferredSize(new Dimension(200, 50));
jta.setLineWrap(true);
jta.setWrapStyleWord(true);
- jta.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- panel.add(jta,BorderLayout.BEFORE_LINE_BEGINS);
+ jta.setBorder(padding);
+ panel.add(jta);
jta.setBackground(null);
jta.setEditable(false);
@@ -104,8 +106,10 @@
itemsContainerList.setSelectedIndices(selectedIdx);
//use a JscrollPane to visualize the items
- JScrollPane scrollpane = new JScrollPane(itemsContainerList);
- panel.add(scrollpane,BorderLayout.CENTER);
+ final JScrollPane scrollpane = new
JScrollPane(itemsContainerList);
+ scrollpane.setOpaque(false);
+ scrollpane.setBorder(padding);
+ panel.add(scrollpane);
}
Modified:
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListSingleHandler.java
===================================================================
---
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListSingleHandler.java
2012-07-24 01:12:27 UTC (rev 29969)
+++
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListSingleHandler.java
2012-07-24 01:56:50 UTC (rev 29970)
@@ -25,8 +25,8 @@
private static final Font LABEL_FONT = new Font("SansSerif", Font.BOLD,
12);
private static final Font COMBOBOX_FONT = new Font("SansSerif",
Font.PLAIN, 12);
- private static final Dimension DEF_LABEL_SIZE = new Dimension(300, 25);
- private static final Dimension DEF_COMBOBOX_SIZE = new Dimension(200,
25);
+// private static final Dimension DEF_LABEL_SIZE = new Dimension(300, 25);
+ private static final Dimension DEF_COMBOBOX_SIZE = new Dimension(300,
25);
private JComboBox combobox;
@@ -68,20 +68,20 @@
}
//set Gui
- panel = new JPanel(new BorderLayout(GUIDefaults.hGap,
GUIDefaults.vGap));
+ panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
final JLabel textArea = new JLabel(getDescription());
textArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
textArea.setFont(LABEL_FONT);
- textArea.setPreferredSize(DEF_LABEL_SIZE);
textArea.setVerticalTextPosition(SwingConstants.CENTER);
- panel.add(textArea,BorderLayout.WEST);
+ panel.add(textArea);
//add list's items to the combobox
combobox = new
JComboBox(getSingleSelection().getPossibleValues().toArray());
combobox.setPreferredSize(DEF_COMBOBOX_SIZE);
combobox.setFont(COMBOBOX_FONT);
combobox.addActionListener(this);
- panel.add(combobox, BorderLayout.CENTER);
+ panel.add(combobox);
combobox.getModel().setSelectedItem(getSingleSelection().getSelectedValue());
}
--
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.