templates.library
Class LibraryUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.Box
                  extended by templates.library.LibraryUI
All Implemented Interfaces:
ides.api.plugin.presentation.Presentation, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, TemplateLibraryListener

public class LibraryUI
extends javax.swing.Box
implements ides.api.plugin.presentation.Presentation, TemplateLibraryListener, java.awt.event.MouseMotionListener, java.awt.event.MouseListener

The UI for the template library. Displays a list of the templates in the library, as well as buttons to edit the content of the library.

Author:
Lenko Grigorov
See Also:
Serialized Form

Nested Class Summary
static class LibraryUI.AddTemplateAction
          The UI action to add a new template to the template library.
 class LibraryUI.DeleteTemplateAction
          The UI action to remove a template from the template library.
 class LibraryUI.EditTemplateAction
          The UI action to edit the properties of a template in the template library.
 class LibraryUI.ViewTemplateAction
          The UI action to load the underlying model of a template into the workspace.
 
Nested classes/interfaces inherited from class javax.swing.Box
javax.swing.Box.AccessibleBox, javax.swing.Box.Filler
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JList list
          The list of templates in the template library.
protected  javax.swing.DefaultListModel model
          The ListModel used to display the list of templates.
protected  LibraryUI.ViewTemplateAction viewAction
          The action to load the underlying model of a template into the workspace
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LibraryUI()
          Set up the UI for the template library.
 
Method Summary
 void forceRepaint()
          Do nothing.
 javax.swing.JComponent getGUI()
           
 ides.api.plugin.model.DESModel getModel()
          The LibraryUI is a presentation shared by all TemplateModels; it is not model-dependent.
 java.lang.String getName()
           
 void mouseClicked(java.awt.event.MouseEvent arg0)
          Load the underlying model of a template when the user double-clicks this template in the list of templates.
 void mouseDragged(java.awt.event.MouseEvent arg0)
          Do nothing.
 void mouseEntered(java.awt.event.MouseEvent arg0)
          Do nothing.
 void mouseExited(java.awt.event.MouseEvent arg0)
          Do nothing.
 void mouseMoved(java.awt.event.MouseEvent arg0)
          Set the tooltip to contain the description of a template when mouse moves over this template in the list of template.
 void mousePressed(java.awt.event.MouseEvent arg0)
          Do nothing.
 void mouseReleased(java.awt.event.MouseEvent arg0)
          Do nothing.
 void release()
           
 void setTrackModel(boolean arg0)
           
 void templateCollectionChanged(TemplateLibrary source)
          Update the list of templates.
protected  void updateList()
          Update the list of templates to be displayed according to the current content of the template library.
 
Methods inherited from class javax.swing.Box
createGlue, createHorizontalBox, createHorizontalGlue, createHorizontalStrut, createRigidArea, createVerticalBox, createVerticalGlue, createVerticalStrut, getAccessibleContext, paintComponent, setLayout
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list

protected javax.swing.JList list
The list of templates in the template library.


model

protected javax.swing.DefaultListModel model
The ListModel used to display the list of templates.


viewAction

protected LibraryUI.ViewTemplateAction viewAction
The action to load the underlying model of a template into the workspace

Constructor Detail

LibraryUI

public LibraryUI()
Set up the UI for the template library.

Method Detail

updateList

protected void updateList()
Update the list of templates to be displayed according to the current content of the template library.


forceRepaint

public void forceRepaint()
Do nothing.

Specified by:
forceRepaint in interface ides.api.plugin.presentation.Presentation

getGUI

public javax.swing.JComponent getGUI()
Specified by:
getGUI in interface ides.api.plugin.presentation.Presentation

getModel

public ides.api.plugin.model.DESModel getModel()
The LibraryUI is a presentation shared by all TemplateModels; it is not model-dependent. This method simply returns the model currently active in the workspace.

Specified by:
getModel in interface ides.api.plugin.presentation.Presentation

getName

public java.lang.String getName()
Specified by:
getName in interface ides.api.plugin.presentation.Presentation
Overrides:
getName in class java.awt.Component

release

public void release()
Specified by:
release in interface ides.api.plugin.presentation.Presentation

setTrackModel

public void setTrackModel(boolean arg0)
Specified by:
setTrackModel in interface ides.api.plugin.presentation.Presentation

templateCollectionChanged

public void templateCollectionChanged(TemplateLibrary source)
Update the list of templates.

Specified by:
templateCollectionChanged in interface TemplateLibraryListener
Parameters:
source - the template library whose content has changed

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent arg0)
Do nothing.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent arg0)
Set the tooltip to contain the description of a template when mouse moves over this template in the list of template.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent arg0)
Load the underlying model of a template when the user double-clicks this template in the list of templates.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent arg0)
Do nothing.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent arg0)
Do nothing.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent arg0)
Do nothing.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent arg0)
Do nothing.

Specified by:
mouseReleased in interface java.awt.event.MouseListener