org.ow2.clif.console.lib.egui.editor
Class TestPlanVisualDisplay

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.custom.CTabFolder
                      extended by org.ow2.clif.console.lib.egui.editor.TestPlanVisualDisplay
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class TestPlanVisualDisplay
extends org.eclipse.swt.custom.CTabFolder

Tab Folder that containts one tab for each kind of blade. All blades of the same class are grouped together.
The blades are displayed in a table with 7 columns:

A check box and the last state column are optionnal. Use the withCheck and withState constructor boolean to show/hide them.
A selection changed listener can be added in the constructor too.

Author:
Manuel AZEMA

Field Summary
 
Fields inherited from class org.eclipse.swt.custom.CTabFolder
borderInsideRGB, borderMiddleRGB, borderOutsideRGB, marginHeight, marginWidth, MIN_TAB_WIDTH
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
TestPlanVisualDisplay(org.eclipse.swt.widgets.Composite parent, java.util.Map<java.lang.String,ClifDeployDefinition> testPlan, org.eclipse.ui.forms.IManagedForm managedForm, org.eclipse.ui.IEditorInput editorInput, int style, org.eclipse.jface.viewers.ISelectionChangedListener selectionChangedListener, org.eclipse.swt.events.MouseListener checkListener, boolean withCheck, boolean withState)
          Create a tab folder that display in tab each blade sort by class.
 
Method Summary
 java.util.Map<java.lang.String,ClifDeployDefinition> addBlade()
          Add an injector or a probe in the opened tab (with the right blade class).
 void createTabByClass()
          Create one tab by blade class.
 void deselectAll()
          If withCheck, deselect all blades in every tabs.
 java.util.List<java.lang.String> getCheckedBlades()
           
 java.lang.String getSelectedBlade()
          Return id of the selected blade
 java.util.Map<java.lang.String,ClifDeployDefinition> getTestPlan()
          Get test plan
 BladeState globalState()
          Return the global state of all selected blades.
 void initBladeStates()
          Init blade state to UNDEPLOYED state.
 boolean isTestPlanCorrect()
          Test if args are correct
 boolean isWithCheck()
          Return true if check box is diplayed in the first column.
 boolean isWithState()
          Return true if state column is diplayed as the last column.
 java.util.Map<java.lang.String,ClifDeployDefinition> modifyBlade(java.lang.String bladeId, java.lang.String newBladeId, java.lang.String serverName, java.lang.String bClass, java.lang.String argument, java.lang.String comment, boolean isProbe)
          Modify the specified blade with these new properties.
 void refresh()
          Refresh all table viewer in each tabs.
 java.util.Map<java.lang.String,ClifDeployDefinition> removeAllBlades()
          Remove all blades in the test plan.
 void removeAllTab()
          Remove all tabs.
 java.util.Map<java.lang.String,ClifDeployDefinition> removeSelectedBlade()
          Remove the selected blade in the opened tab.
 void selectAll()
          If withCheck, select all blades in every tabs.
 java.lang.String[] selectedTestPlan()
          Return a new test plan with the selected blades.
 void setBladeState(java.lang.String id, BladeState state)
          Modify the state of the id blade.
 void setSelection(java.lang.String bladeId, boolean removeSelectListener)
          Select the right blade in table.
 void setTestPlan(java.util.Map<java.lang.String,ClifDeployDefinition> testPlan)
          Set test plan
 
Methods inherited from class org.eclipse.swt.custom.CTabFolder
addCTabFolder2Listener, addCTabFolderListener, addSelectionListener, computeTrim, getBorderVisible, getClientArea, getItem, getItem, getItemCount, getItems, getMaximized, getMaximizeVisible, getMinimized, getMinimizeVisible, getMinimumCharacters, getMRUVisible, getSelection, getSelectionBackground, getSelectionForeground, getSelectionIndex, getSimple, getSingle, getStyle, getTabHeight, getTabPosition, getTopRight, getUnselectedCloseVisible, getUnselectedImageVisible, indexOf, removeCTabFolder2Listener, removeCTabFolderListener, removeSelectionListener, setBackground, setBorderVisible, setFont, setForeground, setInsertMark, setInsertMark, setLayout, setMaximized, setMaximizeVisible, setMinimized, setMinimizeVisible, setMinimumCharacters, setMRUVisible, setSelection, setSelection, setSelectionBackground, setSelectionBackground, setSelectionBackground, setSelectionBackground, setSelectionForeground, setSimple, setSingle, setTabHeight, setTabPosition, setTopRight, setTopRight, setUnselectedCloseVisible, setUnselectedImageVisible, showItem, showSelection
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestPlanVisualDisplay

public TestPlanVisualDisplay(org.eclipse.swt.widgets.Composite parent,
                             java.util.Map<java.lang.String,ClifDeployDefinition> testPlan,
                             org.eclipse.ui.forms.IManagedForm managedForm,
                             org.eclipse.ui.IEditorInput editorInput,
                             int style,
                             org.eclipse.jface.viewers.ISelectionChangedListener selectionChangedListener,
                             org.eclipse.swt.events.MouseListener checkListener,
                             boolean withCheck,
                             boolean withState)
Create a tab folder that display in tab each blade sort by class.

Parameters:
parent - the composite parent
testPlan - the display test plan
managedForm - the managed form
editorInput - the editor input
style - the tab folde style
selectionChangedListener - default listener for all table viewer (can be null)
checkListener - listener used when check box are modified
withCheck - true if check box is diplayed in the first column
withState - true if state column is diplayed as the last column
Method Detail

createTabByClass

public void createTabByClass()
Create one tab by blade class. Add blades in the same tab if they have the same class. Injectors are in the same tab.


removeAllTab

public void removeAllTab()
Remove all tabs.


isWithCheck

public boolean isWithCheck()
Return true if check box is diplayed in the first column.

Returns:
true if check box is diplayed in the first column

isWithState

public boolean isWithState()
Return true if state column is diplayed as the last column.

Returns:
true if state column is diplayed as the last column

refresh

public void refresh()
Refresh all table viewer in each tabs.


selectAll

public void selectAll()
If withCheck, select all blades in every tabs.


deselectAll

public void deselectAll()
If withCheck, deselect all blades in every tabs.


selectedTestPlan

public java.lang.String[] selectedTestPlan()
Return a new test plan with the selected blades.
Return all test plan if not with ckeck.

Returns:
the test plan with the selected blades

getSelectedBlade

public java.lang.String getSelectedBlade()
Return id of the selected blade

Returns:
String id of the blade

getCheckedBlades

public java.util.List<java.lang.String> getCheckedBlades()

setSelection

public void setSelection(java.lang.String bladeId,
                         boolean removeSelectListener)
Select the right blade in table.

Parameters:
bladeId - blade's id to select
removeSelectListener - true if a selectlistener has been assigned to this blade in viewer needed to avoid recurrent setSelection

initBladeStates

public void initBladeStates()
Init blade state to UNDEPLOYED state.


setBladeState

public void setBladeState(java.lang.String id,
                          BladeState state)
Modify the state of the id blade.

Parameters:
id - the id blade
state - the new state

globalState

public BladeState globalState()
Return the global state of all selected blades.

Returns:
the global state of all selected blades

addBlade

public java.util.Map<java.lang.String,ClifDeployDefinition> addBlade()
Add an injector or a probe in the opened tab (with the right blade class). If test plan is empty, a cpu probe is added (so a cpu tab).

Returns:
Map the new test plan

modifyBlade

public java.util.Map<java.lang.String,ClifDeployDefinition> modifyBlade(java.lang.String bladeId,
                                                                        java.lang.String newBladeId,
                                                                        java.lang.String serverName,
                                                                        java.lang.String bClass,
                                                                        java.lang.String argument,
                                                                        java.lang.String comment,
                                                                        boolean isProbe)
                                                                 throws ExistingBladeIdException,
                                                                        BadBladePropertiesException
Modify the specified blade with these new properties. Adapt tabs display.

Parameters:
bladeId - id of the modify blade
newBladeId - new blade id (can be the same as bladeId)
serverName - the CLIF server name
bClass - the blade class (not empty)
argument - the blade definition argument
comment - the blade definition comment
isProbe - true if probe, else injector
Returns:
the new blade id
Throws:
ExistingBladeIdException - if new blade id already exists
BadBladePropertiesException - if id, role or class are not defined

removeSelectedBlade

public java.util.Map<java.lang.String,ClifDeployDefinition> removeSelectedBlade()
Remove the selected blade in the opened tab.

Returns:
Map the new test plan

removeAllBlades

public java.util.Map<java.lang.String,ClifDeployDefinition> removeAllBlades()
Remove all blades in the test plan.

Returns:
Map the new test plan

getTestPlan

public java.util.Map<java.lang.String,ClifDeployDefinition> getTestPlan()
Get test plan

Returns:
Map the test plan

setTestPlan

public void setTestPlan(java.util.Map<java.lang.String,ClifDeployDefinition> testPlan)
Set test plan

Parameters:
testPlan - The testPlan to set.

isTestPlanCorrect

public boolean isTestPlanCorrect()
Test if args are correct

Returns:
boolean true if args are correct