fr.cnes.genopus.utils
Class GPInstrumentedTestPanel

java.lang.Object
  extended by fr.cnes.genius.main.GComponent
      extended by fr.cnes.genius.lowLevel.GPanel
          extended by fr.cnes.genopus.utils.GPInstrumentedTestPanel
All Implemented Interfaces:
fr.cnes.genius.main.GClear, fr.cnes.genius.main.GCondensedStatusInterface, fr.cnes.genius.main.GDisplay, fr.cnes.genius.main.GReadWrite

public abstract class GPInstrumentedTestPanel
extends fr.cnes.genius.lowLevel.GPanel
implements fr.cnes.genius.main.GDisplay, fr.cnes.genius.main.GClear, fr.cnes.genius.main.GReadWrite, fr.cnes.genius.main.GCondensedStatusInterface

Class to test basic widget aspects that are similar for all widgets: enabled/disabled status getPatriusObject method, getters for the widget subcomponents, etc. It consists on a split pane with the test component in the left panel and some generic test instrument widgets in the right panel. To use it, make your GPXXXTest classes to extend this class.

Author:
ffsm

Nested Class Summary
 
Nested classes/interfaces inherited from class fr.cnes.genius.lowLevel.GPanel
fr.cnes.genius.lowLevel.GPanel.Panel, fr.cnes.genius.lowLevel.GPanel.ScrollBarVisibility
 
Nested classes/interfaces inherited from class fr.cnes.genius.main.GComponent
fr.cnes.genius.main.GComponent.CopyPasteOperation, fr.cnes.genius.main.GComponent.DisplayIndicatorStatus, fr.cnes.genius.main.GComponent.ItemType, fr.cnes.genius.main.GComponent.Operation
 
Field Summary
 
Fields inherited from class fr.cnes.genius.main.GComponent
NAME_ATTRIBUTE
 
Constructor Summary
GPInstrumentedTestPanel()
          Constructor.
 
Method Summary
 void clear()
          
 void display()
          
 void generic()
          
 String getPatriusObjectString()
          Method to get a string representation of the patrius object extracted from the test component.
abstract  fr.cnes.genius.main.GComponent[] getSubcomponents()
          Getter of the list of subcomponents of the test component.
 fr.cnes.genius.main.GComponent getTestComponent(int i)
          Getter for a test component.
 void read()
          
abstract  void setDefaultPatriusObject(Object patriusObject)
          Method to set a default PATRIUS object to the test component.
 void setExtraComponentsToDisplay(fr.cnes.genius.main.GComponent... components)
          Method to add particular widgets to the right panel of the split pane (instruments panel).
 void setOtherConstructions(String[] otherConstructionDescrs, fr.cnes.genius.main.GComponent[] otherConstructions)
          Method to add to the test a set of buttons that will open a new dialog each one, with another example of construction of the test component (with alternative arguments).
abstract  void setPatriusObject(Object patriusObject)
          Method to set a PATRIUS object to the test component.
<PatriusType>
void
setPatriusObjectsToBeSet(String[] patriusObjectsLabels, PatriusType[] patriusObjects)
          Method to define the patrius objects that can be set into the widget.
abstract  void setSavedPatriusObject(Object patriusObject)
          Method to set a saved PATRIUS object to the test component.
 void setTestComponent(fr.cnes.genius.main.GComponent... testComponent)
          Setter for the test component(s).
 void setTestComponentMinWidth(int minWidth)
          Set the prefered with of the left panel of the split pane, the test component panel.
 void updateCondensedStatus(fr.cnes.genius.main.GCondensedStatus condensedStatus)
          
 void write()
          
 void writeToInfoTextArea(String textAreaTitle, String textAreaContents)
          Method to update the info text area with new contents.
 
Methods inherited from class fr.cnes.genius.lowLevel.GPanel
getClassConstraint, getComponent, getHorizontalScroll, getInnerDescendantClassConstraint, getJPanel, getJScrollPane, getStringClassConstraint, getVerticalScroll, mainClear, mainDisplay, put, setClassConstraint, setColumnConstraints, setHorizontalScroll, setInnerDescendantClassConstraint, setLayoutConstraints, setPreferredSize, setRowConstraints, setVerticalScroll
 
Methods inherited from class fr.cnes.genius.main.GComponent
activateConstraintsByType, attachCopyPasteMenu, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getName, getNameInConfigFile, getOperationSaveValue, getSimpleWidgetId, getStatus, getStringConstraint, getSubComponent, getWidgetId, handleCopyPasteEvent, handleProcessEventException, isCopyPasteEvent, isEnabled, isModified, launchInvalidPositionException, parseSimpleConstraint, processGEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDisplayIsModifiedIndicator, setElement, setEnabled, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setNameAndCommentInConfigFile, setNameInConfigFile, setStatus, setStringConstraint, setToolTipText, setWidgetId, setWidth, updateIsModifiedIndicator, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPInstrumentedTestPanel

public GPInstrumentedTestPanel()
Constructor. Do not forget to call the following methods after construction:
- #setTestComponent(GComponent) mandatory,
- setExtraComponentsToDisplay(GComponent...) optional
- setPatriusObjectsToBeSet(String[], Object[]) optional
- setOtherConstructions(String[], GComponent[]) optional

Method Detail

getTestComponent

public fr.cnes.genius.main.GComponent getTestComponent(int i)
Getter for a test component.

Parameters:
i - component index
Returns:
the test component

setOtherConstructions

public void setOtherConstructions(String[] otherConstructionDescrs,
                                  fr.cnes.genius.main.GComponent[] otherConstructions)
Method to add to the test a set of buttons that will open a new dialog each one, with another example of construction of the test component (with alternative arguments).

Parameters:
otherConstructionDescrs - short descriptions of each instantiation (it will be added to the associated button and the dialog title).
otherConstructions - instantiations of test component with alternative arguments.

setTestComponent

public void setTestComponent(fr.cnes.genius.main.GComponent... testComponent)
Setter for the test component(s). This method must be called after construction.

Parameters:
testComponent - the test component(s) to be set

setExtraComponentsToDisplay

public void setExtraComponentsToDisplay(fr.cnes.genius.main.GComponent... components)
Method to add particular widgets to the right panel of the split pane (instruments panel). Implement GListener interface and override GListener.after(fr.cnes.genius.main.GEvent) method to specify the actions to be performed by these widgets.

Parameters:
components - list of widgets to be added to the instruments panel.

writeToInfoTextArea

public void writeToInfoTextArea(String textAreaTitle,
                                String textAreaContents)
Method to update the info text area with new contents.

Parameters:
textAreaTitle - text to show in the label
textAreaContents - text to show in the text area

generic

public void generic()
             throws fr.cnes.genius.exception.GException

Specified by:
generic in class fr.cnes.genius.lowLevel.GPanel
Throws:
fr.cnes.genius.exception.GException

display

public void display()
             throws fr.cnes.genius.exception.GException

Specified by:
display in interface fr.cnes.genius.main.GDisplay
Throws:
fr.cnes.genius.exception.GException

clear

public void clear()
           throws fr.cnes.genius.exception.GException

Specified by:
clear in interface fr.cnes.genius.main.GClear
Throws:
fr.cnes.genius.exception.GException

read

public void read()
          throws fr.cnes.genius.exception.GException

Specified by:
read in interface fr.cnes.genius.main.GReadWrite
Throws:
fr.cnes.genius.exception.GException

write

public void write()
           throws fr.cnes.genius.exception.GException

Specified by:
write in interface fr.cnes.genius.main.GReadWrite
Throws:
fr.cnes.genius.exception.GException

updateCondensedStatus

public void updateCondensedStatus(fr.cnes.genius.main.GCondensedStatus condensedStatus)

Specified by:
updateCondensedStatus in interface fr.cnes.genius.main.GCondensedStatusInterface

getPatriusObjectString

public String getPatriusObjectString()
                              throws fr.cnes.genius.exception.GException
Method to get a string representation of the patrius object extracted from the test component.

Returns:
the string representation of the patrius object
Throws:
fr.cnes.genius.exception.GException - if the test component does not implements GPPatrius interface.

setPatriusObjectsToBeSet

public <PatriusType> void setPatriusObjectsToBeSet(String[] patriusObjectsLabels,
                                                   PatriusType[] patriusObjects)
Method to define the patrius objects that can be set into the widget. The labels will fulfill the combo box for patrius objects. The selected object in the combo box will be set into the widget when clicking set patrius object button.

Type Parameters:
PatriusType - Patrius object class.
Parameters:
patriusObjectsLabels - patrius object labels to be used in the combo box
patriusObjects - patrius objects to be set to the widget

setTestComponentMinWidth

public void setTestComponentMinWidth(int minWidth)
Set the prefered with of the left panel of the split pane, the test component panel.

Parameters:
minWidth - prefered with for the panel containing the test component.

getSubcomponents

public abstract fr.cnes.genius.main.GComponent[] getSubcomponents()
Getter of the list of subcomponents of the test component. It must be overriden by GPXXXTest classes.
Exemple for the GPAttitudeSequenceTest:
 public GComponent[] getSubcomponents() {
    return new GComponent[] { m_testComponent.getReferenceDateGLabel(),
        m_testComponent.getDateModeGChoice(), m_testComponent.getReferenceGPAbsoluteDate(),
        m_testComponent.getExternalGPAbsoluteDate(), m_testComponent.getAttitudeLawsGLabel(),
        m_testComponent.getSelectLawsGButton(), m_testComponent.getAttitudeLawsGDialog(),
        m_testComponent.getAttitudeLawsGComponentList(), m_testComponent.getSwitchesGLabel(),
        m_testComponent.getSwitchesGComponentList() };
 }
 

Returns:
an array with all the subcomponents of the test component.

setPatriusObject

public abstract void setPatriusObject(Object patriusObject)
                               throws fr.cnes.genius.exception.GException
Method to set a PATRIUS object to the test component. It must be overriden by GPXXXTest classes.
Example for GPAttitudeLawSelectorTest:
 public void setPatriusObject(Object patriusObject) throws GException {
     CustomAttitudeLaw attitudeLaw = ((CustomAttitudeLaw) patriusObject);
     m_testComponent.setAttitudeLaw(attitudeLaw);
 }
 

Parameters:
patriusObject - the patrius object
Throws:
fr.cnes.genius.exception.GException - in case of problem

setDefaultPatriusObject

public abstract void setDefaultPatriusObject(Object patriusObject)
                                      throws fr.cnes.genius.exception.GException
Method to set a default PATRIUS object to the test component. It must be overriden by GPXXXTest classes.
Example for GPAttitudeLawSelectorTest:
 public void setDefaultPatriusObject(Object patriusObject) throws GException {
     CustomAttitudeLaw attitudeLaw = ((CustomAttitudeLaw) patriusObject);
     m_testComponent.setDefaultAttitudeLaw(attitudeLaw);
 }
 

Parameters:
patriusObject - the patrius object to be set as default one
Throws:
fr.cnes.genius.exception.GException - in case of problem

setSavedPatriusObject

public abstract void setSavedPatriusObject(Object patriusObject)
                                    throws fr.cnes.genius.exception.GException
Method to set a saved PATRIUS object to the test component. It must be overriden by GPXXXTest classes.
Example for GPAttitudeLawSelectorTest:
 public void setSavedPatriusObject(Object patriusObject) throws GException {
     CustomAttitudeLaw attitudeLaw = ((CustomAttitudeLaw) patriusObject);
     m_testComponent.setSavedAttitudeLaw(attitudeLaw);
 }
 

Parameters:
patriusObject - the patrius object to be set as saved one
Throws:
fr.cnes.genius.exception.GException - in case of problem


Copyright © 2017. All rights reserved.