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

Added "About" panel and various small fixes

Bumped up version number to 0.1
parent a3c19b48
Branches
Tags
No related merge requests found
Showing
with 139 additions and 25 deletions
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<groupId>de.hhu.ba</groupId> <groupId>de.hhu.ba</groupId>
<artifactId>yoshikoWrapper</artifactId> <artifactId>yoshikoWrapper</artifactId>
<version>0.0.3</version> <version>0.1.0</version>
<name>YoshikoWrapper</name> <name>YoshikoWrapper</name>
......
...@@ -55,6 +55,7 @@ import de.hhu.ba.yoshikoWrapper.core.CyCore; ...@@ -55,6 +55,7 @@ import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.core.Hint; import de.hhu.ba.yoshikoWrapper.core.Hint;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.core.NetChangeListener; import de.hhu.ba.yoshikoWrapper.core.NetChangeListener;
import de.hhu.ba.yoshikoWrapper.core.YoshUtil;
import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader;
import de.hhu.ba.yoshikoWrapper.gui.HintManager; import de.hhu.ba.yoshikoWrapper.gui.HintManager;
import de.hhu.ba.yoshikoWrapper.gui.MainPanel; import de.hhu.ba.yoshikoWrapper.gui.MainPanel;
...@@ -92,6 +93,9 @@ public class CyActivator extends AbstractCyActivator { ...@@ -92,6 +93,9 @@ public class CyActivator extends AbstractCyActivator {
CyCore.renderingEngineFactory = getService(context,RenderingEngineFactory.class); CyCore.renderingEngineFactory = getService(context,RenderingEngineFactory.class);
CyCore.cloneNetworkTaskFactory = getService(context,CloneNetworkTaskFactory.class); CyCore.cloneNetworkTaskFactory = getService(context,CloneNetworkTaskFactory.class);
//Store a reference to the Version
YoshUtil.version = context.getBundle().getVersion();
//Set language according to settings //Set language according to settings
LocalizationManager.switchLanguage(cm.getProperties().getProperty("locale", "enUS")); LocalizationManager.switchLanguage(cm.getProperties().getProperty("locale", "enUS"));
......
...@@ -152,7 +152,7 @@ public class AlgorithmTask extends AbstractTask { ...@@ -152,7 +152,7 @@ public class AlgorithmTask extends AbstractTask {
@Override @Override
public void updateGap(double gap) { public void updateGap(double gap) {
taskMonitor.setStatusMessage(LocalizationManager.get("currentGap")+": "+Util.twoDecimals.format(gap)+"%"); taskMonitor.setStatusMessage(LocalizationManager.get("currentGap")+": "+YoshUtil.twoDecimals.format(gap)+"%");
} }
} }
...@@ -161,8 +161,14 @@ public class AlgorithmTask extends AbstractTask { ...@@ -161,8 +161,14 @@ public class AlgorithmTask extends AbstractTask {
result = ca.run(); result = ca.run();
taskMonitor.setProgress(0.9); taskMonitor.setProgress(0.9);
if (result == null) {
throw new Exception(LocalizationManager.get("noFeasible"));
}
long numberOfSolutions = result.getNumberOfSolutions(); long numberOfSolutions = result.getNumberOfSolutions();
if (numberOfSolutions == 0) {
throw new Exception(LocalizationManager.get("noFeasible"));
}
taskMonitor.setStatusMessage("Found: "+numberOfSolutions+" solutions!"); //TODO localize taskMonitor.setStatusMessage("Found: "+numberOfSolutions+" solutions!"); //TODO localize
YoshikoResult yoshikoResult = new YoshikoResult(); YoshikoResult yoshikoResult = new YoshikoResult();
......
...@@ -35,6 +35,7 @@ public class GraphicsLoader { ...@@ -35,6 +35,7 @@ public class GraphicsLoader {
private static BufferedImage yoshikoLogo; private static BufferedImage yoshikoLogo;
private static BufferedImage yoshikoLogo_solved; private static BufferedImage yoshikoLogo_solved;
private static BufferedImage yoshikoText; private static BufferedImage yoshikoText;
private static BufferedImage infoIcon;
public final static Color yoshikoGreen = new Color(0,128,0); public final static Color yoshikoGreen = new Color(0,128,0);
...@@ -57,6 +58,19 @@ public class GraphicsLoader { ...@@ -57,6 +58,19 @@ public class GraphicsLoader {
return new ImageIcon(flags.get(lcl).getScaledInstance(width, height, Image.SCALE_SMOOTH)); return new ImageIcon(flags.get(lcl).getScaledInstance(width, height, Image.SCALE_SMOOTH));
} }
public static ImageIcon getInfoIcon(int size) {
if (infoIcon == null) {
try {
infoIcon = ImageIO.read(
classLoader.getResource("graphics/Info.png")
);
} catch (IOException e) {
e.printStackTrace();
}
}
return new ImageIcon(infoIcon.getScaledInstance(size, size, Image.SCALE_SMOOTH));
}
public static ImageIcon getLogo(int size) { public static ImageIcon getLogo(int size) {
if (yoshikoLogo == null) { if (yoshikoLogo == null) {
try { try {
......
...@@ -2,6 +2,9 @@ package de.hhu.ba.yoshikoWrapper.core; ...@@ -2,6 +2,9 @@ package de.hhu.ba.yoshikoWrapper.core;
import java.text.DecimalFormat; import java.text.DecimalFormat;
public class Util { import org.osgi.framework.Version;
public class YoshUtil {
final static DecimalFormat twoDecimals =new DecimalFormat("0.00"); final static DecimalFormat twoDecimals =new DecimalFormat("0.00");
public static Version version;
} }
package de.hhu.ba.yoshikoWrapper.gui;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.core.YoshUtil;
/**Factory for a simple About-Dialog that provides some basic info about the software
*
*/
public class AboutDialog{
private static JPanel getDialogPanel() {
JPanel ret = new JPanel();
final YoshikoHeader header;
final JLabel version;
final JLabel text;
header = new YoshikoHeader();
version = new JLabel(LocalizationManager.get("wrapperVersion")+": "+YoshUtil.version);
text = new JLabel(LocalizationManager.get("about"));
SwingUtil.addAll(ret, header,version,text);
GroupLayout layout = new GroupLayout(ret);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER)
.addComponent(header)
.addComponent(version)
.addComponent(text)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(header)
.addComponent(version)
.addComponent(text)
);
ret.setLayout(layout);
return ret;
}
public static void showDialog() {
JOptionPane.showMessageDialog(
null,
getDialogPanel(),
LocalizationManager.get("aboutTitle"),
JOptionPane.PLAIN_MESSAGE);
}
}
...@@ -42,6 +42,7 @@ import javax.swing.JComponent; ...@@ -42,6 +42,7 @@ import javax.swing.JComponent;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.LayoutStyle;
import org.cytoscape.application.swing.CytoPanelComponent; import org.cytoscape.application.swing.CytoPanelComponent;
import org.cytoscape.application.swing.CytoPanelName; import org.cytoscape.application.swing.CytoPanelName;
...@@ -67,6 +68,8 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -67,6 +68,8 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
private final YoshikoHeader header; private final YoshikoHeader header;
private final JButton about;
private final JCheckBox showAdvancedOptions; private final JCheckBox showAdvancedOptions;
private final ArrayList<JComponent> advancedOptions; private final ArrayList<JComponent> advancedOptions;
...@@ -93,6 +96,16 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -93,6 +96,16 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
//Initialize Swing components //Initialize Swing components
header = new YoshikoHeader(); header = new YoshikoHeader();
about = new JButton(GraphicsLoader.getInfoIcon(16));
about.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
AboutDialog.showDialog();
}
});
showAdvancedOptions = new JCheckBox(LocalizationManager.get("showAdvanced")); showAdvancedOptions = new JCheckBox(LocalizationManager.get("showAdvanced"));
showAdvancedOptions.addActionListener(toggleAdvancedOptionsListener); showAdvancedOptions.addActionListener(toggleAdvancedOptionsListener);
...@@ -123,6 +136,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -123,6 +136,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
//Add components to main panel //Add components to main panel
SwingUtil.addAll(this, SwingUtil.addAll(this,
header, header,
about,
showAdvancedOptions, showAdvancedOptions,
langPanel, langPanel,
libraryPanel, libraryPanel,
...@@ -145,28 +159,40 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -145,28 +159,40 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
//Layout //Layout
GroupLayout layout = new GroupLayout(this); GroupLayout layout = new GroupLayout(this);
layout.setAutoCreateGaps(true); layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true); layout.setAutoCreateContainerGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true) layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true)
.addComponent(header,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) .addGroup(layout.createSequentialGroup()
.addComponent(showAdvancedOptions,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) .addComponent(header,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(langPanel,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) //"SPRING" Functionality ; eats all the space that is available
.addComponent(libraryPanel,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ecPanelWrapper,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) .addComponent(about,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(reductionWrapper,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) )
.addComponent(opWrapper,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) .addGap(4)
.addComponent(runButton,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) .addComponent(showAdvancedOptions,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(langPanel,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(libraryPanel,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(ecPanelWrapper,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(reductionWrapper,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(opWrapper,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(runButton,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE)
); );
layout.setVerticalGroup(layout.createSequentialGroup() layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(header,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE) .addGroup(layout.createParallelGroup()
.addComponent(showAdvancedOptions,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE) .addComponent(header,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(langPanel,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE) .addComponent(about,Alignment.TRAILING,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(libraryPanel,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE) )
.addComponent(ecPanelWrapper,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE) .addGap(4)
.addComponent(reductionWrapper,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE) .addComponent(showAdvancedOptions,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(opWrapper,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE) .addComponent(langPanel,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(runButton,PREFERRED_SIZE,PREFERRED_SIZE,PREFERRED_SIZE) .addComponent(libraryPanel,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(ecPanelWrapper,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(reductionWrapper,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(opWrapper,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(runButton,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE)
); );
this.setLayout(layout); this.setLayout(layout);
......
...@@ -21,13 +21,14 @@ ...@@ -21,13 +21,14 @@
******************************************************************************/ ******************************************************************************/
package de.hhu.ba.yoshikoWrapper.gui; package de.hhu.ba.yoshikoWrapper.gui;
import java.awt.Container;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel;
public class SwingUtil { public class SwingUtil {
static void addAll(JPanel panel, JComponent ... components) { static void addAll(Container container, JComponent ... components) {
for (JComponent c: components) { for (JComponent c: components) {
panel.add(c); container.add(c);
} }
} }
} }
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
resultsPanelTitle = Yoshiko Results resultsPanelTitle = Yoshiko Results
yoshVersion = Yoshiko Version yoshVersion = Yoshiko Version
wrapperVersion = Yoshiko Plugin for Cytoscape Version
resolveLibPath = Resolve Yoshiko Library Path resolveLibPath = Resolve Yoshiko Library Path
yoshTask = Performing Yoshiko Algorithm yoshTask = Performing Yoshiko Algorithm
solution = Solution solution = Solution
...@@ -65,6 +66,9 @@ gap = Gap ...@@ -65,6 +66,9 @@ gap = Gap
currentGap = [ILP] Current Instance Gap currentGap = [ILP] Current Instance Gap
disableMultiThreading = Disable Multithreading disableMultiThreading = Disable Multithreading
yoshikoHint = Yoshiko Hint yoshikoHint = Yoshiko Hint
aboutTitle = Yoshiko Plugin Info
getYoshiko = Get Yoshiko Library getYoshiko = Get Yoshiko Library
noFeasible = No feasible solution found!
noMappingHint = You haven't mapped the cost value to a column in your edge table.\nYoshiko runs significantly faster and generates better solutions if you map values. noMappingHint = You haven't mapped the cost value to a column in your edge table.\nYoshiko runs significantly faster and generates better solutions if you map values.
firstStart = Thanks for using the Yoshiko Clustering Tool!\nIt appears, that this is your first time using this tool.\nIf you want an in-depth explanation of the algorithm please refer to: [INSERT COOL LINK HERE] firstStart = Thanks for using the Yoshiko Clustering Tool!\nIt appears, that this is your first time using this tool.\nIf you want an in-depth explanation of the algorithm please refer to: [INSERT COOL LINK HERE]
about = INSERT SOME AMAZING INFO ABOUT THIS APPLICATION,\n THE AUTHOR AND WHERE TO FIND MORE INFO HERE\n <a href=\"www.hhu.de\" >LINK</a>
\ No newline at end of file
src/main/resources/graphics/Info.png

4.02 KiB

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