com.levigo.jadice.demo
Class BasicJadicePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.levigo.jadice.demo.BasicJadicePanel
All Implemented Interfaces:
JadiceToolbarProvider, ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
JadiceFilterDemoApplication

public class BasicJadicePanel
extends JPanel
implements JadiceToolbarProvider

This class provides a convenience component to have an easy possibility for a comfortable page view embedding. As a JPanel it can be easily embedded in different component hierarchies and layouts. Developers just have to implement the following methods to customise the panel's appearance:

Specific additional components can be added or removed via calls of

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JToolBar annoTools
           
protected  JToolBar mainTools
           
protected  JMenuBar menuBar
           
protected  StatusBar snapInStatusBar
           
 
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
BasicJadicePanel()
          Creates a new instance of a jadice panel.
BasicJadicePanel(DefaultMenuComponentFactory menuComponentFactory)
          Creates a new instance of a jadice panel.
 
Method Summary
 MessageWidget addRollingMessagePanel(String constraint)
          Adds a rolling message and info panel to this container.
 void addSorterToolBar(SorterToolbar sorterToolbar, String borderLayoutConstraint)
          Adds a given sorter toolbar to this panel.
 void addSorterToolBar(String borderLayoutConstraint)
          Adds a default sorter toolbar associated to contained viewer to this panel.
protected  Context createContext()
          Initializes and fills the context with the embedded viewer (to perform operations regarding the display of the document) and a reference to the context itself.
protected  JToolBar createJadiceAnnotationToolbar()
          Creates and returns the annotation toolbar.
protected  JToolBar createJadiceMainToolBar()
          Creates and returns the application's toolbar.
protected  JMenuBar createJadiceMenuBar()
          Creates and returns the applications menubar.
protected  StatusBar createSnapInStatusBar()
          Creates and returns the embedded status bar.
protected  BasicViewer createViewer()
          Create the viewer instance.
static String getAnnotationToolBarLocation()
          Returns the layout constraint of the annotation toolbar.
 Context getContext()
          Returns the main context.
 JToolBar getJadiceAnnotationToolbar()
          Returns a reference to the applications annotation toolbar.
 JToolBar getJadiceMainToolBar()
          Returns a reference to the main toolbar.
 JMenuBar getJadiceMenuBar()
          Returns a reference to the current applications menu bar.
static String getMainToolBarLocation()
          Returns the layout constraint of the main toolbar.
 DefaultMenuComponentFactory getMenucomponentsFactory()
          Returns the MenuComponentFactory this panel was created with.
 PageView getPageView()
          Returns the embedded page viewer.
 MessageWidget getRollingMessagePanel()
          Returns a reference to the contained rolling message and info panel.
 StatusBar getSnapInStatusBar()
          Returns a reference to embedded snap-in status bar.
 SorterToolbar getSorterToolbar()
          Returns a reference to the contained sorter toolbar object if available.
 BasicViewer getViewer()
          Returns the embedded viewer instance.
protected  void initGui()
          Initializes and arranges the gui components.
 void removeRollingMessagePanel()
          Removes the rolling message and info panel from this container.
static void setAnnotationToolBarLocation(String constraint)
          Sets the layout constraint of the annotation toolbar.
static void setMainToolBarLocation(String constraint)
          Sets the layout constraint of the main jadice toolbar.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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
 
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, setLayout, 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, getName, 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

snapInStatusBar

protected StatusBar snapInStatusBar

mainTools

protected JToolBar mainTools

annoTools

protected JToolBar annoTools

menuBar

protected JMenuBar menuBar
Constructor Detail

BasicJadicePanel

public BasicJadicePanel()
Creates a new instance of a jadice panel.

It initializes and layouts the embedded components like the viewer, the status bar and so on. The layout and composition of the embedded gui components will be done in the method initGui(), which is called within this constructor. Furthermore a Context object will be created, to serve as context state representation for associated CommandActions.

This constructor will call BasicJadicePanel(DefaultMenuComponentFactory) with the factory

 DefaultMenuComponentFactory.getInstance( LauncherConstants.DEFAULT_MENU_COMPONENTS_PROPERTIES_FILE )
 


BasicJadicePanel

public BasicJadicePanel(DefaultMenuComponentFactory menuComponentFactory)
Creates a new instance of a jadice panel.

