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

Work on layout / style / graphics

parent f2194c90
Branches
Tags
No related merge requests found
Showing
with 322 additions and 110 deletions
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
******************************************************************************/ ******************************************************************************/
package de.hhu.ba.yoshikoWrapper.core; package de.hhu.ba.yoshikoWrapper.core;
import java.awt.Color;
import java.awt.Image; import java.awt.Image;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
...@@ -30,15 +31,18 @@ import javax.swing.ImageIcon; ...@@ -30,15 +31,18 @@ import javax.swing.ImageIcon;
public class GraphicsLoader { public class GraphicsLoader {
private static BufferedImage yoshikoLogo; private static BufferedImage yoshikoLogo;
private static BufferedImage yoshikoLogo_solved;
private static BufferedImage yoshikoText; private static BufferedImage yoshikoText;
public final static Color yoshikoGreen = new Color(0,128,0);
private final static ClassLoader classLoader = GraphicsLoader.class.getClassLoader(); private final static ClassLoader classLoader = GraphicsLoader.class.getClassLoader();
public static ImageIcon getLogo(int size) { public static ImageIcon getLogo(int size) {
if (yoshikoLogo == null) { if (yoshikoLogo == null) {
try { try {
yoshikoLogo = ImageIO.read( yoshikoLogo = ImageIO.read(
classLoader.getResource("graphics/YoshikoAlphaLogo.png") classLoader.getResource("graphics/YoshikoLogo.png")
); );
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -47,16 +51,31 @@ public class GraphicsLoader { ...@@ -47,16 +51,31 @@ public class GraphicsLoader {
return new ImageIcon(yoshikoLogo.getScaledInstance(size, size, Image.SCALE_SMOOTH)); return new ImageIcon(yoshikoLogo.getScaledInstance(size, size, Image.SCALE_SMOOTH));
} }
public static ImageIcon getSolvedLogo(int size) {
if (yoshikoLogo_solved == null) {
try {
yoshikoLogo_solved = ImageIO.read(
classLoader.getResource("graphics/YoshikoSolved.png")
);
} catch (IOException e) {
e.printStackTrace();
}
}
return new ImageIcon(yoshikoLogo_solved.getScaledInstance(size, size, Image.SCALE_SMOOTH));
}
public static ImageIcon getText(int height) { public static ImageIcon getText(int height) {
//Default dimension is 258x48
if (yoshikoText == null) { if (yoshikoText == null) {
try { try {
yoshikoText = ImageIO.read( yoshikoText = ImageIO.read(
classLoader.getResource("graphics/YoshikoAlphaText.png") classLoader.getResource("graphics/YoshikoText.png")
); );
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return new ImageIcon(yoshikoText.getScaledInstance(height*4, height, Image.SCALE_SMOOTH)); return new ImageIcon(yoshikoText.getScaledInstance((int)(height*258/48), height, Image.SCALE_SMOOTH));
} }
} }
package de.hhu.ba.yoshikoWrapper.gui;
import org.cytoscape.util.swing.BasicCollapsiblePanel;
@SuppressWarnings("serial")
public class ComfortCollapsiblePanel extends BasicCollapsiblePanel {
public ComfortCollapsiblePanel(String text) {
super(text);
}
@Override
public void setCollapsed(boolean collapse) {
super.setCollapsed(collapse);
//Force resize of parent
if (getParent() != null) {
getParent().revalidate();
}
}
}
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
******************************************************************************/ ******************************************************************************/
package de.hhu.ba.yoshikoWrapper.gui; package de.hhu.ba.yoshikoWrapper.gui;
import java.awt.FlowLayout;
import javax.swing.BoxLayout; import javax.swing.GroupLayout;
import javax.swing.JLabel; import javax.swing.JLabel;
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.util.swing.BasicCollapsiblePanel; import org.cytoscape.util.swing.BasicCollapsiblePanel;
...@@ -49,8 +49,7 @@ public class EditCostPanel extends BasicCollapsiblePanel { ...@@ -49,8 +49,7 @@ public class EditCostPanel extends BasicCollapsiblePanel {
public EditCostPanel() { public EditCostPanel() {
super(LocalizationManager.get("editingCostPanel")); super(LocalizationManager.get("editingCostPanel"));
//Define Layout
this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
//Initialize components //Initialize components
columnMapper = new ColumnMapper(); columnMapper = new ColumnMapper();
...@@ -67,17 +66,29 @@ public class EditCostPanel extends BasicCollapsiblePanel { ...@@ -67,17 +66,29 @@ public class EditCostPanel extends BasicCollapsiblePanel {
groupIC = new JPanel(); groupIC = new JPanel();
groupDC = new JPanel(); groupDC = new JPanel();
groupIC.setLayout(new FlowLayout());
groupDC.setLayout(new FlowLayout());
SwingUtil.addAll(groupIC,icLabel,icField); SwingUtil.addAll(groupIC,icLabel,icField);
SwingUtil.addAll(groupDC,dcLabel,dcField); SwingUtil.addAll(groupDC,dcLabel,dcField);
SwingUtil.addAll(this,columnMapper,groupIC,groupDC); SwingUtil.addAll(this,columnMapper,groupIC,groupDC);
//Decoration/Visual
//Border border = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); //Layout
//this.setBorder(border); GroupLayout layout = new GroupLayout(this.getContentPane());
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true)
.addComponent(columnMapper)
.addComponent(groupIC)
.addComponent(groupDC)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(columnMapper)
.addComponent(groupIC)
.addComponent(groupDC)
);
this.getContentPane().setLayout(layout);
} }
//SETTER / GETTER //SETTER / GETTER
...@@ -106,6 +117,4 @@ public class EditCostPanel extends BasicCollapsiblePanel { ...@@ -106,6 +117,4 @@ public class EditCostPanel extends BasicCollapsiblePanel {
return columnMapper; return columnMapper;
} }
} }
...@@ -49,6 +49,7 @@ public class LanguageSwitcher extends JComboBox<Locale>{ ...@@ -49,6 +49,7 @@ public class LanguageSwitcher extends JComboBox<Locale>{
} }
}); });
} }
......
/*******************************************************************************
* Copyright (C) 2017 Philipp Spohr
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
package de.hhu.ba.yoshikoWrapper.gui;
import javax.swing.BoxLayout;
import org.cytoscape.util.swing.BasicCollapsiblePanel;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
@SuppressWarnings("serial")
public class LanguageSwitcherPanel extends BasicCollapsiblePanel{
private final LanguageSwitcher switcher;
public LanguageSwitcherPanel() {
super(LocalizationManager.get("switchLanguage"));
this.getContentPane().setLayout(new BoxLayout(this.getContentPane(),BoxLayout.X_AXIS));
//SWING COMPONENTS INIT
switcher = new LanguageSwitcher();
SwingUtil.addAll(this,
switcher
);
}
}
...@@ -25,6 +25,8 @@ import java.awt.Color; ...@@ -25,6 +25,8 @@ import java.awt.Color;
import javax.swing.JLabel; import javax.swing.JLabel;
import de.hhu.ba.yoshikoWrapper.core.GraphicsLoader;
public class LibStatusPanel extends JLabel { public class LibStatusPanel extends JLabel {
/** /**
...@@ -35,7 +37,7 @@ public class LibStatusPanel extends JLabel { ...@@ -35,7 +37,7 @@ public class LibStatusPanel extends JLabel {
public void setStyle(boolean libraryLoaded) { public void setStyle(boolean libraryLoaded) {
if(libraryLoaded) { if(libraryLoaded) {
this.setText("YOSHIKO LIBRARY READY!"); this.setText("YOSHIKO LIBRARY READY!");
this.setForeground(Color.GREEN); this.setForeground(GraphicsLoader.yoshikoGreen);
} }
else { else {
this.setText("YOSHIKO LIBRARY NOT LOADED :("); this.setText("YOSHIKO LIBRARY NOT LOADED :(");
......
...@@ -24,12 +24,12 @@ package de.hhu.ba.yoshikoWrapper.gui; ...@@ -24,12 +24,12 @@ package de.hhu.ba.yoshikoWrapper.gui;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.BorderFactory; import javax.swing.GroupLayout;
import javax.swing.BoxLayout;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.border.EtchedBorder; import javax.swing.GroupLayout.Alignment;
import org.cytoscape.util.swing.BasicCollapsiblePanel; import org.cytoscape.util.swing.BasicCollapsiblePanel;
...@@ -38,7 +38,7 @@ import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; ...@@ -38,7 +38,7 @@ import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader;
import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class LibraryPanel extends ComfortCollapsiblePanel { public class LibraryPanel extends BasicCollapsiblePanel {
//SYMBOLIC LINKS //SYMBOLIC LINKS
private LibraryPanel self = this; private LibraryPanel self = this;
...@@ -50,7 +50,6 @@ public class LibraryPanel extends ComfortCollapsiblePanel { ...@@ -50,7 +50,6 @@ public class LibraryPanel extends ComfortCollapsiblePanel {
public LibraryPanel() { public LibraryPanel() {
super(LocalizationManager.get("libraryPanel")); super(LocalizationManager.get("libraryPanel"));
this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
//SWING COMPONENT INITIALIZATION //SWING COMPONENT INITIALIZATION
libStatusPanel = new LibStatusPanel(); libStatusPanel = new LibStatusPanel();
searchLibButton = new JButton(LocalizationManager.get("resolveLibPath")); searchLibButton = new JButton(LocalizationManager.get("resolveLibPath"));
...@@ -63,7 +62,6 @@ public class LibraryPanel extends ComfortCollapsiblePanel { ...@@ -63,7 +62,6 @@ public class LibraryPanel extends ComfortCollapsiblePanel {
searchLibButton.setEnabled(false); searchLibButton.setEnabled(false);
} }
searchLibButton.addActionListener(new ActionListener() { searchLibButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
...@@ -78,7 +76,29 @@ public class LibraryPanel extends ComfortCollapsiblePanel { ...@@ -78,7 +76,29 @@ public class LibraryPanel extends ComfortCollapsiblePanel {
} }
}); });
SwingUtil.addAll(this,libStatusPanel,yoshikoVersionLabel,searchLibButton); SwingUtil.addAll(this,
libStatusPanel,
yoshikoVersionLabel,
searchLibButton
);
//Layout
GroupLayout layout = new GroupLayout(this.getContentPane());
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true)
.addComponent(libStatusPanel)
.addComponent(yoshikoVersionLabel)
.addComponent(searchLibButton)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(libStatusPanel)
.addComponent(yoshikoVersionLabel)
.addComponent(searchLibButton)
);
this.getContentPane().setLayout(layout);
} }
} }
...@@ -21,22 +21,21 @@ ...@@ -21,22 +21,21 @@
******************************************************************************/ ******************************************************************************/
package de.hhu.ba.yoshikoWrapper.gui; package de.hhu.ba.yoshikoWrapper.gui;
import static javax.swing.GroupLayout.DEFAULT_SIZE;
import static javax.swing.GroupLayout.PREFERRED_SIZE;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import javax.swing.BoxLayout;
import javax.swing.GroupLayout; import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment; import javax.swing.GroupLayout.Alignment;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
...@@ -61,20 +60,15 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -61,20 +60,15 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
private final YoshikoHeader header; private final YoshikoHeader header;
/** private final JCheckBox showAdvancedOptions;
* Swing is a bit special sometimes, so a panel is used to wrap the lang-switcher. private final ArrayList<JComponent> advancedOptions;
* This prevents stretching of the component
*/ private final LanguageSwitcherPanel langPanel;
private final JPanel langSwitcherWrapper;
private final LanguageSwitcher langSwitcher;
private final LibraryPanel libraryPanel; private final LibraryPanel libraryPanel;
private final EditCostPanel ecPanel; private final EditCostPanel ecPanel;
private final ReductionRulesChooser reductionRulesChooser; private final ReductionRulesChooser reductionRulesChooser;
private final OperationModePanel opModePanel; private final OperationModePanel opModePanel;
//OTHER
/** /**
* Main constructor, creates a new Panel and initializes subcomponents * Main constructor, creates a new Panel and initializes subcomponents
*/ */
...@@ -86,19 +80,18 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -86,19 +80,18 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
//Initialize Swing components //Initialize Swing components
header = new YoshikoHeader(); header = new YoshikoHeader();
langSwitcherWrapper = new JPanel(); showAdvancedOptions = new JCheckBox(LocalizationManager.get("showAdvanced"));
langSwitcher = new LanguageSwitcher(); showAdvancedOptions.addActionListener(toggleAdvancedOptionsListener);
langSwitcherWrapper.add(new JLabel(LocalizationManager.get("switchLanguage")));
langSwitcherWrapper.add(langSwitcher); langPanel = new LanguageSwitcherPanel();
langSwitcherWrapper.setLayout(new FlowLayout());
libraryPanel = new LibraryPanel(); libraryPanel = new LibraryPanel();
//If no library is loaded yet the obvious panel should be showing up
if (!YoshikoLoader.isLibraryLoaded()) { if (!YoshikoLoader.isLibraryLoaded()) {
libraryPanel.setCollapsed(false); libraryPanel.setCollapsed(false);
} }
ecPanel = new EditCostPanel(); ecPanel = new EditCostPanel();
ecPanel.setCollapsed(false);
opModePanel = new OperationModePanel(); opModePanel = new OperationModePanel();
...@@ -107,10 +100,13 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -107,10 +100,13 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
JButton runButton = new JButton(LocalizationManager.get("run")); JButton runButton = new JButton(LocalizationManager.get("run"));
runButton.addActionListener(buttonListener); runButton.addActionListener(buttonListener);
//Add components to main panel
SwingUtil.addAll(this, SwingUtil.addAll(this,
header, header,
langSwitcherWrapper, showAdvancedOptions,
langPanel,
libraryPanel, libraryPanel,
ecPanel, ecPanel,
reductionRulesChooser, reductionRulesChooser,
...@@ -118,33 +114,65 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -118,33 +114,65 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
runButton runButton
); );
//Manage all advanced components separately to enable toggling
advancedOptions = new ArrayList<JComponent>();
advancedOptions.addAll(
Arrays.asList(
opModePanel,
reductionRulesChooser
)
);
showAdvancedOptions(false);
//Layout //Layout
GroupLayout layout = new GroupLayout(this); GroupLayout layout = new GroupLayout(this);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup() layout.setAutoCreateContainerGaps(true);
.addComponent(header)
.addComponent(langSwitcherWrapper) layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true)
.addComponent(libraryPanel) .addGap(30)
.addComponent(ecPanel) .addComponent(header,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(reductionRulesChooser) .addComponent(showAdvancedOptions,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(opModePanel) .addComponent(langPanel,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(runButton) .addComponent(libraryPanel,PREFERRED_SIZE, PREFERRED_SIZE, Short.MAX_VALUE)
.addComponent(ecPanel,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(reductionRulesChooser,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(opModePanel,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(runButton,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
); );
layout.setVerticalGroup(layout.createSequentialGroup() layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(header) .addComponent(header,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE)
.addComponent(langSwitcherWrapper) .addComponent(showAdvancedOptions,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE)
.addComponent(libraryPanel) .addComponent(langPanel,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE)
.addComponent(ecPanel) .addComponent(libraryPanel,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE)
.addComponent(reductionRulesChooser) .addComponent(ecPanel,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE)
.addComponent(opModePanel) .addComponent(reductionRulesChooser,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE)
.addComponent(runButton) .addComponent(opModePanel,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE)
.addComponent(runButton,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE)
); );
this.setLayout(layout); this.setLayout(layout);
this.setVisible(true);
}
private ActionListener toggleAdvancedOptionsListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showAdvancedOptions(showAdvancedOptions.isSelected());
}
};
private void showAdvancedOptions(boolean show) {
for (JComponent j : advancedOptions) {
j.setVisible(show);
}
setPreferredSize(getPreferredSize()); // <<< Swing at its finest
revalidate();
} }
/** /**
......
...@@ -24,20 +24,24 @@ package de.hhu.ba.yoshikoWrapper.gui; ...@@ -24,20 +24,24 @@ package de.hhu.ba.yoshikoWrapper.gui;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.BorderFactory; import static javax.swing.GroupLayout.DEFAULT_SIZE;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.GroupLayout;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JRadioButton; import javax.swing.JRadioButton;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import org.cytoscape.util.swing.BasicCollapsiblePanel; import org.cytoscape.util.swing.BasicCollapsiblePanel;
import javax.swing.GroupLayout.Alignment;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class OperationModePanel extends ComfortCollapsiblePanel{ public class OperationModePanel extends BasicCollapsiblePanel{
//SWING COMPONENTS
private final JRadioButton useHeuristic; private final JRadioButton useHeuristic;
private final JRadioButton useILP; private final JRadioButton useILP;
private final TimeLimitSetter timeLimitSetter; private final TimeLimitSetter timeLimitSetter;
...@@ -48,8 +52,8 @@ public class OperationModePanel extends ComfortCollapsiblePanel{ ...@@ -48,8 +52,8 @@ public class OperationModePanel extends ComfortCollapsiblePanel{
private final ButtonGroup heuristicGroup; private final ButtonGroup heuristicGroup;
public OperationModePanel() { public OperationModePanel() {
super(LocalizationManager.get("operationMode")); super(LocalizationManager.get("operationMode"));
this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
heuristicGroup = new ButtonGroup(); heuristicGroup = new ButtonGroup();
useILP = new JRadioButton("Use Integer Linear Programming"); useILP = new JRadioButton("Use Integer Linear Programming");
...@@ -61,7 +65,6 @@ public class OperationModePanel extends ComfortCollapsiblePanel{ ...@@ -61,7 +65,6 @@ public class OperationModePanel extends ComfortCollapsiblePanel{
solutionNumberChooser = new SolutionNumberChooser(); solutionNumberChooser = new SolutionNumberChooser();
timeLimitSetter = new TimeLimitSetter(); timeLimitSetter = new TimeLimitSetter();
useTriangleCutsBox = new JCheckBox("Use Triangle Cuts"); useTriangleCutsBox = new JCheckBox("Use Triangle Cuts");
...@@ -71,8 +74,39 @@ public class OperationModePanel extends ComfortCollapsiblePanel{ ...@@ -71,8 +74,39 @@ public class OperationModePanel extends ComfortCollapsiblePanel{
useILP.addActionListener(ilpHeuristicSwitch); useILP.addActionListener(ilpHeuristicSwitch);
useHeuristic.addActionListener(ilpHeuristicSwitch); useHeuristic.addActionListener(ilpHeuristicSwitch);
SwingUtil.addAll(this,
SwingUtil.addAll(this,useILP,useHeuristic,solutionNumberChooser,timeLimitSetter,useTriangleCutsBox,usePartitionCutsBox); useILP,
useHeuristic,
solutionNumberChooser,
timeLimitSetter,
useTriangleCutsBox,
usePartitionCutsBox
);
//Layout
GroupLayout layout = new GroupLayout(this.getContentPane());
layout.setAutoCreateContainerGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true)
.addComponent(useILP, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useHeuristic, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(solutionNumberChooser, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(timeLimitSetter, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useTriangleCutsBox, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(usePartitionCutsBox, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(useILP)
.addComponent(useHeuristic)
.addComponent(solutionNumberChooser)
.addComponent(timeLimitSetter)
.addComponent(useTriangleCutsBox)
.addComponent(usePartitionCutsBox)
);
this.getContentPane().setLayout(layout);
} }
......
...@@ -21,19 +21,24 @@ ...@@ -21,19 +21,24 @@
******************************************************************************/ ******************************************************************************/
package de.hhu.ba.yoshikoWrapper.gui; package de.hhu.ba.yoshikoWrapper.gui;
import static javax.swing.GroupLayout.DEFAULT_SIZE;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.GroupLayout;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.GroupLayout.Alignment;
import org.cytoscape.util.swing.BasicCollapsiblePanel;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ReductionRulesChooser extends ComfortCollapsiblePanel{ public class ReductionRulesChooser extends BasicCollapsiblePanel{
private final JCheckBox useCRule; private final JCheckBox useCRule;
private final JCheckBox useCCRule; private final JCheckBox useCCRule;
...@@ -48,8 +53,8 @@ public class ReductionRulesChooser extends ComfortCollapsiblePanel{ ...@@ -48,8 +53,8 @@ public class ReductionRulesChooser extends ComfortCollapsiblePanel{
public ReductionRulesChooser() { public ReductionRulesChooser() {
super(LocalizationManager.get("redRuleChooserTitle")); super(LocalizationManager.get("redRuleChooserTitle"));
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
//Initialize subcomponents //Initialize subcomponents
useCRule = new JCheckBox("Use Clique Rule"); useCRule = new JCheckBox("Use Clique Rule");
useCCRule = new JCheckBox("Use Critical-Clique Rule"); useCCRule = new JCheckBox("Use Critical-Clique Rule");
...@@ -60,7 +65,7 @@ public class ReductionRulesChooser extends ComfortCollapsiblePanel{ ...@@ -60,7 +65,7 @@ public class ReductionRulesChooser extends ComfortCollapsiblePanel{
multFactor = new DoubleInputField(1, Double.POSITIVE_INFINITY); multFactor = new DoubleInputField(1, Double.POSITIVE_INFINITY);
multFactor.setText("1.0"); multFactor.setText("1.0");
SNPanel = new JPanel(); SNPanel = new JPanel();
SNPanel.setLayout(new BoxLayout(SNPanel,BoxLayout.X_AXIS));
SwingUtil.addAll(SNPanel,new JLabel(LocalizationManager.get("multFactor")),multFactor); SwingUtil.addAll(SNPanel,new JLabel(LocalizationManager.get("multFactor")),multFactor);
useSNRule.setSelected(true); useSNRule.setSelected(true);
...@@ -92,6 +97,34 @@ public class ReductionRulesChooser extends ComfortCollapsiblePanel{ ...@@ -92,6 +97,34 @@ public class ReductionRulesChooser extends ComfortCollapsiblePanel{
useSNRule, useSNRule,
SNPanel SNPanel
); );
//Layout
GroupLayout layout = new GroupLayout(this.getContentPane());
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true)
.addComponent(useCRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useCCRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useACRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useHERule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(usePDRRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useSNRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(SNPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(useCRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useCCRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useACRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useHERule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(usePDRRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useSNRule, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(SNPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
);
this.getContentPane().setLayout(layout);
} }
......
...@@ -25,7 +25,7 @@ import java.awt.Component; ...@@ -25,7 +25,7 @@ import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.BoxLayout; import javax.swing.GroupLayout;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JLabel; import javax.swing.JLabel;
...@@ -51,6 +51,7 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ ...@@ -51,6 +51,7 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{
private final JTabbedPane solutionTabs; private final JTabbedPane solutionTabs;
private final JLabel costLabel; private final JLabel costLabel;
private final JButton destroyButton; private final JButton destroyButton;
private final JLabel optimalLabel;
private final YoshikoResult result; private final YoshikoResult result;
...@@ -58,14 +59,17 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ ...@@ -58,14 +59,17 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{
this.result = result; this.result = result;
setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
//Init subcomponents //Init subcomponents
solutionTabs = new JTabbedPane(); solutionTabs = new JTabbedPane();
for (YoshikoSolution s : result.solutions) { for (YoshikoSolution s : result.solutions) {
addSolutionTab(s); addSolutionTab(s);
} }
//TODO
optimalLabel = new JLabel("Optimal");
optimalLabel.setForeground(GraphicsLoader.yoshikoGreen);
costLabel = new JLabel(); costLabel = new JLabel();
setCost(result.editingCost); setCost(result.editingCost);
...@@ -79,7 +83,33 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ ...@@ -79,7 +83,33 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{
}); });
SwingUtil.addAll(this,costLabel,solutionTabs,destroyButton); SwingUtil.addAll(this,optimalLabel,costLabel,solutionTabs,destroyButton);
//Layout
GroupLayout layout = new GroupLayout(this);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(costLabel)
.addComponent(optimalLabel)
.addComponent(solutionTabs)
.addComponent(destroyButton)
);
layout.setHorizontalGroup(layout.createParallelGroup()
.addComponent(costLabel)
.addComponent(optimalLabel)
.addComponent(solutionTabs)
.addComponent(destroyButton)
);
this.setLayout(layout);
} }
public void deleteSolution() { public void deleteSolution() {
...@@ -129,7 +159,11 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ ...@@ -129,7 +159,11 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{
@Override @Override
public Icon getIcon() { public Icon getIcon() {
return GraphicsLoader.getLogo(16); return GraphicsLoader.getSolvedLogo(16);
}
public YoshikoResult getResult() {
return result;
} }
} }
...@@ -24,6 +24,7 @@ package de.hhu.ba.yoshikoWrapper.gui; ...@@ -24,6 +24,7 @@ package de.hhu.ba.yoshikoWrapper.gui;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JPanel; import javax.swing.JPanel;
...@@ -36,6 +37,7 @@ public class TimeLimitSetter extends JPanel{ ...@@ -36,6 +37,7 @@ public class TimeLimitSetter extends JPanel{
private IntegerInputField numberField; private IntegerInputField numberField;
public TimeLimitSetter() { public TimeLimitSetter() {
this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
checkBox = new JCheckBox(LocalizationManager.get("timeLimitILP")); checkBox = new JCheckBox(LocalizationManager.get("timeLimitILP"));
numberField = new IntegerInputField(); numberField = new IntegerInputField();
numberField.setText("60"); numberField.setText("60");
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
package de.hhu.ba.yoshikoWrapper.gui; package de.hhu.ba.yoshikoWrapper.gui;
import javax.swing.Box;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
...@@ -40,7 +41,8 @@ public class YoshikoHeader extends JPanel { ...@@ -40,7 +41,8 @@ public class YoshikoHeader extends JPanel {
logo = new JLabel(GraphicsLoader.getLogo(32)); logo = new JLabel(GraphicsLoader.getLogo(32));
text = new JLabel(GraphicsLoader.getText(32)); text = new JLabel(GraphicsLoader.getText(32));
SwingUtil.addAll(this,logo,text); this.add(logo);
this.add(Box.createHorizontalStrut(4));
this.add(text);
} }
} }
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
******************************************************************************/ ******************************************************************************/
/**This package contains all Swing extensions and components (frontend) /**This package contains all Swing extensions and components (frontend)
* *
*/ */
......
...@@ -48,7 +48,7 @@ editingCostPanel = Editing Costs ...@@ -48,7 +48,7 @@ editingCostPanel = Editing Costs
libraryPanel = Library libraryPanel = Library
defaultInsertion = Default insertion cost: defaultInsertion = Default insertion cost:
defaultDeletion = Default deletion cost: defaultDeletion = Default deletion cost:
switchLanguage = Plugin language: switchLanguage = Plugin language
icTooltip = This value is used to determine what the algorithm pays when inserting an edge. Existing mappings overwrite this value. A higher value means that the algorithm is less likely to insert edges in order to generate a cluster. icTooltip = This value is used to determine what the algorithm pays when inserting an edge. Existing mappings overwrite this value. A higher value means that the algorithm is less likely to insert edges in order to generate a cluster.
operationMode = Operation Mode operationMode = Operation Mode
run = Perform Algorithm run = Perform Algorithm
src/main/resources/graphics/YoshikoAlphaLogo.png

3.54 KiB

src/main/resources/graphics/YoshikoAlphaText.png

10.7 KiB

src/main/resources/graphics/YoshikoLogo.png

4.45 KiB

src/main/resources/graphics/YoshikoSolved.png

18.1 KiB

src/main/resources/graphics/YoshikoText.png

6.37 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment