Skip to content
Snippets Groups Projects
Commit b436159e authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Some critical crashfixes

Added linkbutton for library
parent cb9d6673
Branches
Tags
No related merge requests found
...@@ -21,13 +21,11 @@ ...@@ -21,13 +21,11 @@
******************************************************************************/ ******************************************************************************/
package de.hhu.ba.yoshikoWrapper.gui; package de.hhu.ba.yoshikoWrapper.gui;
import javax.swing.GroupLayout;
import java.awt.FlowLayout;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.GroupLayout.Alignment;
import org.cytoscape.model.CyColumn; import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyNetwork; import org.cytoscape.model.CyNetwork;
...@@ -47,13 +45,7 @@ public class ColumnMapper extends JPanel{ ...@@ -47,13 +45,7 @@ public class ColumnMapper extends JPanel{
private final JCheckBox useMappingPerm; private final JCheckBox useMappingPerm;
private final JCheckBox useMappingForb; private final JCheckBox useMappingForb;
private final JPanel costGroup;
private final JPanel permGroup;
private final JPanel forbGroup;
public ColumnMapper() { public ColumnMapper() {
this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
//SWING COMPONENTS //SWING COMPONENTS
//Combo-Boxes that map to the CyColumns //Combo-Boxes that map to the CyColumns
...@@ -80,20 +72,45 @@ public class ColumnMapper extends JPanel{ ...@@ -80,20 +72,45 @@ public class ColumnMapper extends JPanel{
new EnableWhenSelectedListener(useMappingForb, forbiddenMapper) new EnableWhenSelectedListener(useMappingForb, forbiddenMapper)
); );
costGroup = new JPanel();
permGroup = new JPanel();
forbGroup = new JPanel();
costGroup.setLayout(new FlowLayout()); SwingUtil.addAll(this,useMappingCost,editingCostMapper);
permGroup.setLayout(new FlowLayout()); SwingUtil.addAll(this,useMappingPerm,permanentMapper);
forbGroup.setLayout(new FlowLayout()); SwingUtil.addAll(this,useMappingForb,forbiddenMapper);
SwingUtil.addAll(costGroup,useMappingCost,editingCostMapper); //Layout
SwingUtil.addAll(permGroup,useMappingPerm,permanentMapper); GroupLayout layout = new GroupLayout(this);
SwingUtil.addAll(forbGroup,useMappingForb,forbiddenMapper);
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)
)
);
SwingUtil.addAll(this,costGroup,permGroup,forbGroup); this.setLayout(layout);
//Initial call to get table values //Initial call to get table values
updateValues(); updateValues();
...@@ -114,6 +131,12 @@ public class ColumnMapper extends JPanel{ ...@@ -114,6 +131,12 @@ public class ColumnMapper extends JPanel{
editingCostMapper.addItem(c); editingCostMapper.addItem(c);
} }
} }
boolean enable = (editingCostMapper.getItemCount() > 0) ? true : false;
useMappingCost.setEnabled(enable);
if (!useMappingCost.isEnabled()) {
useMappingCost.setSelected(false);
editingCostMapper.setEnabled(false);
}
forbiddenMapper.removeAllItems(); forbiddenMapper.removeAllItems();
for (CyColumn c : net.getDefaultEdgeTable().getColumns()){ for (CyColumn c : net.getDefaultEdgeTable().getColumns()){
...@@ -122,6 +145,12 @@ public class ColumnMapper extends JPanel{ ...@@ -122,6 +145,12 @@ public class ColumnMapper extends JPanel{
forbiddenMapper.addItem(c); forbiddenMapper.addItem(c);
} }
} }
enable = (forbiddenMapper.getItemCount() > 0) ? true : false;
useMappingForb.setEnabled(enable);
if (!useMappingForb.isEnabled()) {
useMappingForb.setSelected(false);
forbiddenMapper.setEnabled(false);
}
permanentMapper.removeAllItems(); permanentMapper.removeAllItems();
for (CyColumn c : net.getDefaultEdgeTable().getColumns()){ for (CyColumn c : net.getDefaultEdgeTable().getColumns()){
...@@ -130,6 +159,12 @@ public class ColumnMapper extends JPanel{ ...@@ -130,6 +159,12 @@ public class ColumnMapper extends JPanel{
permanentMapper.addItem(c); permanentMapper.addItem(c);
} }
} }
enable = (permanentMapper.getItemCount() > 0) ? true : false;
useMappingPerm.setEnabled(enable);
if (!useMappingPerm.isEnabled()) {
useMappingPerm.setSelected(false);
permanentMapper.setEnabled(false);
}
} }
} }
......
...@@ -21,8 +21,10 @@ ...@@ -21,8 +21,10 @@
******************************************************************************/ ******************************************************************************/
package de.hhu.ba.yoshikoWrapper.gui; package de.hhu.ba.yoshikoWrapper.gui;
import java.awt.Desktop;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.net.URI;
import javax.swing.GroupLayout; import javax.swing.GroupLayout;
import javax.swing.JButton; import javax.swing.JButton;
...@@ -35,6 +37,7 @@ import org.cytoscape.util.swing.BasicCollapsiblePanel; ...@@ -35,6 +37,7 @@ import org.cytoscape.util.swing.BasicCollapsiblePanel;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader;
import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger;
import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface;
public class LibraryPanelFactory{ public class LibraryPanelFactory{
...@@ -46,11 +49,12 @@ public class LibraryPanelFactory{ ...@@ -46,11 +49,12 @@ public class LibraryPanelFactory{
final LibStatusPanel libStatusPanel; final LibStatusPanel libStatusPanel;
final JButton searchLibButton; final JButton searchLibButton;
final JLabel yoshikoVersionLabel; final JLabel yoshikoVersionLabel;
final JButton getYoshiko;
//SWING COMPONENT INITIALIZATION //SWING COMPONENT INITIALIZATION
libStatusPanel = new LibStatusPanel(); libStatusPanel = new LibStatusPanel();
searchLibButton = new JButton(LocalizationManager.get("resolveLibPath")); searchLibButton = new JButton(LocalizationManager.get("resolveLibPath"));
yoshikoVersionLabel = new JLabel(LocalizationManager.get("yoshVersion")); yoshikoVersionLabel = new JLabel();
libStatusPanel.setStyle(YoshikoLoader.isLibraryLoaded()); libStatusPanel.setStyle(YoshikoLoader.isLibraryLoaded());
...@@ -68,15 +72,37 @@ public class LibraryPanelFactory{ ...@@ -68,15 +72,37 @@ public class LibraryPanelFactory{
YoshikoLoader.loadLibrary(c.getSelectedFile().getAbsolutePath()); YoshikoLoader.loadLibrary(c.getSelectedFile().getAbsolutePath());
} }
libStatusPanel.setStyle(YoshikoLoader.isLibraryLoaded()); libStatusPanel.setStyle(YoshikoLoader.isLibraryLoaded());
yoshikoVersionLabel.setText(LibraryInterface.getVersionString()); yoshikoVersionLabel.setText(LocalizationManager.get("yoshVersion")+" "+LibraryInterface.getVersionString());
searchLibButton.setEnabled(false); 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, SwingUtil.addAll(ret,
libStatusPanel, libStatusPanel,
yoshikoVersionLabel, yoshikoVersionLabel,
searchLibButton searchLibButton,
getYoshiko
); );
//Layout //Layout
...@@ -86,12 +112,14 @@ public class LibraryPanelFactory{ ...@@ -86,12 +112,14 @@ public class LibraryPanelFactory{
.addComponent(libStatusPanel) .addComponent(libStatusPanel)
.addComponent(yoshikoVersionLabel) .addComponent(yoshikoVersionLabel)
.addComponent(searchLibButton) .addComponent(searchLibButton)
.addComponent(getYoshiko)
); );
layout.setVerticalGroup(layout.createSequentialGroup() layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(libStatusPanel) .addComponent(libStatusPanel)
.addComponent(yoshikoVersionLabel) .addComponent(yoshikoVersionLabel)
.addComponent(searchLibButton) .addComponent(searchLibButton)
.addComponent(getYoshiko)
); );
......
...@@ -106,6 +106,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -106,6 +106,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
ecPanel = new EditCostPanel(); ecPanel = new EditCostPanel();
ecPanelWrapper = new BasicCollapsiblePanel(LocalizationManager.get("editingCostPanel")); ecPanelWrapper = new BasicCollapsiblePanel(LocalizationManager.get("editingCostPanel"));
ecPanelWrapper.add(ecPanel); ecPanelWrapper.add(ecPanel);
ecPanelWrapper.setCollapsed(false);
opModePanel = new OperationModePanel(); opModePanel = new OperationModePanel();
opWrapper = new BasicCollapsiblePanel(LocalizationManager.get("operationMode")); opWrapper = new BasicCollapsiblePanel(LocalizationManager.get("operationMode"));
......
...@@ -61,5 +61,6 @@ notOptimal = Not Optimal Solution ...@@ -61,5 +61,6 @@ notOptimal = Not Optimal Solution
ilpMarker = ILP Properties ilpMarker = ILP Properties
timeoutMarker = Timed Out timeoutMarker = Timed Out
gap = Gap gap = Gap
currentGap = [ILP] Current Gap: currentGap = [ILP] Current Instance Gap:
disableMultiThreading = Disable Multithreading disableMultiThreading = Disable Multithreading
getYoshiko = Get Yoshiko Library
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment