jcreek.gui.representation
Class FramePane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjcreek.gui.representation.FramePane
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, ModelChangeListener, java.io.Serializable
Direct Known Subclasses:
CasePane, CasePaneNew

public class FramePane
extends javax.swing.JComponent
implements ModelChangeListener

GUI element for creating or manipulating a Creek entity. An instance of this class encapsulates an Entiy (as defined in jcreek.representation) and allows the manipulation of it.

Version:
1.0
Author:
Frode Sørmo
See Also:
Entity, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JButton addButton
           
protected  javax.swing.JComboBox addEntity
           
protected  javax.swing.JPanel addPanel
           
protected  javax.swing.JComboBox addRelationType
           
protected  javax.swing.JTextField addStrength
           
protected  boolean displayInherited
           
protected  boolean displayInheritedToggle
           
protected  javax.swing.JPanel elementPanel
           
protected  javax.swing.JTextArea entityDescription
           
 javax.swing.JTextField entityName
           
protected  javax.swing.JComboBox entityObjectClassSelector
           
protected  javax.swing.JTable frameTable
           
protected  FrameTableModel frameTableModel
           
protected  boolean isUpdatingGUI
           
protected  Entity myEntity
           
protected  LinkListener openNewWindow
           
 
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
FramePane()
          Creates and empty FramePane.
FramePane(Entity frame)
          Creates a new FramePane encapsulating the given entity.
FramePane(Entity frame, boolean linker)
          Creates a new FramePane encapsulating the given entity.
FramePane(Entity frame, boolean linker, boolean displayInheritedToggle, boolean displayInherited)
          Creates a new FramePane enacapsulating the given entity
FramePane(KnowledgeModel km)
          Creates a new FramePane encapsulating a new entity.
 
Method Summary
 void addLinkListener(LinkListener listener)
           
 void attach()
          When called, this method will register ModelChangeListeners with all the relations in the table to update it automatically if a change is registered in any of them.
protected  void buildEmptyPane()
          Builds a pane that is displayed when no entity is selected.
protected  javax.swing.JPanel buildEntityObjectPane()
          Build the entity object part of the frame pane, containing information about what object is stored within the frame.
protected  void buildFramePane()
          (Re)builds the pane.
protected  javax.swing.JPanel buildHeaderPane()
          Build the header pane with the name and description of the frame.
 void detach()
          Removes the change-listeners.
 Entity getEntity()
          Returns the entity this FramePane displays.
 javax.swing.JTable getFrameTable()
           
 LinkListener getOpenNewWindowLinkListener()
           
protected  void initTable()
           
 boolean isAttached()
          Returns true if the FramePanel updates when other elements changes the case or other relevant parts of the model, false if not.
 boolean isEditable()
          Returns true if the case encapsulated by this FramePane can be modified through the GUI, or fasle if it is merely displaed.
static void main(java.lang.String[] argv)
           
 void modelChanged(ModelChangeEvent e)
           
 void removeLinkListener(LinkListener listener)
           
 void setEditable(boolean editable)
          Sets if the case displayed by this FramePane should be editable or through the GUI or not.
 void setEntity(Entity entity)
          Sets the entity to be displayed and modified by this FramePane.
 void setShowInheritedRelations(boolean showInheritedRelations)
          Sets if this gui element is supposed to display only local relations or all relations.
 boolean showInheritedRelations()
          Returns true if this gui element shows inherited relations in addition to the local ones.
 boolean showInheritedToggle()
          Returns true if this gui element displays the toggle to change between displaying inherited relations or only local relations.
 void updatePane()
          Registers a request to update its contents.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getWidth, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

myEntity

protected Entity myEntity

isUpdatingGUI

protected boolean isUpdatingGUI

entityName

public javax.swing.JTextField entityName

entityDescription

protected javax.swing.JTextArea entityDescription

elementPanel

protected javax.swing.JPanel elementPanel

addPanel

protected javax.swing.JPanel addPanel

addButton

protected javax.swing.JButton addButton

addRelationType

protected javax.swing.JComboBox addRelationType

addEntity

protected javax.swing.JComboBox addEntity

entityObjectClassSelector

protected javax.swing.JComboBox entityObjectClassSelector

