Author: kono
Date: 2012-03-07 17:35:37 -0800 (Wed, 07 Mar 2012)
New Revision: 28454
Modified:
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/MapNetworkAttrTask.java
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListSingleHandler.java
Log:
fixes #739 GUI cosmetic issues had been fixed, too.
Modified:
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/MapNetworkAttrTask.java
===================================================================
---
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/MapNetworkAttrTask.java
2012-03-08 01:14:09 UTC (rev 28453)
+++
core3/api/trunk/core-task-api/src/main/java/org/cytoscape/task/MapNetworkAttrTask.java
2012-03-08 01:35:37 UTC (rev 28454)
@@ -40,9 +40,14 @@
private static final String ALL_SHARED = "All networks";
private static final String INDEPENDENT = "None (create Global Table
w/o mapping)";
- @Tunable(description="Would you like to map this table to:")
- public ListSingleSelection<String> whichTable;
-
+ @Tunable(description = "Would you like to map this table to:")
+ public static final ListSingleSelection<String> whichTable = new
ListSingleSelection<String>(CURRENT_SHARED,
+ CURRENT_LOCAL, ALL_SHARED, INDEPENDENT);
+ static {
+ // Default selected item is map to local.
+ whichTable.setSelectedValue(CURRENT_LOCAL);
+ }
+
@ProvidesTitle
public String getTitle() {
return "Map Table";
@@ -77,11 +82,6 @@
this.applicationManager = applicationManager;
this.rootNetworkManager = rootNetworkManager;
- this.whichTable = new
ListSingleSelection<String>(CURRENT_SHARED, CURRENT_LOCAL, ALL_SHARED,
INDEPENDENT);
-
- // Default selected item is map to local.
- this.whichTable.setSelectedValue(CURRENT_LOCAL);
-
if (type != CyNode.class && type != CyEdge.class)
throw new IllegalArgumentException("\"type\" must be
CyNode.class or CyEdge.class!");
}
@@ -115,9 +115,8 @@
taskMonitor.setTitle("Mapping virtual columns");
final List<CyTable> targetTables = new ArrayList<CyTable>();
-
final String selection = whichTable.getSelectedValue();
-
+
if (selection.equals(CURRENT_LOCAL)) {
final CyNetwork currentNetwork =
applicationManager.getCurrentNetwork();
targetTables.add(type == CyNode.class ?
currentNetwork.getDefaultNodeTable()
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-03-08 01:14:09 UTC (rev 28453)
+++
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/ListSingleHandler.java
2012-03-08 01:35:37 UTC (rev 28454)
@@ -19,6 +19,12 @@
* @param <T> type of items the List contains
*/
public class ListSingleHandler<T> extends AbstractGUITunableHandler {
+
+ 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, 20);
+ private static final Dimension DEF_COMBOBOX_SIZE = new Dimension(300,
10);
+
private JComboBox combobox;
/**
@@ -60,18 +66,19 @@
//set Gui
panel = new JPanel(new BorderLayout());
- JTextArea textArea = new JTextArea(getDescription());
- textArea.setLineWrap(true);
- textArea.setWrapStyleWord(true);
- panel.add(textArea,BorderLayout.WEST);
- textArea.setBackground(null);
- textArea.setEditable(false);
+ final JLabel textArea = new JLabel(getDescription());
+ textArea.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
+ textArea.setFont(LABEL_FONT);
+ textArea.setPreferredSize(DEF_LABEL_SIZE);
+ textArea.setVerticalTextPosition(SwingConstants.CENTER);
+ panel.add(textArea,BorderLayout.NORTH);
//add list's items to the combobox
combobox = new
JComboBox(getSingleSelection().getPossibleValues().toArray());
- combobox.setFont(new Font("sansserif", Font.PLAIN, 11));
+ combobox.setPreferredSize(DEF_COMBOBOX_SIZE);
+ combobox.setFont(COMBOBOX_FONT);
combobox.addActionListener(this);
- panel.add(combobox, BorderLayout.EAST);
+ panel.add(combobox, BorderLayout.CENTER);
combobox.getModel().setSelectedItem(getSingleSelection().getSelectedValue());
}
@@ -80,23 +87,23 @@
combobox.removeAllItems();
for ( T value : getSingleSelection().getPossibleValues() )
combobox.addItem(value);
+
+ if(combobox.getModel().getSize() != 0)
+ combobox.setSelectedIndex(0);
}
/**
* set the item that is currently selected in the ComboBox as the only
possible item selected in <code>listSingleSelection</code>
*/
@SuppressWarnings("unchecked")
+ @Override
public void handle() {
if ( combobox == null )
return;
- final T selectedItem = (T)combobox.getSelectedItem();
- if (selectedItem != null) {
+ final T selectedItem = (T) combobox.getSelectedItem();
+ if (selectedItem != null)
getSingleSelection().setSelectedValue(selectedItem);
- try {
- setValue(null);
- } catch (Exception e) { e.printStackTrace(); }
- }
}
/**
@@ -107,7 +114,7 @@
return "";
final T selectedItem = (T)combobox.getSelectedItem();
- if ( selectedItem == null )
+ if (selectedItem == null)
return "";
getSingleSelection().setSelectedValue(selectedItem);
--
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.