Class AbstractPart
- java.lang.Object
-
- net.sf.okapi.common.uidescription.AbstractPart
-
- All Implemented Interfaces:
IParameterDescriptor
- Direct Known Subclasses:
CheckboxPart,CheckListPart,CodeFinderPart,FolderInputPart,ListSelectionPart,PathInputPart,SeparatorPart,SpinInputPart,TextInputPart,TextLabelPart
public abstract class AbstractPart extends Object implements IParameterDescriptor
Base UI part descriptor. All other UI part descriptors are derived from this one.
-
-
Field Summary
Fields Modifier and Type Field Description protected IContainerPartcontainerprotected booleanenabledOnSelectionprotected booleanlabelFlushedprotected booleanlabelNextToInputprotected AbstractPartmasterPartprotected ParameterDescriptorparamDescriptorprotected booleanverticalprotected booleanwithLabel
-
Constructor Summary
Constructors Constructor Description AbstractPart(ParameterDescriptor paramDescriptor)Creates a new BasePart object with a given parameter description.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckType()Checks the types supported by this UI part.IContainerPartgetContainer()Gets the container part of this part.StringgetDisplayName()Gets the localizable name of this parameter.AbstractPartgetMasterPart()Gets the master part associated with this UI part.StringgetName()Gets the programming name of this parameter.ObjectgetParent()Gets the object where this parameter is instantiated.MethodgetReadMethod()Gets the method to obtain the current value of this parameter.StringgetShortDescription()Gets the short localizable description of this parameter.TypegetType()Gets the type of this parameter.MethodgetWriteMethod()Gets the method to set a new value for this this parameter.booleanisEnabledOnSelection()Indicates how this part is enabled in relation to its master part.booleanisLabelFlushed()Indicates if the label of this UI part should be flushed next to the part.booleanisLabelNextToInput()Indicates that the label for this part is to be displayed next to the input field.booleanisVertical()Indicates if this UI part should be arranged vertically.booleanisWithLabel()Indicates if this UI part should be displayed with a label.voidsetContainer(IContainerPart container)Sets the container part for this part.voidsetDisplayName(String displayName)Sets the localizable name of this parameter.voidsetLabelFlushed(boolean labelFlushed)Sets the flag indicating if the label of this UI part should be flushed next to the part.voidsetLabelNextToInput(boolean labelNextToInput)Sets the indicator that tells if the label for this part is to be displayed next to the input field.voidsetMasterPart(AbstractPart masterPart, boolean enabledOnSelection)Binds this part to a master part.voidsetShortDescription(String shortDescription)Gets the short localizable description of this parameter.voidsetVertical(boolean vertical)Sets the flag indicating if this UI part should be arranged vertically.voidsetWithLabel(boolean withLabel)Sets the flag indicating if this UI part should be displayed with a label.
-
-
-
Field Detail
-
paramDescriptor
protected ParameterDescriptor paramDescriptor
-
container
protected IContainerPart container
-
vertical
protected boolean vertical
-
labelFlushed
protected boolean labelFlushed
-
withLabel
protected boolean withLabel
-
labelNextToInput
protected boolean labelNextToInput
-
masterPart
protected AbstractPart masterPart
-
enabledOnSelection
protected boolean enabledOnSelection
-
-
Constructor Detail
-
AbstractPart
public AbstractPart(ParameterDescriptor paramDescriptor)
Creates a new BasePart object with a given parameter description.- Parameters:
paramDescriptor- the parameter description for this UI part.
-
-
Method Detail
-
getDisplayName
public String getDisplayName()
Description copied from interface:IParameterDescriptorGets the localizable name of this parameter.- Specified by:
getDisplayNamein interfaceIParameterDescriptor- Returns:
- the localizable name of this parameter.
-
getName
public String getName()
Description copied from interface:IParameterDescriptorGets the programming name of this parameter. the name must follow the JavaBean naming conventions. For example, a parameter accessible bygetMyTextandsetMyTextmust be namedmyText- Specified by:
getNamein interfaceIParameterDescriptor- Returns:
- the programming name of this parameter.
-
getParent
public Object getParent()
Description copied from interface:IParameterDescriptorGets the object where this parameter is instantiated.- Specified by:
getParentin interfaceIParameterDescriptor- Returns:
- the object where this parameter is instantiated.
-
getReadMethod
public Method getReadMethod()
Description copied from interface:IParameterDescriptorGets the method to obtain the current value of this parameter.- Specified by:
getReadMethodin interfaceIParameterDescriptor- Returns:
- the method to get the current value of this parameter.
-
getShortDescription
public String getShortDescription()
Description copied from interface:IParameterDescriptorGets the short localizable description of this parameter.- Specified by:
getShortDescriptionin interfaceIParameterDescriptor- Returns:
- the short localizable description of this parameter.
-
getType
public Type getType()
Description copied from interface:IParameterDescriptorGets the type of this parameter.- Specified by:
getTypein interfaceIParameterDescriptor- Returns:
- the type of this parameter.
-
getWriteMethod
public Method getWriteMethod()
Description copied from interface:IParameterDescriptorGets the method to set a new value for this this parameter.- Specified by:
getWriteMethodin interfaceIParameterDescriptor- Returns:
- the method to set a new value of this parameter.
-
setDisplayName
public void setDisplayName(String displayName)
Description copied from interface:IParameterDescriptorSets the localizable name of this parameter.- Specified by:
setDisplayNamein interfaceIParameterDescriptor- Parameters:
displayName- the new localizable name of this parameter.
-
setShortDescription
public void setShortDescription(String shortDescription)
Description copied from interface:IParameterDescriptorGets the short localizable description of this parameter.- Specified by:
setShortDescriptionin interfaceIParameterDescriptor- Parameters:
shortDescription- the new short localizable description of this parameter.
-
isWithLabel
public boolean isWithLabel()
Indicates if this UI part should be displayed with a label. When this option is not set: no label is displayed and the entry field takes the space where the label would be.- Returns:
- true if this UI part should be displayed with a label.
-
setWithLabel
public void setWithLabel(boolean withLabel)
Sets the flag indicating if this UI part should be displayed with a label.- Parameters:
withLabel- true if this UI part should be displayed with a label.
-
isVertical
public boolean isVertical()
Indicates if this UI part should be arranged vertically. By default it is not.- Returns:
- true if this UI part should be arranged vertically.
-
setVertical
public void setVertical(boolean vertical)
Sets the flag indicating if this UI part should be arranged vertically.- Parameters:
vertical- the new flag indicating if this UI part should be arranged vertically.
-
isLabelFlushed
public boolean isLabelFlushed()
Indicates if the label of this UI part should be flushed next to the part.- Returns:
- true if the label of this UI part should be flushed next to the part.
-
setLabelFlushed
public void setLabelFlushed(boolean labelFlushed)
Sets the flag indicating if the label of this UI part should be flushed next to the part.- Parameters:
labelFlushed- the new flag indicating if the label of this UI part should be flushed next to the part.
-
getContainer
public IContainerPart getContainer()
Gets the container part of this part.- Returns:
- the container part of this part or null.
-
setContainer
public void setContainer(IContainerPart container)
Sets the container part for this part.- Parameters:
container- the new container part for this part.
-
setMasterPart
public void setMasterPart(AbstractPart masterPart, boolean enabledOnSelection)
Binds this part to a master part. Use this to make this part be enabled or disabled depending on the specified master part.- Parameters:
masterPart- the UI part that enables or disables this part.enabledOnSelection- true if this part is enabled only when the master part is selected, false to enable this part when the master part is not selected.
-
getMasterPart
public AbstractPart getMasterPart()
Gets the master part associated with this UI part.- Returns:
- the master part associated with this UI part, or null if there is none.
-
isEnabledOnSelection
public boolean isEnabledOnSelection()
Indicates how this part is enabled in relation to its master part.- Returns:
- true if this part is enabled only when the master part is selected, false to enable this part when the master part is not selected.
-
isLabelNextToInput
public boolean isLabelNextToInput()
Indicates that the label for this part is to be displayed next to the input field.- Returns:
- true if the label for this part is to be displayed next to the input field.
-
setLabelNextToInput
public void setLabelNextToInput(boolean labelNextToInput)
Sets the indicator that tells if the label for this part is to be displayed next to the input field.- Parameters:
labelNextToInput- true to set the indicator so the label for this part is to be displayed next to the input field.
-
checkType
protected void checkType()
Checks the types supported by this UI part.- Throws:
OkapiNotImplementedException- if this UI part does not support the type of the parameter description it is created with.
-
-