It initializes and layouts the embedded components like the viewer, the status bar and so on. The layout and composition of the embedded gui components will be done in the method initGui(), which is called within this constructor. Furthermore a Context object will be created, to serve as context state representation for associated CommandActions.

Parameters:
menuComponentFactory - - the factory to create the GUI components
Method Detail

createJadiceMenuBar

protected JMenuBar createJadiceMenuBar()
Creates and returns the applications menubar. A call of this method will override an already existing menubar reference and does not cause a change in the component hierarchy.

The created menu bar uses the menu structure definition jadiceMenubar defined in the menucomponents configuration in com.levigo.jadice.resources.properties package. If this structure could not be instantiated, a default menubar with the following menu structures will be created:

Hint:
This method does not change the component hierarchy. Removing old instances and adding new instances to the component hierarchy is up to the developer.

Returns:
JMenuBar

getJadiceMenuBar

public JMenuBar getJadiceMenuBar()
Returns a reference to the current applications menu bar.

Returns:
JMenuBar

getJadiceMainToolBar

public JToolBar getJadiceMainToolBar()
Returns a reference to the main toolbar. Generally it is a toolbar to control the viewer.

Specified by:
getJadiceMainToolBar in interface JadiceToolbarProvider
Returns:
JToolBar main toolbar to control the viewer

createJadiceMainToolBar

protected JToolBar createJadiceMainToolBar()
Creates and returns the application's toolbar. A call of this method will override an already existing toolbar reference and does not cause a change in the component hierarchy.

The created toolbar uses the menu structure definition jadiceToolbar defined in the menucomponents configuration (menucomponents.properties) in com.levigo.jadice.demo.resources package.

Hint:
This method does not change the component hierarchy. Removing old instances and adding new instances to the component hierarchy is up to the developer.

Returns:
JToolBar

getJadiceAnnotationToolbar

public JToolBar getJadiceAnnotationToolbar()
Returns a reference to the applications annotation toolbar. It is a toolbar to modify annotations.

Specified by:
getJadiceAnnotationToolbar in interface JadiceToolbarProvider
Returns:
JToolBar the Annotation toolbar

createJadiceAnnotationToolbar

protected JToolBar createJadiceAnnotationToolbar()
Creates and returns the annotation toolbar. A call of this method will override an already existing toolbar reference and does not cause a change in the component hierarchy.

The created toolbar uses the menu structure definition <annotationTypePrefix>-annotations defined in the menucomponents configuration in com.levigo.jadice.resources.properties package.

Hint:
This method does not change the component hierarchy. Removing old instances and adding new instances to the component hierarchy is up to the developer.

Returns:
JToolBar

createViewer

protected BasicViewer createViewer()
Create the viewer instance.


initGui

protected void initGui()
Initializes and arranges the gui components. This method will called only once within the constructor of this class.


addRollingMessagePanel

public MessageWidget addRollingMessagePanel(String constraint)
Adds a rolling message and info panel to this container. It also notifies the layout manager to add the component to this containers layout using the specified constraints object. The constraint must be one of the following constants: Other values of the constraint parameter will not be accepted and an IllegalArgumentException will be thrown.

This method changes the component hierarchy of swing components. Therefore it is strongly recommended that this method must be called on on the event dispatching thread. This is necessary because Swing objects and methods are generally not thread safe; invoking them from multiple threads risks thread interference or memory consistency errors.

Parameters:
constraint - describes the position where the message panel should placed in the containers layout. Accepted values are BorderLayout.NORTH and BorderLayout.SOUTH.
Returns:
the added RollingMessagePanel
Throws:
IllegalArgumentException - if the constraint is none of the allowed constraints
NullPointerException - if the constraint is null

removeRollingMessagePanel

public void removeRollingMessagePanel()
Removes the rolling message and info panel from this container. If no rolling message panel is contained in this container, this method does nothing.

This method changes the component hierarchy of swing components. Therefore it is strongly recommended that this method must be called on on the event dispatching thread. This is necessary because Swing objects and methods are generally not thread safe; invoking them from multiple threads risks thread interference or memory consistency errors.


getRollingMessagePanel

public MessageWidget getRollingMessagePanel()
Returns a reference to the contained rolling message and info panel. If no message panel is contained, this method returns null.

Returns:
the embedded rolling message and info panel or null if no message panel is contained.

addSorterToolBar

public void addSorterToolBar(String borderLayoutConstraint)
Adds a default sorter toolbar associated to contained viewer to this panel. The constraint defines at which location the toolbar should be added.

