summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/graph/view/EditorToolBar.java
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
committerabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
commit0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch)
tree5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/graph/view/EditorToolBar.java
parent036cbdba66f804743c4c838ed598d6972c4b3e17 (diff)
More code cleanup:
Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class
Diffstat (limited to 'source/com/c2kernel/graph/view/EditorToolBar.java')
-rw-r--r--source/com/c2kernel/graph/view/EditorToolBar.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/source/com/c2kernel/graph/view/EditorToolBar.java b/source/com/c2kernel/graph/view/EditorToolBar.java
index e01056f..cc7ab41 100644
--- a/source/com/c2kernel/graph/view/EditorToolBar.java
+++ b/source/com/c2kernel/graph/view/EditorToolBar.java
@@ -50,6 +50,7 @@ public class EditorToolBar extends Box implements Printable
{
mModeId = modeId;
}
+ @Override
public void actionPerformed(ActionEvent ae)
{
notifyListeners(mModeId);
@@ -185,6 +186,7 @@ public class EditorToolBar extends Box implements Printable
// user select a vertex type from the vertex type box
mVertexTypeBox.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent ae)
{
mVertexModeButton.setSelected(true);
@@ -195,6 +197,7 @@ public class EditorToolBar extends Box implements Printable
// user select an edge type from the edge type box
mEdgeTypeBox.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent ae)
{
mEdgeModeButton.setSelected(true);
@@ -203,6 +206,7 @@ public class EditorToolBar extends Box implements Printable
});
mPrintButton.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent ae)
{
PrinterJob _monJob = PrinterJob.getPrinterJob();
@@ -222,10 +226,11 @@ public class EditorToolBar extends Box implements Printable
Class.forName("java.awt.datatransfer.DataFlavor").getDeclaredField("imageFlavor");
mCopyButton.addActionListener(new ActionListener()
{
- public void actionPerformed(ActionEvent ae)
+ @Override
+ public void actionPerformed(ActionEvent ae)
{
try
- {
+ {
Image i = createImage(mGraphPanel.getWidth(),mGraphPanel.getHeight());
Graphics g = i.getGraphics();
mGraphPanel.paintComponent(g);
@@ -242,7 +247,7 @@ public class EditorToolBar extends Box implements Printable
mCopyButton.setEnabled(false);
}
}
-
+
protected class ImageTransferable implements Transferable, ClipboardOwner {
Image image;
int width,height;
@@ -255,19 +260,22 @@ public class EditorToolBar extends Box implements Printable
javaImg = new DataFlavor("image/x-java-image; class=java.awt.Image", "AWT Image");
} catch (Exception ex){ }
}
- public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
+ @Override
+ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
if (!isDataFlavorSupported(flavor) || image == null) {
throw new UnsupportedFlavorException(flavor);
}
return image;
}
- public boolean isDataFlavorSupported(DataFlavor flavor) {
+ @Override
+ public boolean isDataFlavorSupported(DataFlavor flavor) {
boolean result = in(flavor, getTransferDataFlavors());
return result;
}
-
- public DataFlavor[] getTransferDataFlavors() {
+
+ @Override
+ public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] { javaImg };
}
protected boolean in(DataFlavor flavor, DataFlavor[] flavors) {
@@ -277,18 +285,19 @@ public class EditorToolBar extends Box implements Printable
}
return f < flavors.length;
}
- public void lostOwnership(Clipboard clipboard, Transferable contents) {
+ @Override
+ public void lostOwnership(Clipboard clipboard, Transferable contents) {
image = null;
}
}
-
+
protected void notifyListeners(String newModeId)
{
int i = 0;
EditorModeListener listener = null;
for (i = 0; i < mListenerVector.size(); i++)
{
- listener = (EditorModeListener) mListenerVector.elementAt(i);
+ listener = mListenerVector.elementAt(i);
listener.editorModeChanged(newModeId);
}
}
@@ -318,6 +327,7 @@ public class EditorToolBar extends Box implements Printable
{
return this;
}
+ @Override
public int print(Graphics g, PageFormat pf, int i) throws PrinterException
{
if (i >= 1)