addStrength

protected javax.swing.JTextField addStrength

frameTableModel

protected FrameTableModel frameTableModel

frameTable

protected javax.swing.JTable frameTable

displayInheritedToggle

protected boolean displayInheritedToggle

displayInherited

protected boolean displayInherited

openNewWindow

protected LinkListener openNewWindow
Constructor Detail

FramePane

public FramePane()
Creates and empty FramePane.


FramePane

public FramePane(KnowledgeModel km)
Creates a new FramePane encapsulating a new entity.

Parameters:
km - The KnowledgeModel to create the new entity in.

FramePane

public FramePane(Entity frame,
                 boolean linker)
Creates a new FramePane encapsulating the given entity.

Parameters:
frame - The entity to show.
linker - If true, adds the default LinkListener that will make and display a new FramePane in a new JFrame if a link is clicked.

FramePane

public FramePane(Entity frame)
Creates a new FramePane encapsulating the given entity.

Parameters:
frame - The entity to show.

FramePane

public FramePane(Entity frame,
                 boolean linker,
                 boolean displayInheritedToggle,
                 boolean displayInherited)
Creates a new FramePane enacapsulating the given entity

Parameters:
frame - The entity to display.
linker -
displayInheritedToggle - If true, displays a toggle that will allow the user to change if inherited relations are displayed or not.
displayInherited - If true, displays the inherited relations.
Method Detail

showInheritedToggle

public boolean showInheritedToggle()
Returns true if this gui element displays the toggle to change between displaying inherited relations or only local relations.


showInheritedRelations

public boolean showInheritedRelations()
Returns true if this gui element shows inherited relations in addition to the local ones.


setShowInheritedRelations

public void setShowInheritedRelations(boolean showInheritedRelations)
Sets if this gui element is supposed to display only local relations or all relations.

Parameters:
showInheritedRelations - If true, all relations (including inherited relations) are displayed. If not true, only local relations are shown.

initTable

protected void initTable()

attach

public void attach()
When called, this method will register ModelChangeListeners with all the relations in the table to update it automatically if a change is registered in any of them. Before the table is disposed, the detach() method should be called to make sure the listeners are removed.


detach

public void detach()
Removes the change-listeners.


isAttached

public boolean isAttached()
Returns true if the FramePanel updates when other elements changes the case or other relevant parts of the model, false if not.


modelChanged

public void modelChanged(ModelChangeEvent e)
Specified by:
modelChanged in interface ModelChangeListener

updatePane

public void updatePane()
Registers a request to update its contents. It will return at once and not wait for this to happen. This is usually in response to a change in the data model. Although this method affects the Swing component, it can be called outside the Swing event thread. Repeated calls to this method before the pane is actually updated will not result in the pane redrawing multiple times - it functions much as the repaint() method.


setEditable

public void setEditable(boolean editable)
Sets if the case displayed by this FramePane should be editable or through the GUI or not.

Parameters:
editable - True if the case should be editable, false if not.

isEditable

public boolean isEditable()
Returns true if the case encapsulated by this FramePane can be modified through the GUI, or fasle if it is merely displaed.


setEntity

public void setEntity(Entity entity)
Sets the entity to be displayed and modified by this FramePane.

Parameters:
entity - The case object.

getEntity

public Entity getEntity()
Returns the entity this FramePane displays.


buildEmptyPane

protected void buildEmptyPane()
Builds a pane that is displayed when no entity is selected.


buildEntityObjectPane

protected javax.swing.JPanel buildEntityObjectPane()
Build the entity object part of the frame pane, containing information about what object is stored within the frame.

Returns:
JPanel

buildHeaderPane

protected javax.swing.JPanel buildHeaderPane()
Build the header pane with the name and description of the frame.


buildFramePane

protected void buildFramePane()
(Re)builds the pane.


addLinkListener

public void addLinkListener(LinkListener listener)

removeLinkListener

public void removeLinkListener(LinkListener listener)

getOpenNewWindowLinkListener

public LinkListener getOpenNewWindowLinkListener()

getFrameTable

public javax.swing.JTable getFrameTable()

main

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


Created at IDI, NTNU by the Artificial Intelligence and Learning group