Class HighlightChangesWidget
java.lang.Object
com.orchestranetworks.ui.form.widget.UICustomWidget
com.orchestranetworks.ui.form.widget.UISimpleCustomWidget
com.apgar.common.lib.ui.widget.highlightwidget.HighlightChangesWidget
- All Implemented Interfaces:
com.orchestranetworks.ui.form.widget.UIWidget
public class HighlightChangesWidget
extends com.orchestranetworks.ui.form.widget.UISimpleCustomWidget
Highlight Changes Widget Class which highlight the changes for a record in a child dataspace and this same record in its parent dataspace (snapshot).
Usage:
- Position the widget on each field as needed and set the "master" flag on the field to be displayed first.
- The master is the one that will process the comparison.
- Other widgets will try to retrieve the master.
- The lowest level of detail achievable by this widget is at the level of the field.
Some notes to consider:
- Only one master field set to "true" is necessary per table, because this flag will perform a comparison between child and parent dataspaces, create a hidden div, and display it based on this boolean.
- If the widget is set on an association, make sure to apply "true" to the master field only if it is displayable on the outside (in the association table columns), otherwise the highlight will not appear.
- If there is a need to use a second widget, the customWidgetClass param can be set to this second widget class. This widget class needs to extend the
CustomWidgetclass.
The following is an overview of the different use cases of this widget class.
<!-- Case of field in Association Update (Record is assosciated to a different Record) : Highlight All Fields -->
<div style='display:none' id='master + PK'>
<div id='REC_ + PK'>
<span id='MASTER_ + FIELDPATH1 + PK'>null</span>
<span id='MASTER_ + FIELDPATH2 + PK'>null</span>
<!-- All fields to be highlighted -->
</div>
</div>
<!-- Case of field in Association Update : Highlight Changed Fields only -->
<div style='display:none' id='master + PK'>
<div id='REC_ + PK'>
<span id='MASTER_ + FIELDPATH1 + PK'>Old Value 1</span>
<span id='MASTER_ + FIELDPATH2 + PK'>Old Value 2</span>
</div>
</div>
<!-- Case of normal fields Update -->
<div style='display:none' id='master + PK'>
<div id='REC_ + PK'>
<span id='MASTER_ + FIELDPATH1 + PK'>Old Value 1</span>
<span id='MASTER_ + FIELDPATH2 + PK'>Old Value 2</span>
</div>
</div>
<!-- Case of record creation -->
<div style='display:none' id='master + PK'>
<div id='REC_ + PK'>
<span id='MASTER_ + FIELDPATH1 + PK'>null</span>
<span id='MASTER_ + FIELDPATH2 + PK'>null</span>
<!-- All fields to be highlighted -->
</div>
</div>
<!-- Case of record not yet created -->
<div style='display:none' id='master + PK'>
</div>
<!-- When Drawing a Field -->
<span id='span + SLAVE_ + FIELDPATH + PK'>
<div id='SLAVE_ + FIELDPATH + PK'>
<!-- Field Rendering Goes Here -->
</div>
</span>
<!-- slaveId = 'SLAVE_ + FIELDPATH + PK' -->
<!-- masterId = 'MASTER_ + FIELDPATH + PK' -->
<!-- recordId = 'REC_ + PK' -->
<script>
highlightField+PK('SLAVE_ + FIELDPATH + PK', 'MASTER_ + FIELDPATH + PK', 'REC_ + PK', isListField);
</script>
- Author:
- APGAR Consulting
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHighlightChangesWidget(com.orchestranetworks.schema.Path nodePath, com.orchestranetworks.ui.form.widget.WidgetFactoryContext widgetFactoryContext, HighlightChangesWidgetFactory factoryInstance) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetColorCodeOnAssociationChange(String colorCodeOnAssociationChange) Sets a custom color code to identify associationChange.voidsetColorCodeOnCreate(String colorCodeOnCreate) Sets a custom color code to identify creations.voidsetColorCodeOnUpdate(String colorCodeOnUpdate) Sets a custom color code to identify updates.voidsetCustomWidget(boolean isCustomWidget) Sets the isCustomWidget, which specifies that a second widget is used.voidsetCustomWidgetClass(String customWidgetClass) Sets the customWidgetClass, which specifies the second widget used.voidsetCustomWidgetModuleName(String customWidgetModuleName) Sets the customWidgetModuleName, which is the module name from which the custom widget class is loaded.voidsetCustomWidgetParams(String customWidgetParams) Sets the customWidgetParams, which will be used to draw the widget in case ofisCustomWidget= true.voidsetFactoryInstance(HighlightChangesWidgetFactory factoryInstance) Sets the instance of the factory class of the widget.voidsetFieldOnChangeJSMethod(String fieldOnChangeJSMethod) Sets the name of the JavaScript Method called on field change.voidsetFkInAssociation(Boolean fkInAssociation) Sets the fkInAssociation field which detects changes in an association when the PK of the associated records is not a FK to the main record.voidsetLinkToRecord(boolean isLinkToRecord) Sets the isLinkToRecord field which specifies that a "Link to record" widget is drawn.voidsetLinkToRecordBranch(String linkToRecordBranch) Sets the linkToRecordBranch field which is the target dataspace of the record to be linked through the widget.voidsetLinkToRecordContainer(String linkToRecordContainer) Sets the linkToRecordContainer field which is the target dataset of the record to be linked through the widget.voidsetLinkToRecordKeyFieldPath(String linkToRecordKeyFieldPath) Sets the linkToRecordKeyFieldPath field which is a field of the target record to be linked through the widget based on this field's value.voidsetLinkToRecordTablePath(String linkToRecordTablePath) Sets the linkToRecordTablePath field which is the target table path of the record to be linked through the widget.voidsetMaster(boolean isMaster) Sets the master flag used to compare between the parent and child dataspace to perform the highlighting accordingly.voidsetReadOnly(boolean isReadOnly) Sets the widget to be read-only.voidsetReadOnlyCondition(String readOnlyCondition) Sets the condition for setting the widget to be read-only.voidsetReadOnlyFieldToCheck(String readOnlyFieldToCheck) Sets the field to be checked, if it meets theisReadOnlyOnCondition, the widget will be read-only.voidsetReadOnlyOnCondition(boolean isReadOnlyOnCondition) Sets the widget to be read-only if a condition is verified.voidsetUseEbxDefaultColor(boolean useEbxDefaultColor) Sets the useEbxDefaultColor field which if true, the widget attempts to use the default EBX color.voidwrite(com.orchestranetworks.ui.form.widget.WidgetWriter widgetWriter, com.orchestranetworks.ui.form.widget.WidgetDisplayContext displayContext) Defines and draws the widget depending on the parameters of theHighlightChangesWidgetFactoryinstance.Methods inherited from class com.orchestranetworks.ui.form.widget.UISimpleCustomWidget
validateMethods inherited from class com.orchestranetworks.ui.form.widget.UICustomWidget
isDisplayingCustomWidgetValidationMessage, isEditorDisabled, setEditorDisabled, zza, zza, zzb
-
Field Details
-
MASTER_FIELD_PREFIX
Prefix of the master field used when drawing the widget.- See Also:
-
SLAVE_FIELD_PREFIX
Prefix of the slave used when drawing the widget.- See Also:
-
-
Constructor Details
-
HighlightChangesWidget
public HighlightChangesWidget(com.orchestranetworks.schema.Path nodePath, com.orchestranetworks.ui.form.widget.WidgetFactoryContext widgetFactoryContext, HighlightChangesWidgetFactory factoryInstance) Constructor.- Parameters:
nodePath- PathwidgetFactoryContext- WidgetFactoryContextfactoryInstance- Instance ofHighlightChangesWidgetFactory
-
-
Method Details
-
write
public void write(com.orchestranetworks.ui.form.widget.WidgetWriter widgetWriter, com.orchestranetworks.ui.form.widget.WidgetDisplayContext displayContext) Defines and draws the widget depending on the parameters of theHighlightChangesWidgetFactoryinstance.- Specified by:
writein classcom.orchestranetworks.ui.form.widget.UISimpleCustomWidget- Parameters:
widgetWriter- WidgetWriterdisplayContext- WidgetDisplayContext
-
setFactoryInstance
Sets the instance of the factory class of the widget.- Parameters:
factoryInstance- HighlightChangesWidgetFactory
-
setMaster
public void setMaster(boolean isMaster) Sets the master flag used to compare between the parent and child dataspace to perform the highlighting accordingly.- Parameters:
isMaster- Boolean value
-
setFkInAssociation
Sets the fkInAssociation field which detects changes in an association when the PK of the associated records is not a FK to the main record.- Parameters:
fkInAssociation- Boolean value
-
setReadOnly
public void setReadOnly(boolean isReadOnly) Sets the widget to be read-only.- Parameters:
isReadOnly- Boolean value
-
setReadOnlyOnCondition
public void setReadOnlyOnCondition(boolean isReadOnlyOnCondition) Sets the widget to be read-only if a condition is verified.- Parameters:
isReadOnlyOnCondition- Boolean value
-
setReadOnlyFieldToCheck
Sets the field to be checked, if it meets theisReadOnlyOnCondition, the widget will be read-only.- Parameters:
readOnlyFieldToCheck- Path of field to check
-
setReadOnlyCondition
Sets the condition for setting the widget to be read-only.- Parameters:
readOnlyCondition- String value which thereadOnlyFieldToCheckvalue will be compared to.
-
setCustomWidget
public void setCustomWidget(boolean isCustomWidget) Sets the isCustomWidget, which specifies that a second widget is used.- Parameters:
isCustomWidget- Boolean value
-
setCustomWidgetClass
Sets the customWidgetClass, which specifies the second widget used.- Parameters:
customWidgetClass- Class in binary name format
-
setCustomWidgetModuleName
Sets the customWidgetModuleName, which is the module name from which the custom widget class is loaded.- Parameters:
customWidgetModuleName- Module Name as String
-
setCustomWidgetParams
Sets the customWidgetParams, which will be used to draw the widget in case ofisCustomWidget= true.- Parameters:
customWidgetParams- Parameters as JSON String.
-
setLinkToRecord
public void setLinkToRecord(boolean isLinkToRecord) Sets the isLinkToRecord field which specifies that a "Link to record" widget is drawn.- Parameters:
isLinkToRecord- Boolean value
-
setLinkToRecordBranch
Sets the linkToRecordBranch field which is the target dataspace of the record to be linked through the widget.- Parameters:
linkToRecordBranch- Record Branch name as a String
-
setLinkToRecordContainer
Sets the linkToRecordContainer field which is the target dataset of the record to be linked through the widget.- Parameters:
linkToRecordContainer- Record Container name as a String
-
setLinkToRecordTablePath
Sets the linkToRecordTablePath field which is the target table path of the record to be linked through the widget.- Parameters:
linkToRecordTablePath- Record Table path as a String
-
setLinkToRecordKeyFieldPath
Sets the linkToRecordKeyFieldPath field which is a field of the target record to be linked through the widget based on this field's value.- Parameters:
linkToRecordKeyFieldPath- Record Key field path as a String
-
setFieldOnChangeJSMethod
Sets the name of the JavaScript Method called on field change.- Parameters:
fieldOnChangeJSMethod- String name of the JavaScript Method for field change
-
setColorCodeOnUpdate
Sets a custom color code to identify updates.- Parameters:
colorCodeOnUpdate- Color code in String format
-
setColorCodeOnCreate
Sets a custom color code to identify creations.- Parameters:
colorCodeOnCreate- Color code in String format
-
setColorCodeOnAssociationChange
Sets a custom color code to identify associationChange.- Parameters:
colorCodeOnAssociationChange- Color code in String format
-
setUseEbxDefaultColor
public void setUseEbxDefaultColor(boolean useEbxDefaultColor) Sets the useEbxDefaultColor field which if true, the widget attempts to use the default EBX color.- Parameters:
useEbxDefaultColor- Boolean value
-