-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3932947
commit 617632b
Showing
12 changed files
with
372 additions
and
39 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
protege-editor-core/src/main/java/org/protege/editor/core/ui/view/CloseIcon.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,41 @@ | ||
package org.protege.editor.core.ui.view; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.awt.*; | ||
|
||
/** | ||
* Matthew Horridge | ||
* Stanford Center for Biomedical Informatics Research | ||
* 28 Nov 2016 | ||
*/ | ||
public class CloseIcon extends ViewBarIcon { | ||
|
||
private static final BasicStroke STROKE = new BasicStroke(2f); | ||
|
||
private static final CloseIcon ICON = new CloseIcon(); | ||
|
||
private CloseIcon() { | ||
} | ||
|
||
/** | ||
* Gets the Close View icon. | ||
* @return The Close View icon. | ||
*/ | ||
@Nonnull | ||
public static CloseIcon get() { | ||
return ICON; | ||
} | ||
|
||
@Override | ||
public void paintIcon(Component c, Graphics g, int x, int y) { | ||
Graphics2D g2 = (Graphics2D) g.create(); | ||
g2.setColor(Color.WHITE); | ||
int width = getIconWidth(); | ||
int height = getIconHeight(); | ||
g2.drawRect(1, 1, width - 2, height - 2); | ||
g2.setStroke(STROKE); | ||
g2.drawLine(4, 4, width - 4, height - 4); | ||
g2.drawLine(4, height - 4, width - 4, 4); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
protege-editor-core/src/main/java/org/protege/editor/core/ui/view/FloatIcon.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,36 @@ | ||
package org.protege.editor.core.ui.view; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.awt.*; | ||
|
||
/** | ||
* Matthew Horridge | ||
* Stanford Center for Biomedical Informatics Research | ||
* 28 Nov 2016 | ||
*/ | ||
public class FloatIcon extends ViewBarIcon { | ||
|
||
public static final FloatIcon ICON = new FloatIcon(); | ||
|
||
private FloatIcon() { | ||
} | ||
|
||
/** | ||
* Gets the Float View Icon. | ||
* @return The Float View Icon. | ||
*/ | ||
@Nonnull | ||
public static FloatIcon get() { | ||
return ICON; | ||
} | ||
|
||
@Override | ||
public void paintIcon(Component c, Graphics g, int x, int y) { | ||
Graphics2D g2 = (Graphics2D) g.create(); | ||
g2.setColor(Color.WHITE); | ||
int width = getIconWidth(); | ||
int height = getIconHeight(); | ||
g2.drawRect(1, 1, width - 2, height - 2); | ||
g2.fillRect(3, 3, width - 6, height - 6); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
protege-editor-core/src/main/java/org/protege/editor/core/ui/view/HelpIcon.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,56 @@ | ||
package org.protege.editor.core.ui.view; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.geom.Rectangle2D; | ||
|
||
import static java.awt.RenderingHints.KEY_ANTIALIASING; | ||
import static java.awt.RenderingHints.VALUE_ANTIALIAS_ON; | ||
|
||
/** | ||
* Matthew Horridge | ||
* Stanford Center for Biomedical Informatics Research | ||
* 28 Nov 2016 | ||
*/ | ||
public class HelpIcon extends ViewBarIcon { | ||
|
||
|
||
private static final String HELP_STRING = "?"; | ||
|
||
private static final HelpIcon ICON = new HelpIcon(); | ||
|
||
private final Font font; | ||
|
||
public HelpIcon() { | ||
this.font = new Font("Verdana", Font.BOLD, 9); | ||
} | ||
|
||
public static HelpIcon get() { | ||
return ICON; | ||
} | ||
|
||
|
||
@Override | ||
public void paintIcon(Component c, Graphics graphics, int x, int y) { | ||
Graphics2D g2 = (Graphics2D) graphics.create(); | ||
g2.setColor(Color.WHITE); | ||
int width = getIconWidth(); | ||
int height = getIconHeight(); | ||
g2.drawRect(1, 1, width - 2, height - 2); | ||
|
||
g2.setFont(font); | ||
g2.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON); | ||
|
||
FontMetrics fm = g2.getFontMetrics(); | ||
Rectangle2D bounds = fm.getStringBounds(HELP_STRING, g2); | ||
|
||
float xPos = (float) ((width - bounds.getWidth()) / 2); | ||
int ascent = fm.getAscent(); | ||
int descent = fm.getDescent(); | ||
float yPos = ((height + 1) / 2 - (ascent + descent) / 2 + ascent - 1); | ||
g2.drawString(HELP_STRING, | ||
xPos, | ||
yPos); | ||
g2.translate(-x, -y); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
protege-editor-core/src/main/java/org/protege/editor/core/ui/view/HorizontalMoreIcon.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.protege.editor.core.ui.view; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
import static java.awt.Color.WHITE; | ||
import static java.awt.RenderingHints.KEY_ANTIALIASING; | ||
import static java.awt.RenderingHints.VALUE_ANTIALIAS_ON; | ||
|
||
/** | ||
* Matthew Horridge | ||
* Stanford Center for Biomedical Informatics Research | ||
* 28 Nov 2016 | ||
*/ | ||
public class HorizontalMoreIcon implements Icon { | ||
|
||
public static final int DOT_SIZE = 4; | ||
|
||
private final int WIDTH = 18; | ||
|
||
private final int HEIGHT = 8; | ||
|
||
@Override | ||
public void paintIcon(Component c, Graphics g, int x, int y) { | ||
Graphics2D g2 = (Graphics2D) g.create(); | ||
g2.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON); | ||
g2.setColor(WHITE); | ||
g2.translate(0, HEIGHT / 2 - DOT_SIZE / 2); | ||
g2.fillOval(0, 0, DOT_SIZE, DOT_SIZE); | ||
g2.translate(5, 0); | ||
g2.fillOval(0, 0, DOT_SIZE, DOT_SIZE); | ||
g2.translate(5, 0); | ||
g2.fillOval(0, 0, DOT_SIZE, DOT_SIZE); | ||
} | ||
|
||
@Override | ||
public int getIconWidth() { | ||
return WIDTH; | ||
} | ||
|
||
@Override | ||
public int getIconHeight() { | ||
return HEIGHT; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
protege-editor-core/src/main/java/org/protege/editor/core/ui/view/SplitHorizontallyIcon.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,38 @@ | ||
package org.protege.editor.core.ui.view; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.awt.*; | ||
|
||
/** | ||
* Matthew Horridge | ||
* Stanford Center for Biomedical Informatics Research | ||
* 28 Nov 2016 | ||
*/ | ||
public class SplitHorizontallyIcon extends ViewBarIcon { | ||
|
||
private static final SplitHorizontallyIcon ICON = new SplitHorizontallyIcon(); | ||
|
||
private SplitHorizontallyIcon() { | ||
} | ||
|
||
/** | ||
* Gets the Split Horizontall Icon. | ||
* @return The Split Horizontally Icon. | ||
*/ | ||
@Nonnull | ||
public static SplitHorizontallyIcon get() { | ||
return ICON; | ||
} | ||
|
||
@Override | ||
public void paintIcon(Component c, Graphics g, int x, int y) { | ||
Graphics2D g2 = (Graphics2D) g.create(); | ||
g2.setColor(Color.WHITE); | ||
int width = getIconWidth(); | ||
int height = getIconHeight(); | ||
g2.drawRect(1, 1, width - 2, height - 2); | ||
g2.drawLine(1, height / 2 - 1, width - 1, height / 2 - 1); | ||
g2.drawLine(1, height / 2 , width - 1, height / 2 ); | ||
g2.drawLine(1, height / 2 + 1, width - 1, height / 2 + 1); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
protege-editor-core/src/main/java/org/protege/editor/core/ui/view/SplitVerticallyIcon.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,40 @@ | ||
package org.protege.editor.core.ui.view; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.awt.*; | ||
|
||
/** | ||
* Matthew Horridge | ||
* Stanford Center for Biomedical Informatics Research | ||
* 28 Nov 2016 | ||
*/ | ||
public class SplitVerticallyIcon extends ViewBarIcon { | ||
|
||
private static final SplitVerticallyIcon ICON = new SplitVerticallyIcon(); | ||
|
||
private SplitVerticallyIcon() { | ||
} | ||
|
||
/** | ||
* Gets the Split Vertically Icon. | ||
* @return The Split Vertically Icon. | ||
*/ | ||
@Nonnull | ||
public static SplitVerticallyIcon get() { | ||
return ICON; | ||
} | ||
|
||
@Override | ||
public void paintIcon(Component c, Graphics g, int x, int y) { | ||
Graphics2D g2 = (Graphics2D) g.create(); | ||
g2.setColor(Color.WHITE); | ||
int width = getIconWidth(); | ||
int height = getIconHeight(); | ||
g2.drawRect(1, 1, width - 2, height - 2); | ||
g2.drawLine(width / 2 - 1, 1, width / 2 - 1, height - 1); | ||
g2.drawLine(width / 2, 1, width / 2, height - 1); | ||
g2.drawLine(width / 2 + 1, 1, width / 2 + 1, height - 1); | ||
} | ||
|
||
|
||
} |
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
Oops, something went wrong.