This method changes the component hierarchy of swing components. Therefore it must be called on on the event dispatching thread. This is necessary because Swing objects and methods are generally not thread safe; invoking them from multiple threads risks thread interference or memory consistency errors.

Parameters:
borderLayoutConstraint - the layout constraint, allowed values are BorderLayout.NORTH,BorderLayout.SOUTH, BorderLayout.EAST, BorderLayout.WEST.
Throws:
IllegalArgumentException - Any other constraint values as the named above will cause an IllegalArgumentException.

addSorterToolBar

public void addSorterToolBar(SorterToolbar sorterToolbar,
                             String borderLayoutConstraint)
Adds a given sorter toolbar to this panel. The constraint defines at which location the toolbar should be added.

This method changes the component hierarchy of swing components. Therefore it must be called on on the event dispatching thread. This is necessary because Swing objects and methods are generally not thread safe; invoking them from multiple threads risks thread interference or memory consistency errors.

Parameters:
sorterToolbar - the sorter toolbar to add
borderLayoutConstraint - the layout constraint, allowed values are BorderLayout.NORTH,BorderLayout.SOUTH, BorderLayout.EAST, BorderLayout.WEST.
Throws:
IllegalArgumentException - Any other constraint value as the named above will cause an IllegalArgumentException.
NullPointerException - if the given sorter toolbar is null

getContext

public Context getContext()
Returns the main context. Useful for instantiation of actions of the provided jadice commands and actions package. Furthermore developers might enlarge the contained context objects for its own command set.

Returns:
Context the main context object

createContext

protected Context createContext()
Initializes and fills the context with the embedded viewer (to perform operations regarding the display of the document) and a reference to the context itself. Furthermore it initializes a mechanism to update the context when the viewer changes its state.

This method will be called only once at the creation time of this object.


getViewer

public BasicViewer getViewer()
Returns the embedded viewer instance.

Returns:
BasicViewer

getPageView

public PageView getPageView()
Returns the embedded page viewer.

Returns:
PageView

getAnnotationToolBarLocation

public static String getAnnotationToolBarLocation()
Returns the layout constraint of the annotation toolbar.

This constraint describe the layout position of the annotation toolbar when an instance of this class is newly created.

Returns:
String the return value is one of the following

setAnnotationToolBarLocation

public static void setAnnotationToolBarLocation(String constraint)
Sets the layout constraint of the annotation toolbar. After changing this constraint all new created instances of this class will layout their annotation toolbar at the new position.

Allowed constraints are

Other values of the constraint parameter will be ignored and no change will take place.

Hint:
It is upon the developer to take care, that annotation and main toolbar does not have the same constraint.

Parameters:
constraint - layout position of the annotation toolbar for new created instances of this class

getMainToolBarLocation

public static String getMainToolBarLocation()
Returns the layout constraint of the main toolbar.

This constraint describe the layout position of the main toolbar when an instance of this class is newly created.

Returns:
String the return value is one of the following

setMainToolBarLocation

public static void setMainToolBarLocation(String constraint)
Sets the layout constraint of the main jadice toolbar. After changing this constraint all new created instances of this class will layout their main toolbar at the new position.

Possible constraints are

Other values of the constraint parameter will be ignored and no change will take place.

Hint:
It is upon the developer to take care, that annotation and main toolbar does not have the same constraint.

Parameters:
constraint - layout position of the main toolbar for new created instances of this class

getSorterToolbar

public SorterToolbar getSorterToolbar()
Returns a reference to the contained sorter toolbar object if available. Otherwise null will be returned.

Returns:
SorterToolbar

getSnapInStatusBar

public StatusBar getSnapInStatusBar()
Returns a reference to embedded snap-in status bar.

Returns:
the embedded snap in status bar

createSnapInStatusBar

protected StatusBar createSnapInStatusBar()
Creates and returns the embedded status bar. Realizations of this method may store the created component in a reference field in order to have a reference which could be returned by the getSnapInStatusBar() method.

This method should not change the component hierarchy. Removing old instances and adding new instances to the component hierarchy is up to the developer.

This method will be called only once at the creation time of this object.

Returns:
StatusBar

getMenucomponentsFactory

public DefaultMenuComponentFactory getMenucomponentsFactory()
Returns the MenuComponentFactory this panel was created with.

Returns:
- the MenuComponentFactory


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.