Skip to content

Commit

Permalink
v1.1.1: Changed UI texts
Browse files Browse the repository at this point in the history
  • Loading branch information
marclegeay committed Jun 12, 2019
1 parent 1691f8d commit 7747a74
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 35 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>dk.ku.cpr</groupId>
<artifactId>OmicsVisualizer</artifactId>
<version>1.1</version>
<version>1.1.1</version>
<name>Omics Visualizer</name>
<packaging>bundle</packaging>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void start(BundleContext context) throws Exception {
Properties appsProps = new Properties();
appsProps.setProperty(ServiceProperties.PREFERRED_MENU, OVShared.OV_PREFERRED_MENU);
appsProps.setProperty(ServiceProperties.MENU_GRAVITY, (++menuGravity).toString());
appsProps.setProperty(ServiceProperties.TITLE, "Import Table from File...");
appsProps.setProperty(ServiceProperties.TITLE, "Import table from file");

registerService(context, factory, TaskFactory.class, appsProps);
//registerService(context, factory, LoadTableFileTaskFactory.class, props);
Expand Down Expand Up @@ -212,7 +212,7 @@ public void start(BundleContext context) throws Exception {
ShowFilterWindowTaskFactory factory = new ShowFilterWindowTaskFactory(ovManager);
Properties props = new Properties();
props.setProperty(ServiceProperties.PREFERRED_MENU, OVShared.OV_PREFERRED_MENU);
props.setProperty(ServiceProperties.TITLE, "Filter table rows...");
props.setProperty(ServiceProperties.TITLE, "Filter table");
props.setProperty(ServiceProperties.MENU_GRAVITY, (++menuGravity).toString());
props.setProperty(ServiceProperties.COMMAND_NAMESPACE, OVShared.OV_COMMAND_NAMESPACE);
props.setProperty(ServiceProperties.COMMAND, "filter show");
Expand Down Expand Up @@ -251,7 +251,7 @@ public void start(BundleContext context) throws Exception {
ShowRetrieveWindowTaskFactory factory = new ShowRetrieveWindowTaskFactory(ovManager);
Properties props = new Properties();
props.setProperty(ServiceProperties.PREFERRED_MENU, OVShared.OV_PREFERRED_MENU);
props.setProperty(ServiceProperties.TITLE, "Retrieve and connect the table to a String Network...");
props.setProperty(ServiceProperties.TITLE, "Retrieve STRING network");
props.setProperty(ServiceProperties.MENU_GRAVITY, (++menuGravity).toString());
props.setProperty(ServiceProperties.COMMAND_NAMESPACE, OVShared.OV_COMMAND_NAMESPACE);
props.setProperty(ServiceProperties.COMMAND, "retrieve show");
Expand All @@ -276,7 +276,7 @@ public void start(BundleContext context) throws Exception {
ShowConnectWindowTaskFactory factory = new ShowConnectWindowTaskFactory(ovManager);
Properties props = new Properties();
props.setProperty(ServiceProperties.PREFERRED_MENU, OVShared.OV_PREFERRED_MENU);
props.setProperty(ServiceProperties.TITLE, "Manage table connections...");
props.setProperty(ServiceProperties.TITLE, "Manage table connections");
props.setProperty(ServiceProperties.MENU_GRAVITY, (++menuGravity).toString());
props.setProperty(ServiceProperties.COMMAND_NAMESPACE, OVShared.OV_COMMAND_NAMESPACE);
props.setProperty(ServiceProperties.COMMAND, "connect show");
Expand Down Expand Up @@ -312,7 +312,7 @@ public void start(BundleContext context) throws Exception {
ShowVisualizationWindowTaskFactory factory = new ShowVisualizationWindowTaskFactory(ovManager, ChartType.PIE);
Properties props = new Properties();
props.setProperty(ServiceProperties.PREFERRED_MENU, OVShared.OV_PREFERRED_MENU);
props.setProperty(ServiceProperties.TITLE, "Apply a Pie Chart visualization...");
props.setProperty(ServiceProperties.TITLE, "Create pie visualization");
props.setProperty(ServiceProperties.MENU_GRAVITY, (++menuGravity).toString());
props.setProperty(ServiceProperties.COMMAND_NAMESPACE, OVShared.OV_COMMAND_NAMESPACE);
props.setProperty(ServiceProperties.COMMAND, "viz show inner");
Expand Down Expand Up @@ -347,7 +347,7 @@ public void start(BundleContext context) throws Exception {
ShowVisualizationWindowTaskFactory factory = new ShowVisualizationWindowTaskFactory(ovManager, ChartType.CIRCOS);
Properties props = new Properties();
props.setProperty(ServiceProperties.PREFERRED_MENU, OVShared.OV_PREFERRED_MENU);
props.setProperty(ServiceProperties.TITLE, "Apply a Donut Chart visualization...");
props.setProperty(ServiceProperties.TITLE, "Create donut visualization");
props.setProperty(ServiceProperties.MENU_GRAVITY, (++menuGravity).toString());
props.setProperty(ServiceProperties.COMMAND_NAMESPACE, OVShared.OV_COMMAND_NAMESPACE);
props.setProperty(ServiceProperties.COMMAND, "viz show outer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -252,18 +254,17 @@ private void displayPanel1() {

// This JLabel must be displayed in the top-left corner
// We add the default margin on top and left because otherwise the JLabel is not aligned with the center of the first JComboBox
chartPanel.add(new JLabel("Select Values:"), c2.nextRow().setAnchor("NW").setInsets(MyGridBagConstraints.DEFAULT_INSET, MyGridBagConstraints.DEFAULT_INSET, 0, 0));
chartPanel.add(new JLabel("Values:"), c2.nextRow().setAnchor("NW").setInsets(MyGridBagConstraints.DEFAULT_INSET, MyGridBagConstraints.DEFAULT_INSET, 0, 0));
// reset constraint
c2.setAnchor("C").setInsets(MyGridBagConstraints.DEFAULT_INSET, MyGridBagConstraints.DEFAULT_INSET, MyGridBagConstraints.DEFAULT_INSET, MyGridBagConstraints.DEFAULT_INSET);
chartPanel.add(this.selectValues, c2.nextCol());

chartPanel.add(new JLabel("Select Labels:"), c2.nextRow());
chartPanel.add(this.selectChartLabels, c2.nextCol());

// TODO v1.1: No discrete mapping
chartPanel.add(new JLabel("Mapping:"), c2.nextRow());
chartPanel.add(this.selectDiscreteContinuous, c2.nextCol());

chartPanel.add(new JLabel("Labels:"), c2.nextRow());
chartPanel.add(this.selectChartLabels, c2.nextCol());

if(this.ovTable.getFilter() != null) {
chartPanel.add(this.filteredCheck, c2.nextRow().useNCols(2));
c2.useNCols(1);
Expand Down Expand Up @@ -1070,9 +1071,10 @@ public void actionPerformed(ActionEvent e) {
RemoveVisualizationTaskFactory factory = new RemoveVisualizationTaskFactory(this.ovManager, this.ovCon, type);
this.ovManager.executeSynchronousTask(factory.createTaskIterator());

this.updateVisualization(this.getVisualization());

this.ovManager.getOVCytoPanel().update();
// this.updateVisualization(this.getVisualization());
//
// this.ovManager.getOVCytoPanel().update();
this.setVisible(false);
}
} else if(e.getSource() == this.nextButton) {
if(!this.selectValues.allSameType()) {
Expand All @@ -1082,6 +1084,14 @@ public void actionPerformed(ActionEvent e) {
JOptionPane.ERROR_MESSAGE);
return;
}

if(this.selectValues.getValueType() == SelectValuesPanel.BlankChartValues.class) {
JOptionPane.showMessageDialog(null,
"You should at least select one value.",
"Error: Bad values",
JOptionPane.ERROR_MESSAGE);
return;
}

// We look if something has changed from the loaded visualization
// To know if we have to reset panel2 or not
Expand Down Expand Up @@ -1252,7 +1262,9 @@ private class SelectValuesPanel extends JPanel implements ActionListener {
private List<JButton> buttons;
private JButton addButton;

private ComboBoxActionListener comboBoxActionListener;
private ComboBoxItemListener comboBoxItemListener;

public final ChartValues BLANK = new ChartValues("", BlankChartValues.class);

public SelectValuesPanel(OVVisualizationWindow ovVisualizationWindow) {
this.ovVisualizationWindow = ovVisualizationWindow;
Expand All @@ -1268,21 +1280,18 @@ public SelectValuesPanel(OVVisualizationWindow ovVisualizationWindow) {
this.addButton.setFont(iconManager.getIconFont(buttonFont.getSize()));
this.addButton.addActionListener(this);

this.comboBoxActionListener = new ComboBoxActionListener(this.ovVisualizationWindow);
this.comboBoxItemListener = new ComboBoxItemListener(this.ovVisualizationWindow);
}

public void setTable(OVTable ovTable) {
if(ovTable != null) {
this.selectItemStringValues = new ArrayList<>();
List<ChartValues> selectItems = new ArrayList<>();
selectItems.add(BLANK);
for(String colName : ovTable.getColNames()) {
Class<?> colType = ovTable.getColType(colName);
// We don't want OVCol, neither do we want List columns
if(!OVShared.isOVCol(colName) && colType != List.class
// TODO v1.1: No discrete mapping, so no String nor Boolean columns
// && colType != String.class
// && colType != Boolean.class
) {
if(!OVShared.isOVCol(colName) && colType != List.class) {
selectItems.add(new ChartValues(colName, colType));
this.selectItemStringValues.add(colName);
}
Expand Down Expand Up @@ -1312,7 +1321,7 @@ public void setVisualization(OVVisualization ovViz) {
} else {
for(String val : ovViz.getValues()) {
// We create the JComboBox and select the visualization value
this.createSelect().setSelectedIndex(this.selectItemStringValues.indexOf(val));
this.createSelect().setSelectedIndex(this.selectItemStringValues.indexOf(val)+1); // +1 because of BLANK

JButton del = new JButton(ICON_DEL);
del.setToolTipText("Delete this value from the visualization.");
Expand Down Expand Up @@ -1363,21 +1372,22 @@ private JComboBox<ChartValues> createSelect() {
JComboBox<ChartValues> select = new JComboBox<>(this.selectItemChartValues);
select.setToolTipText("Select the table columns to visualize.");
select.setRenderer(new ComboBoxRenderer());
select.addActionListener(this.comboBoxActionListener);
select.addItemListener(this.comboBoxItemListener);

this.selects.add(select);

return select;
}

private void addSelect() {
JComboBox<ChartValues> select = this.createSelect();
// The select has the first item selected
// By default we will select the last ChartValues
select.removeActionListener(this.comboBoxActionListener);
// this select was added, so the "last" ChartValues is at size()-2
select.setSelectedItem(this.selects.get(this.selects.size()-2).getSelectedItem());
select.addActionListener(this.comboBoxActionListener);
// JComboBox<ChartValues> select = this.createSelect();
this.createSelect();
// // The select has the first item selected
// // By default we will select the last ChartValues
// select.removeActionListener(this.comboBoxActionListener);
// // this select was added, so the "last" ChartValues is at size()-2
// select.setSelectedItem(this.selects.get(this.selects.size()-2).getSelectedItem());
// select.addItemListener(this.comboBoxItemListener);

JButton del = new JButton(ICON_DEL);
Font buttonFont = del.getFont();
Expand Down Expand Up @@ -1490,6 +1500,8 @@ public Component getListCellRendererComponent(JList<?> list, Object value, int i
type = "ab";
} else if(cValue.getColType() == Boolean.class) {
type = "y/n";
} else if(cValue.getColType() == BlankChartValues.class) {
type = "";
}
JLabel labelType = new JLabel(type);
labelType.setFont(new Font("Serif", Font.BOLD, 11)); // See dk.ku.cpr.OmicsVisualizer.internal.tableimport.ui.AttributeEditor :: createDataTypeButton(AttributeDataType)
Expand All @@ -1501,19 +1513,25 @@ public Component getListCellRendererComponent(JList<?> list, Object value, int i
}
}

private class ComboBoxActionListener implements ActionListener {
private class ComboBoxItemListener implements ItemListener {
private OVVisualizationWindow ovVisualizationWindow;

public ComboBoxActionListener(OVVisualizationWindow ovVisualizationWindow) {
public ComboBoxItemListener(OVVisualizationWindow ovVisualizationWindow) {
super();
this.ovVisualizationWindow = ovVisualizationWindow;
}

@Override
public void actionPerformed(ActionEvent e) {
this.ovVisualizationWindow.checkValueTypes();
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {
this.ovVisualizationWindow.checkValueTypes();
}
}

}

private class BlankChartValues {

}
}
}

0 comments on commit 7747a74

Please sign in to comment.