visualmodeler
Class ResourceProperty

Object
  extended byComponent
      extended byContainer
          extended byWindow
              extended byDialog
                  extended byjavax.swing.JDialog
                      extended byvisualmodeler.ResourceProperty
All Implemented Interfaces:
javax.accessibility.Accessible, ActionListener, javax.swing.event.ChangeListener, EventListener, ImageObserver, javax.swing.event.ListSelectionListener, MenuContainer, javax.swing.RootPaneContainer, Serializable, javax.swing.WindowConstants, WindowListener

public class ResourceProperty
extends javax.swing.JDialog
implements ActionListener, javax.swing.event.ChangeListener, WindowListener, javax.swing.event.ListSelectionListener

ResourceProperty stores the values needed for each grid resource

Version:
1.1
Author:
Anthony Sulistio and Chee Shin Yeo
See Also:
Serialized Form
Invariant:
$none

Nested Class Summary
 
Nested classes inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes inherited from class Dialog
Dialog.AccessibleAWTDialog
 
Nested classes inherited from class Window
Window.AccessibleAWTWindow
 
Nested classes inherited from class Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class Dialog
 
Fields inherited from class Window
 
Fields inherited from class Container
 
Fields inherited from class 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, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ResourceProperty(int id, String name, boolean random, Random r)
          Allocates a new ResourceProperty object
 
Method Summary
 void actionPerformed(ActionEvent evt)
          A method that listens to user's call
 String generateCode(String indent)
          Generates a Java code for grid resource
 int getId()
          Gets resource id
 String getResourceName()
          Gets the resource name
 void loadXml(org.w3c.dom.NodeList nodeList)
          Loads a section of grid resource from XML file
 String saveFile(String spaces)
          Saves grid resource properties into XML format
 void showDialog()
          Shows the grid resource dialog
 void stateChanged(javax.swing.event.ChangeEvent evt)
          A method that refreshes the slider bars when they received a change
 void valueChanged(javax.swing.event.ListSelectionEvent evt)
          A method that shows a dialog for a particular list selection
 void windowActivated(WindowEvent evt)
          An event that occurs when the window dialog is activated
 void windowClosed(WindowEvent evt)
          An event that occurs when the window dialog is closed
 void windowClosing(WindowEvent evt)
          An event that occurs when the window dialog is closing
 void windowDeactivated(WindowEvent evt)
          An event that occurs when the window dialog is deactivated
 void windowDeiconified(WindowEvent evt)
          An event that occurs when the window dialog is deiconified
 void windowIconified(WindowEvent evt)
          An event that occurs when the window dialog is iconified
 void windowOpened(WindowEvent evt)
          An event that occurs when the window dialog is opened
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class Dialog
addNotify, dispose, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class 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, 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, 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, isOpaque, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceProperty

public ResourceProperty(int id,
                        String name,
                        boolean random,
                        Random r)
Allocates a new ResourceProperty object

Parameters:
id - resource id
name - resource name
random - true if assigning grid resource properties randomly, false otherwise
r - a Random object
Pre Condition:
id >= 0, name != null, r != null
Post Condition:
$none
Method Detail

getResourceName

public String getResourceName()
Gets the resource name

Returns:
resource name
Pre Condition:
$none
Post Condition:
$result != null

getId

public int getId()
Gets resource id

Returns:
resource id
Pre Condition:
$none
Post Condition:
$result >= 0

actionPerformed

public void actionPerformed(ActionEvent evt)
A method that listens to user's call

Specified by:
actionPerformed in interface ActionListener
Parameters:
evt - an ActionEvent object
Pre Condition:
evt != null
Post Condition:
$none

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent evt)
A method that refreshes the slider bars when they received a change

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
evt - a ChangeEvent object
Pre Condition:
evt != null
Post Condition:
$none

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent evt)
A method that shows a dialog for a particular list selection

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Parameters:
evt - a ListSelectionEvent object
Pre Condition:
evt != null
Post Condition:
$none

showDialog

public void showDialog()
Shows the grid resource dialog

Pre Condition:
$none
Post Condition:
$none

generateCode

public String generateCode(String indent)
Generates a Java code for grid resource

Parameters:
indent - indentation
Returns:
a Java code in String object
Pre Condition:
indent != null
Post Condition:
$result != null

saveFile

public String saveFile(String spaces)
Saves grid resource properties into XML format

Parameters:
spaces - indentation
Returns:
XML code
Pre Condition:
spaces != null
Post Condition:
$result != null

loadXml

public void loadXml(org.w3c.dom.NodeList nodeList)
             throws Exception
Loads a section of grid resource from XML file

Parameters:
nodeList - a NodeList object
Throws:
Exception - if error occurs in parsing and retrieving XML file
Pre Condition:
nodeList != null
Post Condition:
$none

windowClosing

public void windowClosing(WindowEvent evt)
An event that occurs when the window dialog is closing

Specified by:
windowClosing in interface WindowListener
Parameters:
evt - a WindowEvent object
Pre Condition:
evt != null
Post Condition:
$none

windowClosed

public void windowClosed(WindowEvent evt)
An event that occurs when the window dialog is closed

Specified by:
windowClosed in interface WindowListener
Parameters:
evt - a WindowEvent object
Pre Condition:
evt != null
Post Condition:
$none

windowOpened

public void windowOpened(WindowEvent evt)
An event that occurs when the window dialog is opened

Specified by:
windowOpened in interface WindowListener
Parameters:
evt - a WindowEvent object
Pre Condition:
evt != null
Post Condition:
$none

windowIconified

public void windowIconified(WindowEvent evt)
An event that occurs when the window dialog is iconified

Specified by:
windowIconified in interface WindowListener
Parameters:
evt - a WindowEvent object
Pre Condition:
evt != null
Post Condition:
$none

windowDeiconified

public void windowDeiconified(WindowEvent evt)
An event that occurs when the window dialog is deiconified

Specified by:
windowDeiconified in interface WindowListener
Parameters:
evt - a WindowEvent object
Pre Condition:
evt != null
Post Condition:
$none

windowActivated

public void windowActivated(WindowEvent evt)
An event that occurs when the window dialog is activated

Specified by:
windowActivated in interface WindowListener
Parameters:
evt - a WindowEvent object
Pre Condition:
evt != null
Post Condition:
$none

windowDeactivated

public void windowDeactivated(WindowEvent evt)
An event that occurs when the window dialog is deactivated

Specified by:
windowDeactivated in interface WindowListener
Parameters:
evt - a WindowEvent object
Pre Condition:
evt != null
Post Condition:
$none