Revision: 19223
http://sourceforge.net/p/gate/code/19223
Author: markagreenwood
Date: 2016-04-10 17:07:01 +0000 (Sun, 10 Apr 2016)
Log Message:
-----------
a simple dialog for loading Mavenized plugins so I don't keep having to do it
via the groovy console
Modified Paths:
--------------
gate/branches/sawdust2/src/main/gate/gui/MainFrame.java
Added Paths:
-----------
gate/branches/sawdust2/src/main/gate/resources/img/svg/Maven.svg
gate/branches/sawdust2/src/main/gate/resources/img/svg/MavenIcon.java
Modified: gate/branches/sawdust2/src/main/gate/gui/MainFrame.java
===================================================================
--- gate/branches/sawdust2/src/main/gate/gui/MainFrame.java 2016-04-10
10:07:58 UTC (rev 19222)
+++ gate/branches/sawdust2/src/main/gate/gui/MainFrame.java 2016-04-10
17:07:01 UTC (rev 19223)
@@ -46,8 +46,10 @@
import gate.resources.img.svg.AvailableIcon;
import gate.resources.img.svg.GATEIcon;
import gate.resources.img.svg.GATEVersionIcon;
+import gate.resources.img.svg.MavenIcon;
import gate.resources.img.svg.ReadyMadeIcon;
import gate.swing.JMenuButton;
+import gate.swing.SpringUtilities;
import gate.swing.XJFileChooser;
import gate.swing.XJMenu;
import gate.swing.XJMenuItem;
@@ -170,6 +172,7 @@
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
import javax.swing.OverlayLayout;
+import javax.swing.SpringLayout;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
@@ -1108,6 +1111,8 @@
new JCheckBoxMenuItem(new VerboseModeCorpusEvalToolAction());
corpusEvalMenu.add(verboseModeItem);
+
+
toolsMenu.staticItemsAdded();
menuBar.add(toolsMenu);
@@ -1240,6 +1245,47 @@
button.setText("");
toolbar.add(button);
toolbar.addSeparator();
+
+ button = new JButton(new AbstractAction(null,new MavenIcon(24,24)) {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // TODO Auto-generated method stub
+ JPanel panel = new JPanel(new SpringLayout());
+
+ JTextField txtGroup = new JTextField("uk.ac.gate.plugins",20);
+ JTextField txtArtifact = new JTextField(20);
+ JTextField txtVersion = new JTextField("9.0-SNAPSHOT",20);
+
+ panel.add(new JLabel("Group:"));
+ panel.add(txtGroup);
+ panel.add(new JLabel("Artifact:"));
+ panel.add(txtArtifact);
+ panel.add(new JLabel("Version:"));
+ panel.add(txtVersion);
+
+ SpringUtilities.makeCompactGrid(panel,
+ 3, 2, //rows, cols
+ 5, 5, //initialX, initialY
+ 5, 5);//xPad, yPad
+
+ if(JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(
+ MainFrame.this, panel, "Load Mavenized Plugin",
+ JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
+ new MavenIcon(24, 24))) return;
+
+ try {
+ Gate.getCreoleRegister().registerPlugin(new
Plugin.Maven(txtGroup.getText().trim(), txtArtifact.getText().trim(),
txtVersion.getText().trim()));
+ } catch(GateException e1) {
+ e1.printStackTrace();
+ }
+
+ }
+
+ });
+ toolbar.add(button);
+
+ toolbar.addSeparator();
button = new JButton(new NewAnnotDiffAction());
button.setToolTipText(button.getText());
button.setText("");
Added: gate/branches/sawdust2/src/main/gate/resources/img/svg/Maven.svg
===================================================================
--- gate/branches/sawdust2/src/main/gate/resources/img/svg/Maven.svg
(rev 0)
+++ gate/branches/sawdust2/src/main/gate/resources/img/svg/Maven.svg
2016-04-10 17:07:01 UTC (rev 19223)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ viewBox="0 0 64 63.999999"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r"
+ sodipodi:docname="Maven.svg"
+ width="64"
+ height="64">
+ <metadata
+ id="metadata16">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs14" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2048"
+ inkscape:window-height="1128"
+ id="namedview12"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:zoom="2.7792208"
+ inkscape:cx="71.884834"
+ inkscape:cy="17.931688"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4157"
+
style="font-style:oblique;font-weight:bold;font-size:medium;font-family:Verdana;word-spacing:0;fill:#ff6804"
+ d="m 40.1875,34.125 q -3.75,0.3125 -7.03125,0.742187 -3.28125,0.429688
-5.58594,1.25 -2.38281,0.859375 -3.63281,2.421875 -1.25,1.5625 -1.25,4.140625
0,2.265625 1.64062,3.203125 1.67969,0.898438 4.84375,0.898438 2.07031,0
4.41406,-0.9375 2.38282,-0.976563 4.45313,-2.460938 L 40.1875,34.125 Z M
36.47656,50.179687 Q 35.14843,51.039062 33.27343,52.25 31.39843,53.460937
29.79687,54.164062 27.60937,55.0625 25.69531,55.53125 23.78125,56 20.38281,56
14.91406,56 11.4375,52.953125 8,49.867187 8,44.945312 8,39.75 10.46093,36.15625
q 2.46094,-3.632813 7.30469,-5.78125 4.53125,-2.03125 10.78125,-2.929688
6.28906,-0.898437 13.59375,-1.328125 0.0391,-0.234375 0.15625,-0.742187
0.11719,-0.546875 0.11719,-1.210938 0,-2.773436 -2.57813,-3.867186
-2.57812,-1.132813 -7.69531,-1.132813 -3.47656,0 -7.69531,1.171875
-4.17969,1.171875 -6.28906,1.953124 l -1.28907,0 2.07032,-10.390625 q
2.46093,-0.625 7.61718,-1.40625 5.15625,-0.78125 10.27344,-0.78125 10.3125,0
15.11719,2.695314 4.84375,2.695311 4.843
75,8.359375 0,0.78125 -0.15625,2.031249 -0.11719,1.25 -0.35156,2.1875 l
-6.875,29.84375 -13.98438,0 1.05469,-4.648438 z" />
+</svg>
Added: gate/branches/sawdust2/src/main/gate/resources/img/svg/MavenIcon.java
===================================================================
--- gate/branches/sawdust2/src/main/gate/resources/img/svg/MavenIcon.java
(rev 0)
+++ gate/branches/sawdust2/src/main/gate/resources/img/svg/MavenIcon.java
2016-04-10 17:07:01 UTC (rev 19223)
@@ -0,0 +1,246 @@
+package gate.resources.img.svg;
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import javax.imageio.ImageIO;
+
+/**
+ * This class has been automatically generated using <a
+ *
href="http://englishjavadrinker.blogspot.com/search/label/SVGRoundTrip">SVGRoundTrip</a>.
+ */
+@SuppressWarnings("unused")
+public class MavenIcon implements
+ javax.swing.Icon {
+ /**
+ * Paints the transcoded SVG image on the specified graphics context.
You
+ * can install a custom transformation on the graphics context to scale
the
+ * image.
+ *
+ * @param g
+ * Graphics context.
+ */
+ public static void paint(Graphics2D g) {
+ Shape shape = null;
+ Paint paint = null;
+ Stroke stroke = null;
+ Area clip = null;
+
+ float origAlpha = 1.0f;
+ Composite origComposite = g.getComposite();
+ if (origComposite instanceof AlphaComposite) {
+ AlphaComposite origAlphaComposite =
+ (AlphaComposite)origComposite;
+ if (origAlphaComposite.getRule() == AlphaComposite.SRC_OVER) {
+ origAlpha = origAlphaComposite.getAlpha();
+ }
+ }
+
+ Shape clip_ = g.getClip();
+AffineTransform defaultTransform_ = g.getTransform();
+// is CompositeGraphicsNode
+float alpha__0 = origAlpha;
+origAlpha = origAlpha * 1.0f;
+g.setComposite(AlphaComposite.getInstance(3, origAlpha));
+Shape clip__0 = g.getClip();
+AffineTransform defaultTransform__0 = g.getTransform();
+g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, -0.0f, -0.0f));
+clip = new Area(g.getClip());
+clip.intersect(new Area(new Rectangle2D.Double(0.0,0.0,64.0,64.0)));
+g.setClip(clip);
+// _0 is CompositeGraphicsNode
+float alpha__0_0 = origAlpha;
+origAlpha = origAlpha * 1.0f;
+g.setComposite(AlphaComposite.getInstance(3, origAlpha));
+Shape clip__0_0 = g.getClip();
+AffineTransform defaultTransform__0_0 = g.getTransform();
+g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
+// _0_0 is ShapeNode
+paint = new Color(255, 104, 4, 255);
+shape = new GeneralPath();
+((GeneralPath)shape).moveTo(40.1875, 34.125);
+((GeneralPath)shape).quadTo(36.4375, 34.4375, 33.15625, 34.867188);
+((GeneralPath)shape).quadTo(29.875, 35.296875, 27.57031, 36.117188);
+((GeneralPath)shape).quadTo(25.1875, 36.976562, 23.9375, 38.539062);
+((GeneralPath)shape).quadTo(22.6875, 40.101562, 22.6875, 42.679688);
+((GeneralPath)shape).quadTo(22.6875, 44.945312, 24.32812, 45.882812);
+((GeneralPath)shape).quadTo(26.007809, 46.78125, 29.17187, 46.78125);
+((GeneralPath)shape).quadTo(31.24218, 46.78125, 33.58593, 45.84375);
+((GeneralPath)shape).quadTo(35.96875, 44.867188, 38.03906, 43.382812);
+((GeneralPath)shape).lineTo(40.1875, 34.125);
+((GeneralPath)shape).closePath();
+((GeneralPath)shape).moveTo(36.47656, 50.179688);
+((GeneralPath)shape).quadTo(35.14843, 51.039062, 33.27343, 52.25);
+((GeneralPath)shape).quadTo(31.39843, 53.460938, 29.79687, 54.164062);
+((GeneralPath)shape).quadTo(27.60937, 55.0625, 25.69531, 55.53125);
+((GeneralPath)shape).quadTo(23.78125, 56.0, 20.38281, 56.0);
+((GeneralPath)shape).quadTo(14.91406, 56.0, 11.4375, 52.953125);
+((GeneralPath)shape).quadTo(8.0, 49.867188, 8.0, 44.945312);
+((GeneralPath)shape).quadTo(8.0, 39.75, 10.46093, 36.15625);
+((GeneralPath)shape).quadTo(12.921869, 32.523438, 17.76562, 30.375);
+((GeneralPath)shape).quadTo(22.29687, 28.34375, 28.54687, 27.445312);
+((GeneralPath)shape).quadTo(34.83593, 26.546875, 42.140617, 26.117188);
+((GeneralPath)shape).quadTo(42.179718, 25.882812, 42.296867, 25.375);
+((GeneralPath)shape).quadTo(42.41406, 24.828125, 42.41406, 24.164062);
+((GeneralPath)shape).quadTo(42.41406, 21.390627, 39.83593, 20.296877);
+((GeneralPath)shape).quadTo(37.25781, 19.164064, 32.14062, 19.164064);
+((GeneralPath)shape).quadTo(28.66406, 19.164064, 24.44531, 20.33594);
+((GeneralPath)shape).quadTo(20.265621, 21.507814, 18.15625, 22.289062);
+((GeneralPath)shape).lineTo(16.86718, 22.289062);
+((GeneralPath)shape).lineTo(18.9375, 11.8984375);
+((GeneralPath)shape).quadTo(21.39843, 11.2734375, 26.55468, 10.4921875);
+((GeneralPath)shape).quadTo(31.71093, 9.7109375, 36.82812, 9.7109375);
+((GeneralPath)shape).quadTo(47.14062, 9.7109375, 51.945312, 12.406252);
+((GeneralPath)shape).quadTo(56.789062, 15.1015625, 56.789062, 20.765627);
+((GeneralPath)shape).quadTo(56.789062, 21.546877, 56.632812, 22.796875);
+((GeneralPath)shape).quadTo(56.51562, 24.046875, 56.281254, 24.984375);
+((GeneralPath)shape).lineTo(49.406254, 54.828125);
+((GeneralPath)shape).lineTo(35.421875, 54.828125);
+((GeneralPath)shape).lineTo(36.476566, 50.179688);
+((GeneralPath)shape).closePath();
+g.setPaint(paint);
+g.fill(shape);
+origAlpha = alpha__0_0;
+g.setTransform(defaultTransform__0_0);
+g.setClip(clip__0_0);
+origAlpha = alpha__0;
+g.setTransform(defaultTransform__0);
+g.setClip(clip__0);
+g.setTransform(defaultTransform_);
+g.setClip(clip_);
+
+ }
+
+ public Image getImage() {
+ BufferedImage image =
+ new BufferedImage(getIconWidth(), getIconHeight(),
+ BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g = image.createGraphics();
+ paintIcon(null, g, 0, 0);
+ g.dispose();
+ return image;
+ }
+
+ /**
+ * Returns the X of the bounding box of the original SVG image.
+ *
+ * @return The X of the bounding box of the original SVG image.
+ */
+ public static int getOrigX() {
+ return 8;
+ }
+
+ /**
+ * Returns the Y of the bounding box of the original SVG image.
+ *
+ * @return The Y of the bounding box of the original SVG image.
+ */
+ public static int getOrigY() {
+ return 10;
+ }
+
+ /**
+ * Returns the width of the bounding box of the original SVG image.
+ *
+ * @return The width of the bounding box of the original SVG image.
+ */
+ public static int getOrigWidth() {
+ return 64;
+ }
+
+ /**
+ * Returns the height of the bounding box of the original SVG image.
+ *
+ * @return The height of the bounding box of the original SVG image.
+ */
+ public static int getOrigHeight() {
+ return 64;
+ }
+
+ /**
+ * The current width of this resizable icon.
+ */
+ int width;
+
+ /**
+ * The current height of this resizable icon.
+ */
+ int height;
+
+ /**
+ * Creates a new transcoded SVG image.
+ */
+ public MavenIcon() {
+ this.width = getOrigWidth();
+ this.height = getOrigHeight();
+ }
+
+ /**
+ * Creates a new transcoded SVG image with the given dimensions.
+ *
+ * @param size the dimensions of the icon
+ */
+ public MavenIcon(Dimension size) {
+ this.width = size.width;
+ this.height = size.width;
+ }
+
+ public MavenIcon(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.swing.Icon#getIconHeight()
+ */
+ @Override
+ public int getIconHeight() {
+ return height;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.swing.Icon#getIconWidth()
+ */
+ @Override
+ public int getIconWidth() {
+ return width;
+ }
+
+ public void setDimension(Dimension newDimension) {
+ this.width = newDimension.width;
+ this.height = newDimension.height;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.swing.Icon#paintIcon(java.awt.Component,
java.awt.Graphics,
+ * int, int)
+ */
+ @Override
+ public void paintIcon(Component c, Graphics g, int x, int y) {
+ Graphics2D g2d = (Graphics2D) g.create();
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.translate(x, y);
+
+ Area clip = new Area(new Rectangle(0, 0, this.width,
this.height));
+ if (g2d.getClip() != null) clip.intersect(new
Area(g2d.getClip()));
+ g2d.setClip(clip);
+
+ double coef1 = (double) this.width / (double) getOrigWidth();
+ double coef2 = (double) this.height / (double) getOrigHeight();
+ double coef = Math.min(coef1, coef2);
+ g2d.scale(coef, coef);
+ paint(g2d);
+ g2d.dispose();
+ }
+}
+
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs