Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui.widgets
Class SystemEditPaneStateMachine

java.lang.Object
  extended by 
org.eclipse.rse.ui.widgets.SystemEditPaneStateMachine

public class SystemEditPaneStateMachine
extends Object

This class encapsulates the states an edit page (with apply/reset buttons) can go through and handle managing the state transitions. For example, it manages the enabled/disabled state of the apply/reset buttons.

There are three modes supported:

  1. New -> user is creating a "new thing". In this state, the apply button label is "New", and the reset button is hidden
  2. Edit -> user is editing an existing thing. The apply and reset buttons have usual labels
  3. Unset -> overall composite is hidden
In addition to the modes, there are these states supported
  1. No changes -> the apply and reset buttons are disabled
  2. Changes pending -> the apply and reset buttons are enabled
  3. Changes made -> the apply and reset buttons are disabled
There are constants for these modes and states in ISystemEditPaneStates

To use this properly, call the following methods at the appropriate times:

  • setNewMode() -> when users selects to create a new thing.
  • setEditMode() -> when user selects to edit an existing thing.
  • setUnsetMode() -> when user selects nothing or something not editable
  • setChangesMade() -> when user changes anything in the pane!
  • isSaveRequired() -> if changes are pending, this will prompt the user if they wish to save the changes or discard the changes. Returns true or false.
  • applyPressed() -> when user successfully presses apply
  • resetPressed() -> when user successfully presses reset


Constructor Summary
SystemEditPaneStateMachine ( Composite composite, Button applyButton, Button resetButton)
          Constructor for SystemEditPaneStateMachine.
 
Method Summary
 void applyPressed ()
          User has successfully pressed Apply (that is, no errors found)
 boolean areChangesPending ()
          Are any changes pending?
 void backup ()
          Backup state method
  Button getApplyButton ()
          Returns the applyButton.
  Composite getComposite ()
          Returns the composite.
 int getMode ()
          Returns the mode.
 boolean getNewSetByDelete ()
           
  Button getResetButton ()
          Returns the resetButton.
 int getState ()
          Returns the state.
 boolean isSaveRequired ()
          Query if it is ok to switch modes.
 void resetPressed ()
          User has successfully pressed Reset (that is, no errors found)
 void restore ()
          Restore state method
 void setApplyLabelForNewMode ( String label, String tooltip)
          Set the label and tooltip to use for the apply button in "new" mode.
 void setChangesMade ()
          User has made changes, such as typing text or selecting a checkbox or radio button.
 void setEditMode ()
          Set the mode to "Edit".
 void setNewMode ()
          Set the mode to "New".
 void setNewSetByDelete (boolean newSetByDelete)
           
 void setUnsetMode ()
          Set the mode to "Unset".
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemEditPaneStateMachine

public SystemEditPaneStateMachine(
Composite composite,
                                  
Button applyButton,
                                  
Button resetButton)
Constructor for SystemEditPaneStateMachine.

This constructor sets the initial mode to MODE_UNSET.

While this class will handle enabling/disabling the apply/reset buttons, it is still your job to add listeners and actually do the applying and resetting!

Parameters:
composite - - overall composite of the edit pane
applyButton - - the Apply pushbutton
resetButton - - the Reset pushbutton. Can be null.
Method Detail

setApplyLabelForNewMode

public void setApplyLabelForNewMode(
String label,
                                    
String tooltip)
Set the label and tooltip to use for the apply button in "new" mode. By default, generic values are used


setNewMode

public void setNewMode()
Set the mode to "New". User has selected "new" and wants to create a new thing. It is your responsibility to call isSaveRequired() first. It is assumed that after the object is created by pressing Apply, your UI will select the new object and then call setEditMode


setEditMode

public void setEditMode()
Set the mode to "Edit". User has selected an existing object and wants to changed/edit it It is your responsibility to call isSaveRequired() first.


setUnsetMode

public void setUnsetMode()
Set the mode to "Unset". User has selected nothing or something not editable It is your responsibility to call isSaveRequired() first.


setChangesMade

public void setChangesMade()
User has made changes, such as typing text or selecting a checkbox or radio button. It is VERY important this be called religiously for every possible change the user can make!


isSaveRequired

public boolean isSaveRequired()
Query if it is ok to switch modes. If no changes pending, returns false If changes pending, user is asked to whether to save (true) or discard (false).


applyPressed

public void applyPressed()
User has successfully pressed Apply (that is, no errors found)


resetPressed

public void resetPressed()
User has successfully pressed Reset (that is, no errors found)


areChangesPending

public boolean areChangesPending()
Are any changes pending?


getResetButton

public 
Button getResetButton()
Returns the resetButton.

Returns:
Button

getApplyButton

public 
Button getApplyButton()
Returns the applyButton.

Returns:
Button

getComposite

public 
Composite getComposite()
Returns the composite.

Returns:
Composite

getMode

public int getMode()
Returns the mode.

Returns:
int
See Also:
ISystemEditPaneStates

getState

public int getState()
Returns the state.

Returns:
int
See Also:
ISystemEditPaneStates

setNewSetByDelete

public void setNewSetByDelete(boolean newSetByDelete)

getNewSetByDelete

public boolean getNewSetByDelete()

backup

public void backup()
Backup state method


restore

public void restore()
Restore state method


RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire