fr.esrf.tangoatk.widget.util.jdraw
Class JDLibraryViewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by fr.esrf.tangoatk.widget.util.jdraw.JDLibraryViewer
All Implemented Interfaces:
JDrawEditorListener, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class JDLibraryViewer
extends javax.swing.JFrame
implements java.awt.event.ActionListener, JDrawEditorListener

Displays a JDraw file in a library view (only selection and clipboard operations allowed).

Example of use: (This example shows how to create a custom editor and add a component library)

 public class VacEdit extends JDrawEditorFrame {

  private JButton libButton;
  private JDLibraryViewer libViewer;
  private JDrawEditor ed = new JDrawEditor(JDrawEditor.MODE_EDIT);
  private JDrawEditor py = new JDrawEditor(JDrawEditor.MODE_PLAY);

public VacEdit() {

  ed = new JDrawEditor(JDrawEditor.MODE_EDIT);
  py = new JDrawEditor(JDrawEditor.MODE_PLAY);

  String libPath = System.getProperty("LIBPATH", "null");
  if( libPath.equals("null") )
   System.out.println("Warning LIBPATH is not defined.");

  // Customize the editor
  libViewer = new JDLibraryViewer(libPath+"/jvacuum_lib.jdw",ed);
  libViewer.setTitle("ESRF vacuum library");
  ATKGraphicsUtils.centerFrameOnScreen(libViewer);

  libButton = new JButton(new ImageIcon(getClass().getResource("/jvacuum/vac_button.gif")));
  libButton.setPressedIcon(new ImageIcon(getClass().getResource("/jvacuum/vac_button_push.gif")));
  libButton.setToolTipText("ESRF vacuum library");
  libButton.setMargin(new Insets(3,3,3,3));
  libButton.setBorder(null);

  libButton.addActionListener(this);
  editToolBar.add(new JLabel(new ImageIcon(getClass().getResource("/fr/esrf/tangoatk/widget/util/jdraw/gif/jdraw_separator.gif"))));
  editToolBar.add(libButton);

  setAppTitle("JVacuum Editor 1.0");
  setEditor(ed);
  setPlayer(py);

}

public void actionPerformed(ActionEvent e) {

  Object src = e.getSource();
  if( src== libButton ) {
    libViewer.setVisible(true);
  } else {
    super.actionPerformed(e);
  }

}


public static void main(String[] args) {

  VacEdit v = new VacEdit();
  ATKGraphicsUtils.centerFrameOnScreen(v);
  v.setVisible(true);

}

}
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JDLibraryViewer(java.lang.String libName, JDrawEditor invoker)
           
JDLibraryViewer(java.lang.String libName, JDrawEditor invoker, boolean lPanel)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void clipboardChanged()
          Called when the clipboard change , after a copy/cut
 void creationDone()
          Called when the user end the creation mode
 void initComponents(java.lang.String libName, JDrawEditor invoker, boolean lPanel)
           
static void main(java.lang.String[] args)
           
 void selectionChanged()
          Called when the selection change
 void sizeChanged()
          Called when the size of the editor change, usualy after a zoom or a load.
 void valueChanged()
          Called when the drawing currently edited change, also called after laoding a file.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

JDLibraryViewer

public JDLibraryViewer(java.lang.String libName,
                       JDrawEditor invoker)

JDLibraryViewer

public JDLibraryViewer(java.lang.String libName,
                       JDrawEditor invoker,
                       boolean lPanel)
Method Detail

initComponents

public void initComponents(java.lang.String libName,
                           JDrawEditor invoker,
                           boolean lPanel)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

selectionChanged

public void selectionChanged()
Description copied from interface: JDrawEditorListener
Called when the selection change

Specified by:
selectionChanged in interface JDrawEditorListener

sizeChanged

public void sizeChanged()
Description copied from interface: JDrawEditorListener
Called when the size of the editor change, usualy after a zoom or a load. Note: If the editor is within a JScrollPane, a called to revalidate on this ScrollPane is needed.

Specified by:
sizeChanged in interface JDrawEditorListener

clipboardChanged

public void clipboardChanged()
Description copied from interface: JDrawEditorListener
Called when the clipboard change , after a copy/cut

Specified by:
clipboardChanged in interface JDrawEditorListener

valueChanged

public void valueChanged()
Description copied from interface: JDrawEditorListener
Called when the drawing currently edited change, also called after laoding a file.

Specified by:
valueChanged in interface JDrawEditorListener

creationDone

public void creationDone()
Description copied from interface: JDrawEditorListener
Called when the user end the creation mode

Specified by:
creationDone in interface JDrawEditorListener

main

public static void main(java.lang.String[] args)