Commit 986525a3 authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Minor clean-up

parent 8b49e01e
......@@ -52,7 +52,6 @@ import static org.cytoscape.work.ServiceProperties.COMMAND_NAMESPACE;
import de.hhu.ba.yoshikoWrapper.core.ConfigurationManager;
import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.core.YoshUtil;
import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader;
import de.hhu.ba.yoshikoWrapper.swing.components.MainPanel;
import de.hhu.ba.yoshikoWrapper.taskFactories.CommandTaskFactory;
......@@ -94,11 +93,11 @@ public class CyActivator extends AbstractCyActivator {
CyCore.rootNetworkManager = getService(context,CyRootNetworkManager.class);
//TODO: Not sure how to correctly infer arguments here
CyCore.renderingEngineFactory = getService(context,RenderingEngineFactory.class);
CyCore.cloneNetworkTaskFactory = getService(context,CloneNetworkTaskFactory.class);
//CyCore.cloneNetworkTaskFactory = getService(context,CloneNetworkTaskFactory.class);
CyCore.commandExecutorTaskFactory = getService(context,CommandExecutorTaskFactory.class);
//Store a reference to the Version for easier access
YoshUtil.version = context.getBundle().getVersion();
//YoshUtil.version = context.getBundle().getVersion();
//Set language according to settings -> Default to enUS
LocalizationManager.switchLanguage(cm.getProperties().getProperty("locale", "enUS"));
......
......@@ -55,7 +55,7 @@ public class CyCore {
public static CyApplicationManager cy;
public static DialogTaskManager dialogTaskManager;
public static ConfigurationManager cm;
public static BundleContext context;
//public static BundleContext context;
public static CyServiceRegistrar registrar;
public static CyNetworkViewFactory networkViewFactory;
public static CyNetworkFactory networkFactory;
......@@ -68,7 +68,7 @@ public class CyCore {
public static VisualMappingFunctionFactory continuousMappingFactory;
public static CyRootNetworkManager rootNetworkManager;
public static RenderingEngineFactory<CyNetwork> renderingEngineFactory;
public static CloneNetworkTaskFactory cloneNetworkTaskFactory;
//public static CloneNetworkTaskFactory cloneNetworkTaskFactory;
public static CommandExecutorTaskFactory commandExecutorTaskFactory;
//
......
/*******************************************************************************
* 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
......@@ -30,21 +30,21 @@ import java.util.ResourceBundle;
* This class should never be initialized
*/
public class LocalizationManager {
/**
* Default constructor, hidden to prevent invocation
*/
private LocalizationManager() {};
//Locales
static public final Locale usEnglish = new Locale("en","US");
static public final Locale german = new Locale("de","DE");
static public final Locale serbocroatianLatin = new Locale("hr","HR");
static public final Locale modernGreek = new Locale("el","EL");
//Map
static private final HashMap<String, Locale> locales;
static
{
......@@ -56,12 +56,12 @@ public class LocalizationManager {
}
static private ResourceBundle currentBundle;
static private Locale currentLocale = usEnglish;
private static void updateBundle() {
currentBundle = ResourceBundle.getBundle("YoshikoStrings",currentLocale);
CyCore.cm.getProperties().setProperty(
......@@ -69,22 +69,22 @@ public class LocalizationManager {
currentLocale.getLanguage()+currentLocale.getCountry()
);
}
//https://en.wikipedia.org/wiki/Regional_Indicator_Symbol -> Right now there are not enough fonts support this
public static String localeToUnicodeFlag(Locale locale) {
String countryCode = locale.getCountry();
int firstLetter = Character.codePointAt(countryCode, 0)-0x41+0x1F1E6;
int secondLetter = Character.codePointAt(countryCode, 1)-0x41+0x1F1E6;
return new String(Character.toChars(firstLetter))+new String(Character.toChars(secondLetter));
}
// public static String localeToUnicodeFlag(Locale locale) {
// String countryCode = locale.getCountry();
// int firstLetter = Character.codePointAt(countryCode, 0)-0x41+0x1F1E6;
// int secondLetter = Character.codePointAt(countryCode, 1)-0x41+0x1F1E6;
// return new String(Character.toChars(firstLetter))+new String(Character.toChars(secondLetter));
// }
//SETTER/GETTER methods
static public Collection<Locale> getLocales(){
return locales.values();
}
/**
* Returns the localized string corresponding to the given key.
* This is the main method that should be used for accessing strings and is preferable to any use of constant strings.
......@@ -97,7 +97,7 @@ public class LocalizationManager {
}
return currentBundle.getString(key);
}
static public void switchLanguage(Locale lcl) {
currentLocale = lcl;
updateBundle();
......
package de.hhu.ba.yoshikoWrapper.core;
import org.osgi.framework.Version;
public class YoshUtil {
public static Version version;
public static final String ABOUT_LINK = "https://spqrph.github.io/cytoscape-tutorials/presentations/yoshiko/yoshiko.html#/title";
}
......@@ -55,14 +55,14 @@ public class GraphAnalyzer {
return false;
}
public static boolean isDirected(CyNetwork net) {
for (CyEdge e: net.getEdgeList()) {
if (e.isDirected()) {
return true;
}
}
return false;
}
// public static boolean isDirected(CyNetwork net) {
// for (CyEdge e: net.getEdgeList()) {
// if (e.isDirected()) {
// return true;
// }
// }
// return false;
// }
/**
* Generates a fitting bitmask by choosing the reduction rules that appear to be the best choice based on current research
......
......@@ -4,16 +4,11 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import org.cytoscape.command.CommandExecutorTaskFactory;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.cytoUtil.CommandExecutor;
......
/*******************************************************************************
* 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
......@@ -31,21 +31,21 @@ import de.hhu.ba.yoshikoWrapper.swing.FormatHelper;
*/
@SuppressWarnings("serial")
public class IntegerInputField extends JFormattedTextField{
private final NumberFormatter formatter;
public IntegerInputField(int minValue, int maxValue) {
super();
formatter = FormatHelper.getIntegerFormatter(minValue,maxValue);
this.setFormatter(formatter);
this.setColumns(8);
}
// public IntegerInputField(int minValue, int maxValue) {
// super();
// formatter = FormatHelper.getIntegerFormatter(minValue,maxValue);
// this.setFormatter(formatter);
// this.setColumns(8);
// }
public IntegerInputField() {
super();
formatter = FormatHelper.getIntegerFormatter();
this.setFormatter(formatter);
this.setColumns(8);
this.setColumns(8);
}
public int getValueAsInt() {
......
......@@ -34,9 +34,7 @@ public class GetClustersTask implements ObservableTask {
}
@Override
public void cancel() {
}
public void cancel() {}
@SuppressWarnings("unchecked")
@Override
......
package de.hhu.ba.yoshikoWrapper.tasks;
import java.util.ArrayList;
import java.util.Collection;
import org.cytoscape.work.ObservableTask;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment