diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java index a9837aad0305b287d2fa92ee42593b1b4f8b50ab..f3b34924ee808e9430572a8dc7919cf3a33bb4d9 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java @@ -21,13 +21,11 @@ ******************************************************************************/ package de.hhu.ba.yoshikoWrapper.gui; - -import java.awt.FlowLayout; - -import javax.swing.BoxLayout; +import javax.swing.GroupLayout; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JPanel; +import javax.swing.GroupLayout.Alignment; import org.cytoscape.model.CyColumn; import org.cytoscape.model.CyNetwork; @@ -46,14 +44,8 @@ public class ColumnMapper extends JPanel{ private final JCheckBox useMappingCost; private final JCheckBox useMappingPerm; private final JCheckBox useMappingForb; - - private final JPanel costGroup; - private final JPanel permGroup; - private final JPanel forbGroup; public ColumnMapper() { - this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); - //SWING COMPONENTS //Combo-Boxes that map to the CyColumns @@ -80,20 +72,45 @@ public class ColumnMapper extends JPanel{ new EnableWhenSelectedListener(useMappingForb, forbiddenMapper) ); - costGroup = new JPanel(); - permGroup = new JPanel(); - forbGroup = new JPanel(); - - costGroup.setLayout(new FlowLayout()); - permGroup.setLayout(new FlowLayout()); - forbGroup.setLayout(new FlowLayout()); - - SwingUtil.addAll(costGroup,useMappingCost,editingCostMapper); - SwingUtil.addAll(permGroup,useMappingPerm,permanentMapper); - SwingUtil.addAll(forbGroup,useMappingForb,forbiddenMapper); + SwingUtil.addAll(this,useMappingCost,editingCostMapper); + SwingUtil.addAll(this,useMappingPerm,permanentMapper); + SwingUtil.addAll(this,useMappingForb,forbiddenMapper); + + //Layout + GroupLayout layout = new GroupLayout(this); - SwingUtil.addAll(this,costGroup,permGroup,forbGroup); + layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true) + .addGroup(layout.createSequentialGroup() + .addComponent(useMappingCost) + .addComponent(editingCostMapper) + ) + .addGroup(layout.createSequentialGroup() + .addComponent(useMappingPerm) + .addComponent(permanentMapper) + ) + .addGroup(layout.createSequentialGroup() + .addComponent(useMappingForb) + .addComponent(forbiddenMapper) + ) + ); + + layout.setVerticalGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup() + .addComponent(useMappingCost) + .addComponent(editingCostMapper) + ) + .addGroup(layout.createParallelGroup() + .addComponent(useMappingPerm) + .addComponent(permanentMapper) + ) + .addGroup(layout.createParallelGroup() + .addComponent(useMappingForb) + .addComponent(forbiddenMapper) + ) + ); + + this.setLayout(layout); //Initial call to get table values updateValues(); @@ -114,6 +131,12 @@ public class ColumnMapper extends JPanel{ editingCostMapper.addItem(c); } } + boolean enable = (editingCostMapper.getItemCount() > 0) ? true : false; + useMappingCost.setEnabled(enable); + if (!useMappingCost.isEnabled()) { + useMappingCost.setSelected(false); + editingCostMapper.setEnabled(false); + } forbiddenMapper.removeAllItems(); for (CyColumn c : net.getDefaultEdgeTable().getColumns()){ @@ -122,6 +145,12 @@ public class ColumnMapper extends JPanel{ forbiddenMapper.addItem(c); } } + enable = (forbiddenMapper.getItemCount() > 0) ? true : false; + useMappingForb.setEnabled(enable); + if (!useMappingForb.isEnabled()) { + useMappingForb.setSelected(false); + forbiddenMapper.setEnabled(false); + } permanentMapper.removeAllItems(); for (CyColumn c : net.getDefaultEdgeTable().getColumns()){ @@ -130,6 +159,12 @@ public class ColumnMapper extends JPanel{ permanentMapper.addItem(c); } } + enable = (permanentMapper.getItemCount() > 0) ? true : false; + useMappingPerm.setEnabled(enable); + if (!useMappingPerm.isEnabled()) { + useMappingPerm.setSelected(false); + permanentMapper.setEnabled(false); + } } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibraryPanelFactory.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibraryPanelFactory.java index 47ce04b13abc6184d90be8f4e386471f5480a67f..5e631f265e8673ac211ddc911472e66fe3d25f55 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibraryPanelFactory.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibraryPanelFactory.java @@ -21,8 +21,10 @@ ******************************************************************************/ package de.hhu.ba.yoshikoWrapper.gui; +import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.net.URI; import javax.swing.GroupLayout; import javax.swing.JButton; @@ -35,6 +37,7 @@ import org.cytoscape.util.swing.BasicCollapsiblePanel; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; +import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger; import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; public class LibraryPanelFactory{ @@ -46,11 +49,12 @@ public class LibraryPanelFactory{ final LibStatusPanel libStatusPanel; final JButton searchLibButton; final JLabel yoshikoVersionLabel; + final JButton getYoshiko; //SWING COMPONENT INITIALIZATION libStatusPanel = new LibStatusPanel(); searchLibButton = new JButton(LocalizationManager.get("resolveLibPath")); - yoshikoVersionLabel = new JLabel(LocalizationManager.get("yoshVersion")); + yoshikoVersionLabel = new JLabel(); libStatusPanel.setStyle(YoshikoLoader.isLibraryLoaded()); @@ -68,15 +72,37 @@ public class LibraryPanelFactory{ YoshikoLoader.loadLibrary(c.getSelectedFile().getAbsolutePath()); } libStatusPanel.setStyle(YoshikoLoader.isLibraryLoaded()); - yoshikoVersionLabel.setText(LibraryInterface.getVersionString()); + yoshikoVersionLabel.setText(LocalizationManager.get("yoshVersion")+" "+LibraryInterface.getVersionString()); searchLibButton.setEnabled(false); } }); + getYoshiko = new JButton(LocalizationManager.get("getYoshiko")); + getYoshiko.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO: Far Future: Fetch Yoshiko and auto-compile + Desktop desktop = Desktop.getDesktop(); + if (desktop != null){ + if(desktop.isSupported(Desktop.Action.BROWSE)) { + try { + desktop.browse(URI.create("https://github.com/spqrPh/yoshiko")); + } catch (Exception ex) { + YoshikoLogger.getInstance().getLogger().info("Can't access desktop browser!"); + ex.printStackTrace(); + } + } + } + } + + }); + SwingUtil.addAll(ret, libStatusPanel, yoshikoVersionLabel, - searchLibButton + searchLibButton, + getYoshiko ); //Layout @@ -86,12 +112,14 @@ public class LibraryPanelFactory{ .addComponent(libStatusPanel) .addComponent(yoshikoVersionLabel) .addComponent(searchLibButton) + .addComponent(getYoshiko) ); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(libStatusPanel) .addComponent(yoshikoVersionLabel) .addComponent(searchLibButton) + .addComponent(getYoshiko) ); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java index 35e6c6f99ce545c88ad2dd02b3cef17e081da073..52e530c8a1134bc7fe80b304d1f1f3edb31f3e19 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java @@ -106,6 +106,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ecPanel = new EditCostPanel(); ecPanelWrapper = new BasicCollapsiblePanel(LocalizationManager.get("editingCostPanel")); ecPanelWrapper.add(ecPanel); + ecPanelWrapper.setCollapsed(false); opModePanel = new OperationModePanel(); opWrapper = new BasicCollapsiblePanel(LocalizationManager.get("operationMode")); diff --git a/src/main/resources/YoshikoStrings.properties b/src/main/resources/YoshikoStrings.properties index 372a54be48b75802c009188af743237494f1a406..d1693163ec21a441a8968433d59a1ce9b769285e 100644 --- a/src/main/resources/YoshikoStrings.properties +++ b/src/main/resources/YoshikoStrings.properties @@ -61,5 +61,6 @@ notOptimal = Not Optimal Solution ilpMarker = ILP Properties timeoutMarker = Timed Out gap = Gap -currentGap = [ILP] Current Gap: +currentGap = [ILP] Current Instance Gap: disableMultiThreading = Disable Multithreading +getYoshiko = Get Yoshiko Library