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

Annoy user a bit with hints

parent b436159e
No related branches found
No related tags found
No related merge requests found
......@@ -52,9 +52,11 @@ import org.osgi.framework.BundleContext;
import de.hhu.ba.yoshikoWrapper.core.ConfigurationManager;
import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.core.Hint;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.core.NetChangeListener;
import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader;
import de.hhu.ba.yoshikoWrapper.gui.HintManager;
import de.hhu.ba.yoshikoWrapper.gui.MainPanel;
public class CyActivator extends AbstractCyActivator {
......@@ -116,6 +118,8 @@ public class CyActivator extends AbstractCyActivator {
registerService(context,netChangeListener, SessionLoadedListener.class, new Properties());
registerService(context,netChangeListener, SetCurrentNetworkListener.class, new Properties());
HintManager.showMappingHint(Hint.FIRST_START);
}
}
......@@ -64,6 +64,10 @@ public class CyCore {
public static ApplyVisualStyleTaskFactory applyVisualStyleTaskFactory;
public static RenderingEngineFactory<CyNetwork> renderingEngineFactory;
public static CloneNetworkTaskFactory cloneNetworkTaskFactory;
//
//Convenience
public static String getConfig(String key) {
return cm.getProperties().getProperty(key);
}
}
package de.hhu.ba.yoshikoWrapper.core;
public enum Hint {
USE_MAPPING,
FIRST_START
}
package de.hhu.ba.yoshikoWrapper.gui;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
import org.slf4j.Logger;
import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.core.GraphicsLoader;
import de.hhu.ba.yoshikoWrapper.core.Hint;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger;
/**
* Bothers the user with useful hints
*
*/
public class HintManager {
private static Logger logger = YoshikoLogger.getInstance().getLogger();
private static final Runnable useMappingHint = new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(null, LocalizationManager.get("noMappingHint"), LocalizationManager.get("yoshikoHint"),JOptionPane.INFORMATION_MESSAGE);
}
};
private static final Runnable firstStart = new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(null, LocalizationManager.get("firstStart"), "Yoshiko Welcome", JOptionPane.INFORMATION_MESSAGE, GraphicsLoader.getLogo(40));
}
};
private final static Map<Hint,Runnable> hints;
static {
Map<Hint, Runnable> map = new HashMap<Hint,Runnable>();
map.put(Hint.USE_MAPPING, useMappingHint);
map.put(Hint.FIRST_START, firstStart);
hints = Collections.unmodifiableMap(map);
}
public static void showMappingHint(Hint hint) {
if (
CyCore.getConfig(
hint.toString()+"shown"
) == null
)
{
//Save property so we dont show this again
CyCore.cm.getProperties().setProperty(hint.toString()+ "shown", "1");
if (hints.get(hint) != null) {
hints.get(hint).run();
}
else {
logger.warn("Asked for a hint that doesnt exist with hint name: "+hint.toString());
}
}
}
}
......@@ -52,6 +52,7 @@ import org.cytoscape.work.TaskIterator;
import de.hhu.ba.yoshikoWrapper.core.AlgorithmTask;
import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.core.GraphicsLoader;
import de.hhu.ba.yoshikoWrapper.core.Hint;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.core.ParameterSet;
import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader;
......@@ -211,6 +212,12 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
//SWING BLACK MAGIC
if (YoshikoLoader.isLibraryLoaded()){
//User has mapped no values -> Annoy him
if (ecPanel.getWeightColumn() == null) {
HintManager.showMappingHint(Hint.USE_MAPPING);
}
AbstractTask yoshiko = new AlgorithmTask(
popupLevel,
CyCore.cy.getCurrentNetwork(),
......
......@@ -63,4 +63,7 @@ timeoutMarker = Timed Out
gap = Gap
currentGap = [ILP] Current Instance Gap:
disableMultiThreading = Disable Multithreading
yoshikoHint = Yoshiko Hint
getYoshiko = Get Yoshiko Library
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]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment