-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from cytoscape/feature/new-app-logo
New app logo and adds the app icon to Cytoscape's toolbar.
- Loading branch information
Showing
7 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/nrnb/gsoc/enrichment/actions/ShowAppTableAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.nrnb.gsoc.enrichment.actions; | ||
|
||
import static org.nrnb.gsoc.enrichment.utils.IconUtil.APP_ICON_COLORS; | ||
import static org.nrnb.gsoc.enrichment.utils.IconUtil.APP_ICON_LAYERS; | ||
|
||
import java.awt.event.ActionEvent; | ||
|
||
import org.cytoscape.application.swing.AbstractCyAction; | ||
import org.cytoscape.application.swing.CySwingApplication; | ||
import org.cytoscape.application.swing.CytoPanelName; | ||
import org.cytoscape.application.swing.CytoPanelState; | ||
import org.cytoscape.service.util.CyServiceRegistrar; | ||
import org.cytoscape.util.swing.TextIcon; | ||
import org.nrnb.gsoc.enrichment.utils.IconUtil; | ||
|
||
@SuppressWarnings("serial") | ||
public class ShowAppTableAction extends AbstractCyAction { | ||
|
||
private final CyServiceRegistrar serviceRegistrar; | ||
|
||
public ShowAppTableAction(CyServiceRegistrar serviceRegistrar) { | ||
super("Enrichment Table"); | ||
this.serviceRegistrar = serviceRegistrar; | ||
|
||
inToolBar = true; | ||
insertToolbarSeparatorBefore = true; | ||
toolbarGravity = 11.0f; | ||
|
||
var iconFont = IconUtil.getIconFont(30.0f); | ||
var icon = new TextIcon(APP_ICON_LAYERS, iconFont, APP_ICON_COLORS, 32, 32, 1); | ||
|
||
putValue(SHORT_DESCRIPTION, "Show Enrichment Table"); // Tooltip's short description | ||
putValue(LARGE_ICON_KEY, icon); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
var swingApp = serviceRegistrar.getService(CySwingApplication.class); | ||
var cytoPanel = swingApp.getCytoPanel(CytoPanelName.SOUTH); | ||
|
||
if (cytoPanel.getState() == CytoPanelState.HIDE) | ||
cytoPanel.setState(CytoPanelState.DOCK); | ||
|
||
cytoPanel.setSelectedIndex(cytoPanel.indexOfComponent("org.nrnb.gsoc.enrichment")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/org/nrnb/gsoc/enrichment/utils/IconUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.nrnb.gsoc.enrichment.utils; | ||
|
||
import java.awt.Color; | ||
import java.awt.Font; | ||
import java.awt.FontFormatException; | ||
import java.io.IOException; | ||
|
||
public abstract class IconUtil { | ||
|
||
public static final String APP_LOGO_MONO = "a"; | ||
public static final String APP_LOGO_LAYER_1 = "b"; | ||
public static final String APP_LOGO_LAYER_2 = "c"; | ||
public static final String APP_LOGO_LAYER_3 = "d"; | ||
|
||
public static final String[] APP_ICON_LAYERS = new String[] { | ||
APP_LOGO_LAYER_1, | ||
APP_LOGO_LAYER_2, | ||
APP_LOGO_LAYER_3 | ||
}; | ||
public static final Color[] APP_ICON_COLORS = new Color[] { | ||
new Color(5, 62, 96), | ||
Color.WHITE, | ||
new Color(56, 120, 158) | ||
}; | ||
|
||
private static Font iconFont; | ||
|
||
static { | ||
try { | ||
iconFont = Font.createFont(Font.TRUETYPE_FONT, IconUtil.class.getResourceAsStream("/fonts/enrichmenttable.ttf")); | ||
} catch (FontFormatException e) { | ||
throw new RuntimeException(); | ||
} catch (IOException e) { | ||
throw new RuntimeException(); | ||
} | ||
} | ||
|
||
public static Font getIconFont(float size) { | ||
return iconFont.deriveFont(size); | ||
} | ||
|
||
private IconUtil() { | ||
// ... | ||
} | ||
} |
Binary file not shown.
Binary file not shown.