Idempiere 4058 (#312)
* IDEMPIERE-4058 - tab editor: new options for editing and customizing fields (window customization) * IDEMPIERE-4058 tab editor: new options for editing and customizing fields (window customization) Fix issues with migration scripts Co-authored-by: muriloht <muriloht@devcoffee.com.br>
This commit is contained in:
parent
82a5897bb4
commit
014b45246f
|
@ -0,0 +1,43 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- IDEMPIERE-4058 tab editor: new options for editing and customizing fields (window customization)
|
||||||
|
-- Oct 8, 2019, 1:34:57 PM BRT
|
||||||
|
UPDATE AD_Process SET AccessLevel='7',Updated=TO_DATE('2019-10-08 13:34:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=200015
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:35:16 PM BRT
|
||||||
|
INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,Action,AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo,EntityType) VALUES (0,0,TO_DATE('2019-10-08 13:35:16','YYYY-MM-DD HH24:MI:SS'),0,'Tab Editor','Y',200109,'Tab Editor',TO_DATE('2019-10-08 13:35:16','YYYY-MM-DD HH24:MI:SS'),0,'N','3efa5e1a-99f1-4316-9724-7cc6f5b694eb','W',394,200015,'@IsActive@=Y',10,'D')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:02 PM BRT
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (214327,0,'Field Group','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',464,'AD_FieldGroup_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2019-10-08 13:37:02','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-10-08 13:37:02','YYYY-MM-DD HH24:MI:SS'),0,1500,'Y','N','D','N','N','N','Y','f69f9b76-94c6-466e-b7b7-5bd86ae339ba','Y',0,'N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:07 PM BRT
|
||||||
|
UPDATE AD_Column SET FKConstraintName='ADFieldGroup_ADUserDefField', FKConstraintType='N',Updated=TO_DATE('2019-10-08 13:37:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=214327
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:07 PM BRT
|
||||||
|
ALTER TABLE AD_UserDef_Field ADD AD_FieldGroup_ID NUMBER(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:07 PM BRT
|
||||||
|
ALTER TABLE AD_UserDef_Field ADD CONSTRAINT ADFieldGroup_ADUserDefField FOREIGN KEY (AD_FieldGroup_ID) REFERENCES ad_fieldgroup(ad_fieldgroup_id) DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:45 PM BRT
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206521,'Field Group','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',395,214327,'Y',22,330,'N','N','N','N',0,0,'Y',TO_DATE('2019-10-08 13:37:45','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-10-08 13:37:45','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','6f71bd66-6a96-40ad-a016-42f74fcb3c95','Y',330,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:38:59 PM BRT
|
||||||
|
UPDATE AD_Field SET SeqNo=155, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-10-08 13:38:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206521
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 9, 2020, 8:40:22 AM BRT
|
||||||
|
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Window customization Language != Session Language',0,0,'Y',TO_DATE('2020-10-09 08:40:22','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-10-09 08:40:22','YYYY-MM-DD HH24:MI:SS'),100,200641,'TabEditorWrongLanguage','D','dcf44ca0-91e1-4c26-a684-6c645ef11eeb')
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('202010211353_IDEMPIERE-4058.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
-- IDEMPIERE-4058 tab editor: new options for editing and customizing fields (window customization)
|
||||||
|
-- Oct 8, 2019, 1:34:57 PM BRT
|
||||||
|
UPDATE AD_Process SET AccessLevel='7',Updated=TO_TIMESTAMP('2019-10-08 13:34:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=200015
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:35:16 PM BRT
|
||||||
|
INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,"action",AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo,EntityType) VALUES (0,0,TO_TIMESTAMP('2019-10-08 13:35:16','YYYY-MM-DD HH24:MI:SS'),0,'Tab Editor','Y',200109,'Tab Editor',TO_TIMESTAMP('2019-10-08 13:35:16','YYYY-MM-DD HH24:MI:SS'),0,'N','3efa5e1a-99f1-4316-9724-7cc6f5b694eb','W',394,200015,'@IsActive@=Y',10,'D')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:02 PM BRT
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (214327,0,'Field Group','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',464,'AD_FieldGroup_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2019-10-08 13:37:02','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-10-08 13:37:02','YYYY-MM-DD HH24:MI:SS'),0,1500,'Y','N','D','N','N','N','Y','f69f9b76-94c6-466e-b7b7-5bd86ae339ba','Y',0,'N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:07 PM BRT
|
||||||
|
UPDATE AD_Column SET FKConstraintName='ADFieldGroup_ADUserDefField', FKConstraintType='N',Updated=TO_TIMESTAMP('2019-10-08 13:37:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=214327
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:07 PM BRT
|
||||||
|
ALTER TABLE AD_UserDef_Field ADD COLUMN AD_FieldGroup_ID NUMERIC(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:07 PM BRT
|
||||||
|
ALTER TABLE AD_UserDef_Field ADD CONSTRAINT ADFieldGroup_ADUserDefField FOREIGN KEY (AD_FieldGroup_ID) REFERENCES ad_fieldgroup(ad_fieldgroup_id) DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:37:45 PM BRT
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206521,'Field Group','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',395,214327,'Y',22,330,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-10-08 13:37:45','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-10-08 13:37:45','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','6f71bd66-6a96-40ad-a016-42f74fcb3c95','Y',330,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 8, 2019, 1:38:59 PM BRT
|
||||||
|
UPDATE AD_Field SET SeqNo=155, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-10-08 13:38:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206521
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 9, 2020, 8:40:22 AM BRT
|
||||||
|
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Window customization Language != Session Language',0,0,'Y',TO_TIMESTAMP('2020-10-09 08:40:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-10-09 08:40:22','YYYY-MM-DD HH24:MI:SS'),100,200641,'TabEditorWrongLanguage','D','dcf44ca0-91e1-4c26-a684-6c645ef11eeb')
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('202010211353_IDEMPIERE-4058.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -186,6 +186,14 @@ public class GridFieldVO implements Serializable, Cloneable
|
||||||
if (userDef.getPlaceholder() != null)
|
if (userDef.getPlaceholder() != null)
|
||||||
vo.Placeholder = userDef.getPlaceholder();
|
vo.Placeholder = userDef.getPlaceholder();
|
||||||
|
|
||||||
|
//devCoffee 8535
|
||||||
|
if (userDef.getAD_FieldGroup_ID() > 0)
|
||||||
|
{
|
||||||
|
vo.FieldGroup = ((X_AD_FieldGroup)userDef.getAD_FieldGroup()).get_Translation(I_AD_FieldGroup.COLUMNNAME_Name);
|
||||||
|
vo.FieldGroupType = userDef.getAD_FieldGroup().getFieldGroupType();
|
||||||
|
}
|
||||||
|
//fim devCoffee 8535
|
||||||
|
|
||||||
if (userDef.getIsAutocomplete() != null)
|
if (userDef.getIsAutocomplete() != null)
|
||||||
vo.IsAutocomplete = "Y".equals(userDef.getIsAutocomplete());
|
vo.IsAutocomplete = "Y".equals(userDef.getIsAutocomplete());
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,21 @@ public interface I_AD_UserDef_Field
|
||||||
*/
|
*/
|
||||||
public int getAD_Client_ID();
|
public int getAD_Client_ID();
|
||||||
|
|
||||||
|
/** Column name AD_FieldGroup_ID */
|
||||||
|
public static final String COLUMNNAME_AD_FieldGroup_ID = "AD_FieldGroup_ID";
|
||||||
|
|
||||||
|
/** Set Field Group.
|
||||||
|
* Logical grouping of fields
|
||||||
|
*/
|
||||||
|
public void setAD_FieldGroup_ID (int AD_FieldGroup_ID);
|
||||||
|
|
||||||
|
/** Get Field Group.
|
||||||
|
* Logical grouping of fields
|
||||||
|
*/
|
||||||
|
public int getAD_FieldGroup_ID();
|
||||||
|
|
||||||
|
public org.compiere.model.I_AD_FieldGroup getAD_FieldGroup() throws RuntimeException;
|
||||||
|
|
||||||
/** Column name AD_Field_ID */
|
/** Column name AD_Field_ID */
|
||||||
public static final String COLUMNNAME_AD_Field_ID = "AD_Field_ID";
|
public static final String COLUMNNAME_AD_Field_ID = "AD_Field_ID";
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class MUserDefField extends X_AD_UserDef_Field implements ImmutablePOSupp
|
||||||
this(ctx, 0, trxName);
|
this(ctx, 0, trxName);
|
||||||
copyPO(copy);
|
copyPO(copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get matching MUserDefField related to current field and user definition for window and tab
|
* Get matching MUserDefField related to current field and user definition for window and tab
|
||||||
* @param ctx
|
* @param ctx
|
||||||
|
@ -110,6 +110,20 @@ public class MUserDefField extends X_AD_UserDef_Field implements ImmutablePOSupp
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static MUserDefField get (Properties ctx, int AD_Field_ID, int AD_Tab_ID, int AD_Window_ID )
|
public static MUserDefField get (Properties ctx, int AD_Field_ID, int AD_Tab_ID, int AD_Window_ID )
|
||||||
|
{
|
||||||
|
return get(ctx, AD_Field_ID, AD_Tab_ID, AD_Window_ID, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get matching MUserDefField related to current field and user definition for window and tab
|
||||||
|
* @param ctx
|
||||||
|
* @param AD_Field_ID
|
||||||
|
* @param AD_Tab_ID
|
||||||
|
* @param AD_Window_ID
|
||||||
|
* @param reload
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static MUserDefField get (Properties ctx, int AD_Field_ID, int AD_Tab_ID, int AD_Window_ID , boolean reload)
|
||||||
{
|
{
|
||||||
|
|
||||||
MUserDefWin userdefWin = MUserDefWin.getBestMatch(ctx, AD_Window_ID);
|
MUserDefWin userdefWin = MUserDefWin.getBestMatch(ctx, AD_Window_ID);
|
||||||
|
@ -123,7 +137,7 @@ public class MUserDefField extends X_AD_UserDef_Field implements ImmutablePOSupp
|
||||||
String key = new StringBuilder().append(AD_Field_ID).append("_")
|
String key = new StringBuilder().append(AD_Field_ID).append("_")
|
||||||
.append(userdefTab.getAD_UserDef_Tab_ID())
|
.append(userdefTab.getAD_UserDef_Tab_ID())
|
||||||
.toString();
|
.toString();
|
||||||
if (s_cache.containsKey(key))
|
if (!reload && s_cache.containsKey(key))
|
||||||
return s_cache.get(ctx, key, e -> new MUserDefField(ctx, e));
|
return s_cache.get(ctx, key, e -> new MUserDefField(ctx, e));
|
||||||
|
|
||||||
MUserDefField retValue = null;
|
MUserDefField retValue = null;
|
||||||
|
|
|
@ -74,6 +74,34 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public org.compiere.model.I_AD_FieldGroup getAD_FieldGroup() throws RuntimeException
|
||||||
|
{
|
||||||
|
return (org.compiere.model.I_AD_FieldGroup)MTable.get(getCtx(), org.compiere.model.I_AD_FieldGroup.Table_Name)
|
||||||
|
.getPO(getAD_FieldGroup_ID(), get_TrxName()); }
|
||||||
|
|
||||||
|
/** Set Field Group.
|
||||||
|
@param AD_FieldGroup_ID
|
||||||
|
Logical grouping of fields
|
||||||
|
*/
|
||||||
|
public void setAD_FieldGroup_ID (int AD_FieldGroup_ID)
|
||||||
|
{
|
||||||
|
if (AD_FieldGroup_ID < 1)
|
||||||
|
set_ValueNoCheck (COLUMNNAME_AD_FieldGroup_ID, null);
|
||||||
|
else
|
||||||
|
set_ValueNoCheck (COLUMNNAME_AD_FieldGroup_ID, Integer.valueOf(AD_FieldGroup_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Field Group.
|
||||||
|
@return Logical grouping of fields
|
||||||
|
*/
|
||||||
|
public int getAD_FieldGroup_ID ()
|
||||||
|
{
|
||||||
|
Integer ii = (Integer)get_Value(COLUMNNAME_AD_FieldGroup_ID);
|
||||||
|
if (ii == null)
|
||||||
|
return 0;
|
||||||
|
return ii.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
public org.compiere.model.I_AD_Field getAD_Field() throws RuntimeException
|
public org.compiere.model.I_AD_Field getAD_Field() throws RuntimeException
|
||||||
{
|
{
|
||||||
return (org.compiere.model.I_AD_Field)MTable.get(getCtx(), org.compiere.model.I_AD_Field.Table_Name)
|
return (org.compiere.model.I_AD_Field)MTable.get(getCtx(), org.compiere.model.I_AD_Field.Table_Name)
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.adempiere.webui.component.ListItem;
|
||||||
import org.adempiere.webui.component.Listbox;
|
import org.adempiere.webui.component.Listbox;
|
||||||
import org.adempiere.webui.component.Row;
|
import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.component.Rows;
|
import org.adempiere.webui.component.Rows;
|
||||||
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.editor.WEditor;
|
import org.adempiere.webui.editor.WEditor;
|
||||||
import org.adempiere.webui.editor.WImageEditor;
|
import org.adempiere.webui.editor.WImageEditor;
|
||||||
import org.adempiere.webui.editor.WNumberEditor;
|
import org.adempiere.webui.editor.WNumberEditor;
|
||||||
|
@ -51,11 +52,14 @@ import org.adempiere.webui.panel.IFormController;
|
||||||
import org.adempiere.webui.panel.WTabEditorForm;
|
import org.adempiere.webui.panel.WTabEditorForm;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.util.ZKUpdateUtil;
|
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||||
|
import org.adempiere.webui.window.FDialog;
|
||||||
import org.compiere.apps.form.TabEditor;
|
import org.compiere.apps.form.TabEditor;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
|
import org.compiere.model.MColumn;
|
||||||
import org.compiere.model.MField;
|
import org.compiere.model.MField;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
import org.compiere.model.MLookupFactory;
|
import org.compiere.model.MLookupFactory;
|
||||||
|
import org.compiere.model.MUserDefTab;
|
||||||
import org.compiere.model.X_AD_FieldGroup;
|
import org.compiere.model.X_AD_FieldGroup;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -90,28 +94,36 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
{
|
{
|
||||||
// TODO: create messages Property, VisibleFields, NonVisibleField
|
// TODO: create messages Property, VisibleFields, NonVisibleField
|
||||||
|
|
||||||
private WTabEditorForm tabform =null;
|
private WTabEditorForm tabform = null;
|
||||||
|
|
||||||
private Borderlayout mainLayout = new Borderlayout();
|
private Borderlayout mainLayout = new Borderlayout();
|
||||||
|
|
||||||
/** Window No */
|
/** Window No */
|
||||||
public int m_WindowNo = 0;
|
public int m_WindowNo = 0;
|
||||||
|
|
||||||
private Label displayedLabel = new Label();
|
private Label displayedLabel = new Label();
|
||||||
private Label nodisplayedLabel = new Label();
|
private Label nodisplayedLabel = new Label();
|
||||||
|
|
||||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||||
|
|
||||||
WEditor editorName = null;
|
WEditor editorName = null;
|
||||||
|
WEditor editorDescription = null;
|
||||||
|
WEditor editorHelp = null;
|
||||||
|
WEditor editorPlaceholder = null;
|
||||||
WEditor editorAD_FieldGroup_ID = null;
|
WEditor editorAD_FieldGroup_ID = null;
|
||||||
WEditor editorIsDisplayed = null;
|
WEditor editorIsDisplayed = null;
|
||||||
WEditor editorSeqNo = null;
|
WEditor editorSeqNo = null;
|
||||||
WEditor editorXPosition = null;
|
WEditor editorXPosition = null;
|
||||||
WEditor editorColumnSpan = null;
|
WEditor editorColumnSpan = null;
|
||||||
WEditor editorNumLines = null;
|
WEditor editorNumLines = null;
|
||||||
|
WEditor editorDisplayLogic = null;
|
||||||
|
WEditor editorMandatoryLogic = null;
|
||||||
|
WEditor editorReadOnlyLogic = null;
|
||||||
|
WEditor editorColumn = null;
|
||||||
|
WYesNoEditor editorIsReadOnly = null;
|
||||||
|
|
||||||
private Listbox visible = new Listbox();
|
private Listbox visible = new Listbox();
|
||||||
private Listbox invisible = new Listbox();
|
private Listbox invisible = new Listbox();
|
||||||
|
|
||||||
// The grid components
|
// The grid components
|
||||||
Group currentGroup;
|
Group currentGroup;
|
||||||
|
@ -122,10 +134,10 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
|
|
||||||
Grid form;
|
Grid form;
|
||||||
Vlayout centerVLayout;
|
Vlayout centerVLayout;
|
||||||
Vlayout westVLayout ;
|
Vlayout westVLayout;
|
||||||
|
|
||||||
private static final int POSSEQMULTIPLIER = 10000000;
|
private static final int POSSEQMULTIPLIER = 10000000;
|
||||||
|
|
||||||
public WTabEditor()
|
public WTabEditor()
|
||||||
{
|
{
|
||||||
tabform = new WTabEditorForm(this);
|
tabform = new WTabEditorForm(this);
|
||||||
|
@ -135,7 +147,25 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
public void initForm() {
|
public void initForm() {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
initMFields(tabform.getWindowNo(), tabform.getProcessInfo().getRecord_ID());
|
int Table_ID = tabform.getProcessInfo().getTable_ID();
|
||||||
|
int Record_ID = tabform.getProcessInfo().getRecord_ID();
|
||||||
|
// check if the editor is running from system or client (tab customization)
|
||||||
|
if (Table_ID == MUserDefTab.Table_ID)
|
||||||
|
{
|
||||||
|
MUserDefTab udt = new MUserDefTab(Env.getCtx(), Record_ID, null);
|
||||||
|
|
||||||
|
if (udt.getAD_UserDef_Win().getAD_Language() != null && !udt.getAD_UserDef_Win().getAD_Language().equals(Env.getAD_Language(Env.getCtx())))
|
||||||
|
{
|
||||||
|
FDialog.error(m_WindowNo, "TabEditorWrongLanguage");
|
||||||
|
tabform.detach();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Record_ID = udt.getAD_Tab_ID();
|
||||||
|
isSystem = false;
|
||||||
|
AD_UserDef_Tab_ID = tabform.getProcessInfo().getRecord_ID();
|
||||||
|
}
|
||||||
|
initMFields(tabform.getWindowNo(), Record_ID);
|
||||||
dynList();
|
dynList();
|
||||||
jbInit();
|
jbInit();
|
||||||
LayoutUtils.sendDeferLayoutEvent(mainLayout, 100);
|
LayoutUtils.sendDeferLayoutEvent(mainLayout, 100);
|
||||||
|
@ -147,7 +177,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize List of visible and non visible Fields
|
* Initialize List of visible and non visible Fields
|
||||||
*/
|
*/
|
||||||
private void dynList()
|
private void dynList()
|
||||||
{
|
{
|
||||||
|
@ -164,7 +194,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
invisible.addOnDropListener(this);
|
invisible.addOnDropListener(this);
|
||||||
|
|
||||||
updateLists(null);
|
updateLists(null);
|
||||||
} // dynList
|
} // dynList
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Tab panel editor
|
* Initialize Tab panel editor
|
||||||
|
@ -176,176 +206,180 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
|
|
||||||
currentGroup = null;
|
currentGroup = null;
|
||||||
rowList = null;
|
rowList = null;
|
||||||
|
|
||||||
form = new Grid();
|
form = new Grid();
|
||||||
form.makeNoStrip();
|
form.makeNoStrip();
|
||||||
ZKUpdateUtil.setHflex(form, "1");
|
ZKUpdateUtil.setHflex(form, "1");
|
||||||
ZKUpdateUtil.setHeight(form, null);
|
ZKUpdateUtil.setHeight(form, null);
|
||||||
form.setVflex(false);
|
form.setVflex(false);
|
||||||
|
|
||||||
int numCols = getNumColumns();
|
int numCols = getNumColumns();
|
||||||
if (numCols <= 0) {
|
if (numCols <= 0) {
|
||||||
numCols=4;
|
numCols = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set size in percentage per column leaving a MARGIN on right
|
// set size in percentage per column leaving a MARGIN on right
|
||||||
Columns columns = new Columns();
|
Columns columns = new Columns();
|
||||||
form.appendChild(columns);
|
form.appendChild(columns);
|
||||||
int equalWidth = 98 / numCols;
|
int equalWidth = 98 / numCols;
|
||||||
|
|
||||||
for (int h=0;h<numCols;h++){
|
for (int h = 0; h < numCols; h++) {
|
||||||
Column col = new Column();
|
Column col = new Column();
|
||||||
ZKUpdateUtil.setWidth(col, equalWidth + "%");
|
ZKUpdateUtil.setWidth(col, equalWidth + "%");
|
||||||
columns.appendChild(col);
|
columns.appendChild(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rows rows = form.newRows();
|
Rows rows = form.newRows();
|
||||||
Row row = new Row();
|
Row row = new Row();
|
||||||
int actualxpos = 0;
|
int actualxpos = 0;
|
||||||
int lastseq = 0;
|
int lastseq = 0;
|
||||||
String currentFieldGroup = null;
|
String currentFieldGroup = null;
|
||||||
for (GridField gridField : getGridFields())
|
for (GridField gridField : getGridFields())
|
||||||
{
|
{
|
||||||
MField field = getMField(gridField.getAD_Field_ID());
|
MField field = getMField(gridField.getAD_Field_ID());
|
||||||
|
|
||||||
if (!gridField.isDisplayed() || gridField.isToolbarOnlyButton())
|
if (!gridField.isDisplayed() || gridField.isToolbarOnlyButton())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// field group
|
// when the field is at client level reload with customization
|
||||||
String fieldGroup = gridField.getFieldGroup();
|
if (!isSystem && !field.is_Changed())
|
||||||
if (!Util.isEmpty(fieldGroup) && !fieldGroup.equals(currentFieldGroup)) // group changed
|
field = loadUserDefField(field);
|
||||||
{
|
|
||||||
currentFieldGroup = fieldGroup;
|
|
||||||
|
|
||||||
while(numCols - actualxpos + 1 > 0) {
|
|
||||||
row.appendCellChild(createSpacer(), 1);
|
|
||||||
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
|
|
||||||
actualxpos++;
|
|
||||||
}
|
|
||||||
row.setGroup(currentGroup);
|
|
||||||
rows.appendChild(row);
|
|
||||||
if (rowList != null)
|
|
||||||
rowList.add(row);
|
|
||||||
|
|
||||||
rowList = new ArrayList<Row>();
|
// field group
|
||||||
|
String fieldGroup = gridField.getFieldGroup();
|
||||||
|
if (!Util.isEmpty(fieldGroup) && !fieldGroup.equals(currentFieldGroup)) // group changed
|
||||||
|
{
|
||||||
|
currentFieldGroup = fieldGroup;
|
||||||
|
|
||||||
|
while (numCols - actualxpos + 1 > 0) {
|
||||||
|
row.appendCellChild(createSpacer(), 1);
|
||||||
|
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
|
||||||
|
actualxpos++;
|
||||||
|
}
|
||||||
|
row.setGroup(currentGroup);
|
||||||
|
rows.appendChild(row);
|
||||||
|
if (rowList != null)
|
||||||
|
rowList.add(row);
|
||||||
|
|
||||||
|
rowList = new ArrayList<Row>();
|
||||||
|
|
||||||
if (X_AD_FieldGroup.FIELDGROUPTYPE_Label.equals(gridField.getFieldGroupType()))
|
if (X_AD_FieldGroup.FIELDGROUPTYPE_Label.equals(gridField.getFieldGroupType()))
|
||||||
{
|
{
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Label groupLabel = new Label(fieldGroup);
|
Label groupLabel = new Label(fieldGroup);
|
||||||
row.appendCellChild(groupLabel, numCols);
|
row.appendCellChild(groupLabel, numCols);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Separator separator = new Separator();
|
Separator separator = new Separator();
|
||||||
separator.setBar(true);
|
separator.setBar(true);
|
||||||
row.appendCellChild(separator, numCols);
|
row.appendCellChild(separator, numCols);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
currentGroup = null;
|
currentGroup = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Group rowg = new Group(fieldGroup);
|
Group rowg = new Group(fieldGroup);
|
||||||
Cell cell = (Cell) rowg.getFirstChild();
|
Cell cell = (Cell) rowg.getFirstChild();
|
||||||
cell.setSclass("z-group-inner");
|
cell.setSclass("z-group-inner");
|
||||||
cell.setColspan(numCols+1);
|
cell.setColspan(numCols + 1);
|
||||||
// rowg.appendChild(cell);
|
// rowg.appendChild(cell);
|
||||||
if (X_AD_FieldGroup.FIELDGROUPTYPE_Tab.equals(gridField.getFieldGroupType()) || gridField.getIsCollapsedByDefault())
|
if (X_AD_FieldGroup.FIELDGROUPTYPE_Tab.equals(gridField.getFieldGroupType()) || gridField.getIsCollapsedByDefault())
|
||||||
{
|
{
|
||||||
rowg.setOpen(false);
|
rowg.setOpen(false);
|
||||||
}
|
}
|
||||||
currentGroup = rowg;
|
currentGroup = rowg;
|
||||||
rows.appendChild(rowg);
|
rows.appendChild(rowg);
|
||||||
}
|
}
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
actualxpos = 0;
|
actualxpos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//normal field
|
// normal field
|
||||||
if (gridField.getXPosition() <= actualxpos) {
|
if (gridField.getXPosition() <= actualxpos) {
|
||||||
// Fill right part of the row with spacers until number of columns
|
// Fill right part of the row with spacers until number of columns
|
||||||
while(numCols - actualxpos + 1 > 0) {
|
while (numCols - actualxpos + 1 > 0) {
|
||||||
row.appendCellChild(createSpacer(), 1);
|
row.appendCellChild(createSpacer(), 1);
|
||||||
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
|
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
|
||||||
actualxpos++;
|
actualxpos++;
|
||||||
}
|
}
|
||||||
row.setGroup(currentGroup);
|
row.setGroup(currentGroup);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
if (rowList != null)
|
if (rowList != null)
|
||||||
rowList.add(row);
|
rowList.add(row);
|
||||||
row=new Row();
|
row = new Row();
|
||||||
actualxpos = 0;
|
actualxpos = 0;
|
||||||
}
|
}
|
||||||
// Fill left part of the field
|
// Fill left part of the field
|
||||||
if (gridField.getXPosition()-1 - actualxpos > 0) {
|
if (gridField.getXPosition() - 1 - actualxpos > 0) {
|
||||||
row.appendCellChild(createSpacer(), gridField.getXPosition()-1 - actualxpos);
|
row.appendCellChild(createSpacer(), gridField.getXPosition() - 1 - actualxpos);
|
||||||
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
|
setLastCellProps(row.getLastCell(), actualxpos, field.getSeqNo());
|
||||||
}
|
}
|
||||||
boolean paintLabel = ! (gridField.getDisplayType() == DisplayType.Button || gridField.getDisplayType() == DisplayType.YesNo || gridField.isFieldOnly());
|
boolean paintLabel = ! (gridField.getDisplayType() == DisplayType.Button || gridField.getDisplayType() == DisplayType.YesNo || gridField.isFieldOnly());
|
||||||
if (gridField.isHeading())
|
if (gridField.isHeading())
|
||||||
actualxpos = gridField.getXPosition();
|
actualxpos = gridField.getXPosition();
|
||||||
else
|
else
|
||||||
actualxpos = gridField.getXPosition() + gridField.getColumnSpan()-1 + (paintLabel ? 1 : 0);
|
actualxpos = gridField.getXPosition() + gridField.getColumnSpan() - 1 + (paintLabel ? 1 : 0);
|
||||||
|
|
||||||
if (! gridField.isHeading()) {
|
if (!gridField.isHeading()) {
|
||||||
|
|
||||||
WEditor editor = WebEditorFactory.getEditor(null, gridField, false);
|
WEditor editor = WebEditorFactory.getEditor(null, gridField, false);
|
||||||
|
|
||||||
if (editor != null) // Not heading
|
if (editor != null) // Not heading
|
||||||
{
|
{
|
||||||
editor.setReadWrite(true);
|
editor.setReadWrite(true);
|
||||||
|
|
||||||
if (editor.getComponent() instanceof EditorBox) {
|
if (editor.getComponent() instanceof EditorBox) {
|
||||||
// disable button on URL editor
|
// disable button on URL editor
|
||||||
EditorBox editorbox = (EditorBox) editor.getComponent();
|
EditorBox editorbox = (EditorBox) editor.getComponent();
|
||||||
editorbox.getButton().setDisabled(true);
|
editorbox.getButton().setDisabled(true);
|
||||||
} else if (editor instanceof WImageEditor) {
|
} else if (editor instanceof WImageEditor) {
|
||||||
// disable button on Image editor
|
// disable button on Image editor
|
||||||
editor.setReadWrite(false);
|
editor.setReadWrite(false);
|
||||||
}
|
}
|
||||||
if (paintLabel) {
|
if (paintLabel) {
|
||||||
Div div = new Div();
|
Div div = new Div();
|
||||||
div.setStyle("text-align: right;");
|
div.setStyle("text-align: right;");
|
||||||
Label label = editor.getLabel();
|
Label label = editor.getLabel();
|
||||||
div.appendChild(label);
|
div.appendChild(label);
|
||||||
if (label.getDecorator() != null)
|
if (label.getDecorator() != null)
|
||||||
div.appendChild(label.getDecorator());
|
div.appendChild(label.getDecorator());
|
||||||
row.appendCellChild(div,1);
|
row.appendCellChild(div, 1);
|
||||||
setLastCellProps(row.getLastCell(), gridField);
|
setLastCellProps(row.getLastCell(), gridField);
|
||||||
}
|
}
|
||||||
row.appendCellChild(editor.getComponent(), gridField.getColumnSpan());
|
row.appendCellChild(editor.getComponent(), gridField.getColumnSpan());
|
||||||
setLastCellProps(row.getLastCell(), gridField);
|
setLastCellProps(row.getLastCell(), gridField);
|
||||||
|
|
||||||
//stretch component to fill grid cell
|
// stretch component to fill grid cell
|
||||||
editor.fillHorizontal();
|
editor.fillHorizontal();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // just heading
|
else // just heading
|
||||||
{
|
{
|
||||||
//display just a label if we are "heading only"
|
// display just a label if we are "heading only"
|
||||||
Label label = new Label(gridField.getHeader());
|
Label label = new Label(gridField.getHeader());
|
||||||
Div div = new Div();
|
Div div = new Div();
|
||||||
div.setStyle("text-align: center;");
|
div.setStyle("text-align: center;");
|
||||||
row.appendCellChild(createSpacer());
|
row.appendCellChild(createSpacer());
|
||||||
div.appendChild(label);
|
div.appendChild(label);
|
||||||
row.appendCellChild(div);
|
row.appendCellChild(div);
|
||||||
setLastCellProps(row.getLastCell(), gridField);
|
setLastCellProps(row.getLastCell(), gridField);
|
||||||
}
|
}
|
||||||
lastseq = field.getSeqNo();
|
lastseq = field.getSeqNo();
|
||||||
}
|
}
|
||||||
|
|
||||||
while(numCols - actualxpos + 1 > 0) {
|
while (numCols - actualxpos + 1 > 0) {
|
||||||
row.appendCellChild(createSpacer(), 1);
|
row.appendCellChild(createSpacer(), 1);
|
||||||
lastseq = lastseq + 10;
|
lastseq = lastseq + 10;
|
||||||
// make every empty space droppable at the end
|
// make every empty space droppable at the end
|
||||||
setLastCellProps(row.getLastCell(), actualxpos, lastseq);
|
setLastCellProps(row.getLastCell(), actualxpos, lastseq);
|
||||||
actualxpos++;
|
actualxpos++;
|
||||||
}
|
}
|
||||||
row.setGroup(currentGroup);
|
row.setGroup(currentGroup);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
if (rowList != null)
|
if (rowList != null)
|
||||||
rowList.add(row);
|
rowList.add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +395,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
private void setLastCellProps(Cell lastCell, int actualxpos, int seqNo) {
|
private void setLastCellProps(Cell lastCell, int actualxpos, int seqNo) {
|
||||||
lastCell.setDroppable("true");
|
lastCell.setDroppable("true");
|
||||||
lastCell.addEventListener(Events.ON_DROP, this);
|
lastCell.addEventListener(Events.ON_DROP, this);
|
||||||
int value = (actualxpos+1) * POSSEQMULTIPLIER + seqNo;
|
int value = (actualxpos + 1) * POSSEQMULTIPLIER + seqNo;
|
||||||
mapEmptyCellField.put(lastCell, value);
|
mapEmptyCellField.put(lastCell, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,21 +404,21 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNumColumns() {
|
private int getNumColumns() {
|
||||||
int maxcol=0;
|
int maxcol = 0;
|
||||||
for (GridField gridField : getGridFields())
|
for (GridField gridField : getGridFields())
|
||||||
{
|
{
|
||||||
if (!gridField.isDisplayed() || gridField.isToolbarOnlyButton())
|
if (!gridField.isDisplayed() || gridField.isToolbarOnlyButton())
|
||||||
continue;
|
continue;
|
||||||
int col = gridField.getXPosition() + gridField.getColumnSpan();
|
int col = gridField.getXPosition() + gridField.getColumnSpan();
|
||||||
if (gridField.isFieldOnly()
|
if (gridField.isFieldOnly()
|
||||||
|| (gridField.getDisplayType() == DisplayType.Button && !gridField.isToolbarOnlyButton())
|
|| (gridField.getDisplayType() == DisplayType.Button && !gridField.isToolbarOnlyButton())
|
||||||
|| gridField.getDisplayType() == DisplayType.YesNo) {
|
|| gridField.getDisplayType() == DisplayType.YesNo) {
|
||||||
col--;
|
col--;
|
||||||
}
|
}
|
||||||
if (col > maxcol) {
|
if (col > maxcol) {
|
||||||
maxcol = col;
|
maxcol = col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return maxcol;
|
return maxcol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,59 +432,108 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
//
|
//
|
||||||
Columns columns = new Columns();
|
Columns columns = new Columns();
|
||||||
gridView.appendChild(columns);
|
gridView.appendChild(columns);
|
||||||
//
|
gridView.setVflex(true);
|
||||||
Column column = new Column();
|
gridView.setStyle("overflow-h: hidden");
|
||||||
columns.appendChild(column);
|
//
|
||||||
ZKUpdateUtil.setHflex(column, "min");
|
Column column = new Column();
|
||||||
column.setAlign("right");
|
columns.appendChild(column);
|
||||||
|
|
||||||
column = new Column();
|
ZKUpdateUtil.setHflex(column, "min");
|
||||||
columns.appendChild(column);
|
column.setAlign("right");
|
||||||
ZKUpdateUtil.setHflex(column, "1");
|
|
||||||
|
column = new Column();
|
||||||
|
columns.appendChild(column);
|
||||||
|
ZKUpdateUtil.setHflex(column, "1");
|
||||||
Rows rows = new Rows();
|
Rows rows = new Rows();
|
||||||
gridView.appendChild(rows);
|
gridView.appendChild(rows);
|
||||||
|
|
||||||
Row row = null;
|
Row row = null;
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Group group = new Group(Msg.getMsg(Env.getCtx(), "Property"));
|
Group group = new Group(Msg.getMsg(Env.getCtx(), "Property"));
|
||||||
|
//group.setStyle("padding-right: 15px");
|
||||||
Cell cell = (Cell) group.getFirstChild();
|
Cell cell = (Cell) group.getFirstChild();
|
||||||
cell.setSclass("z-group-inner");
|
cell.setSclass("z-group-inner");
|
||||||
cell.setColspan(2);
|
cell.setColspan(2);
|
||||||
group.setOpen(true);
|
group.setOpen(true);
|
||||||
|
|
||||||
rows.appendChild(group);
|
rows.appendChild(group);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Label labelName = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_Name));
|
Label labelName = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_Name));
|
||||||
editorName = new WStringEditor(MField.COLUMNNAME_Name, false, true, false, 0, 0, null, null);
|
editorName = new WStringEditor(MField.COLUMNNAME_Name, false, false, true, 1000, 1000, null, null);
|
||||||
ZKUpdateUtil.setHflex(((WStringEditor) editorName).getComponent(), "1");
|
ZKUpdateUtil.setHflex(((WStringEditor) editorName).getComponent(), "1");
|
||||||
row.appendChild(labelName.rightAlign());
|
row.appendChild(labelName.rightAlign());
|
||||||
row.appendChild(editorName.getComponent());
|
row.appendChild(editorName.getComponent());
|
||||||
// editorName.addValueChangeListener(this);
|
editorName.addValueChangeListener(this);
|
||||||
row.setGroup(group);
|
row.setGroup(group);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Label labelIsDisplayed = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_IsDisplayed));
|
Label labelDescription = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_Description));
|
||||||
editorIsDisplayed = new WYesNoEditor(MField.COLUMNNAME_IsDisplayed, "", labelIsDisplayed.getValue(), false, true, false);
|
editorDescription = new WStringEditor(MField.COLUMNNAME_Description, false, false, false, 1000, 1000, null,
|
||||||
|
null);
|
||||||
|
((Textbox) editorDescription.getComponent()).setMultiline(true);
|
||||||
|
row.appendChild(labelDescription.rightAlign());
|
||||||
|
row.appendChild(editorDescription.getComponent());
|
||||||
|
//ZKUpdateUtil.setWidth((HtmlBasedComponent) row.getLastChild(), "100%");
|
||||||
|
//ZKUpdateUtil.setHeight((HtmlBasedComponent) row.getLastChild(), "80px");
|
||||||
|
editorDescription.addValueChangeListener(this);
|
||||||
|
row.setGroup(group);
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Row();
|
||||||
|
Label labelHelp = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_Help));
|
||||||
|
editorHelp = new WStringEditor(MField.COLUMNNAME_Help, false, false, false, 0, 0, null, null);
|
||||||
|
((Textbox) editorHelp.getComponent()).setMultiline(true);
|
||||||
|
row.appendChild(labelHelp.rightAlign());
|
||||||
|
row.appendChild(editorHelp.getComponent());
|
||||||
|
//ZKUpdateUtil.setWidth((HtmlBasedComponent) row.getLastChild(), "100%");
|
||||||
|
//ZKUpdateUtil.setHeight((HtmlBasedComponent) row.getLastChild(), "80px");
|
||||||
|
editorHelp.addValueChangeListener(this);
|
||||||
|
row.setGroup(group);
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Row();
|
||||||
|
Label labelPlaceholder = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_Placeholder));
|
||||||
|
editorPlaceholder = new WStringEditor(MField.COLUMNNAME_Placeholder, false, false, true, 1000, 1000, null,
|
||||||
|
null);
|
||||||
|
ZKUpdateUtil.setHflex(((WStringEditor) editorPlaceholder).getComponent(), "1");
|
||||||
|
row.appendChild(labelPlaceholder.rightAlign());
|
||||||
|
row.appendChild(editorPlaceholder.getComponent());
|
||||||
|
editorPlaceholder.addValueChangeListener(this);
|
||||||
|
row.setGroup(group);
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Row();
|
||||||
|
Label labelColumn = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_AD_Column_ID));
|
||||||
|
editorColumn = new WStringEditor(MField.COLUMNNAME_AD_Column_ID, false, true, false, 0, 0, null, null);
|
||||||
|
row.appendChild(labelColumn.rightAlign());
|
||||||
|
row.appendChild(editorColumn.getComponent());
|
||||||
|
row.setGroup(group);
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Row();
|
||||||
|
Label labelIsDisplayed = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_IsDisplayed));
|
||||||
|
editorIsDisplayed = new WYesNoEditor(MField.COLUMNNAME_IsDisplayed, "", labelIsDisplayed.getValue(), false, false, false);
|
||||||
row.appendChild(labelIsDisplayed.rightAlign());
|
row.appendChild(labelIsDisplayed.rightAlign());
|
||||||
row.appendChild(editorIsDisplayed.getComponent());
|
row.appendChild(editorIsDisplayed.getComponent());
|
||||||
// editorIsDisplayed.addValueChangeListener(this);
|
editorIsDisplayed.addValueChangeListener(this);
|
||||||
row.setGroup(group);
|
row.setGroup(group);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Label labelSeqNo = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_SeqNo));
|
Label labelSeqNo = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_SeqNo));
|
||||||
editorSeqNo = new WNumberEditor(MField.COLUMNNAME_SeqNo, false, true, false, DisplayType.Integer, labelSeqNo.getValue());
|
editorSeqNo = new WNumberEditor(MField.COLUMNNAME_SeqNo, false, true, false, DisplayType.Integer, labelSeqNo.getValue());
|
||||||
row.appendChild(labelSeqNo.rightAlign());
|
row.appendChild(labelSeqNo.rightAlign());
|
||||||
row.appendChild(editorSeqNo.getComponent());
|
row.appendChild(editorSeqNo.getComponent());
|
||||||
// editorSeqNo.addValueChangeListener(this);
|
// editorSeqNo.addValueChangeListener(this);
|
||||||
row.setGroup(group);
|
row.setGroup(group);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Label labelAD_FieldGroup_ID = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_AD_FieldGroup_ID));
|
Label labelAD_FieldGroup_ID = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_AD_FieldGroup_ID));
|
||||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), tabform.getWindowNo(), 0, COLUMN_AD_FIELD_AD_FIELDGROUP_ID, DisplayType.TableDir);
|
MLookup lookup = MLookupFactory.get(Env.getCtx(), tabform.getWindowNo(), 0, COLUMN_AD_FIELD_AD_FIELDGROUP_ID, DisplayType.TableDir);
|
||||||
editorAD_FieldGroup_ID = new WTableDirEditor(MField.COLUMNNAME_AD_FieldGroup_ID, false, false, true, lookup);
|
editorAD_FieldGroup_ID = new WTableDirEditor(MField.COLUMNNAME_AD_FieldGroup_ID, false, false, true, lookup);
|
||||||
ZKUpdateUtil.setHflex(((WTableDirEditor) editorAD_FieldGroup_ID).getComponent(), "1");
|
ZKUpdateUtil.setHflex(((WTableDirEditor) editorAD_FieldGroup_ID).getComponent(), "1");
|
||||||
row.appendChild(labelAD_FieldGroup_ID.rightAlign());
|
row.appendChild(labelAD_FieldGroup_ID.rightAlign());
|
||||||
|
@ -460,7 +543,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Label labelXPosition = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_XPosition));
|
Label labelXPosition = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_XPosition));
|
||||||
editorXPosition = new WNumberEditor(MField.COLUMNNAME_XPosition, true, false, true, DisplayType.Integer, labelXPosition.getValue());
|
editorXPosition = new WNumberEditor(MField.COLUMNNAME_XPosition, true, false, true, DisplayType.Integer, labelXPosition.getValue());
|
||||||
row.appendChild(labelXPosition.rightAlign());
|
row.appendChild(labelXPosition.rightAlign());
|
||||||
row.appendChild(editorXPosition.getComponent());
|
row.appendChild(editorXPosition.getComponent());
|
||||||
|
@ -469,7 +552,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Label labelColumnSpan = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_ColumnSpan));
|
Label labelColumnSpan = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_ColumnSpan));
|
||||||
editorColumnSpan = new WNumberEditor(MField.COLUMNNAME_ColumnSpan, true, false, true, DisplayType.Integer, labelColumnSpan.getValue());
|
editorColumnSpan = new WNumberEditor(MField.COLUMNNAME_ColumnSpan, true, false, true, DisplayType.Integer, labelColumnSpan.getValue());
|
||||||
row.appendChild(labelColumnSpan.rightAlign());
|
row.appendChild(labelColumnSpan.rightAlign());
|
||||||
row.appendChild(editorColumnSpan.getComponent());
|
row.appendChild(editorColumnSpan.getComponent());
|
||||||
|
@ -478,32 +561,80 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Label labelNumLines = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_NumLines));
|
Label labelNumLines = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_NumLines));
|
||||||
editorNumLines = new WNumberEditor(MField.COLUMNNAME_NumLines, true, false, true, DisplayType.Integer, labelNumLines.getValue());
|
editorNumLines = new WNumberEditor(MField.COLUMNNAME_NumLines, true, false, true, DisplayType.Integer, labelNumLines.getValue());
|
||||||
row.appendChild(labelNumLines.rightAlign());
|
row.appendChild(labelNumLines.rightAlign());
|
||||||
row.appendChild(editorNumLines.getComponent());
|
row.appendChild(editorNumLines.getComponent());
|
||||||
editorNumLines.addValueChangeListener(this);
|
editorNumLines.addValueChangeListener(this);
|
||||||
row.setGroup(group);
|
row.setGroup(group);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Row();
|
||||||
|
Label labelDisplayLogic = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_DisplayLogic));
|
||||||
|
editorDisplayLogic = new WStringEditor(MField.COLUMNNAME_DisplayLogic, false, false, true, 1000, 1000, null,
|
||||||
|
null);
|
||||||
|
((Textbox) editorDisplayLogic.getComponent()).setMultiline(true);
|
||||||
|
row.appendChild(labelDisplayLogic.rightAlign());
|
||||||
|
row.appendChild(editorDisplayLogic.getComponent());
|
||||||
|
//ZKUpdateUtil.setWidth((HtmlBasedComponent) row.getLastChild(), "100%");
|
||||||
|
//ZKUpdateUtil.setHeight((HtmlBasedComponent) row.getLastChild(), "80px");
|
||||||
|
editorDisplayLogic.addValueChangeListener(this);
|
||||||
|
row.setGroup(group);
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Row();
|
||||||
|
Label labelMandatoryLogic = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_MandatoryLogic));
|
||||||
|
editorMandatoryLogic = new WStringEditor(MField.COLUMNNAME_MandatoryLogic, false, false, true, 1000, 1000, null,
|
||||||
|
null);
|
||||||
|
((Textbox) editorMandatoryLogic.getComponent()).setMultiline(true);
|
||||||
|
row.appendChild(labelMandatoryLogic.rightAlign());
|
||||||
|
row.appendChild(editorMandatoryLogic.getComponent());
|
||||||
|
//ZKUpdateUtil.setWidth((HtmlBasedComponent) row.getLastChild(), "100%");
|
||||||
|
//ZKUpdateUtil.setHeight((HtmlBasedComponent) row.getLastChild(), "80px");
|
||||||
|
editorMandatoryLogic.addValueChangeListener(this);
|
||||||
|
row.setGroup(group);
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Row();
|
||||||
|
Label labelReadOnlyLogic = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_ReadOnlyLogic));
|
||||||
|
editorReadOnlyLogic = new WStringEditor(MField.COLUMNNAME_ReadOnlyLogic, false, false, true, 1000, 1000, null,
|
||||||
|
null);
|
||||||
|
((Textbox) editorReadOnlyLogic.getComponent()).setMultiline(true);
|
||||||
|
row.appendChild(labelReadOnlyLogic.rightAlign());
|
||||||
|
row.appendChild(editorReadOnlyLogic.getComponent());
|
||||||
|
//ZKUpdateUtil.setWidth((HtmlBasedComponent) row.getLastChild(), "100%");
|
||||||
|
//ZKUpdateUtil.setHeight((HtmlBasedComponent) row.getLastChild(), "80px");
|
||||||
|
editorReadOnlyLogic.addValueChangeListener(this);
|
||||||
|
row.setGroup(group);
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Row();
|
||||||
|
Label labelIsReadOnly = new Label(Msg.getElement(Env.getCtx(), MField.COLUMNNAME_IsReadOnly));
|
||||||
|
editorIsReadOnly = new WYesNoEditor(MField.COLUMNNAME_IsReadOnly, "", "", true, false, true);
|
||||||
|
row.appendChild(labelIsReadOnly.rightAlign());
|
||||||
|
row.appendChild(editorIsReadOnly.getComponent());
|
||||||
|
editorIsReadOnly.addValueChangeListener(this);
|
||||||
|
row.setGroup(group);
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
Separator esep = new Separator("horizontal");
|
Separator esep = new Separator("horizontal");
|
||||||
esep.setSpacing("10px");
|
esep.setSpacing("10px");
|
||||||
row.appendCellChild(esep, 2);
|
row.appendCellChild(esep, 2);
|
||||||
row.setGroup(group);
|
row.setGroup(group);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
row.appendCellChild(confirmPanel, 2);
|
row.appendCellChild(confirmPanel, 2);
|
||||||
row.setGroup(group);
|
row.setGroup(group);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
return gridView;
|
return gridView;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static init
|
* Static init
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void jbInit() throws Exception
|
private void jbInit() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -512,7 +643,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
tabform.setMaximizable(true);
|
tabform.setMaximizable(true);
|
||||||
ZKUpdateUtil.setWidth(tabform, "95%");
|
ZKUpdateUtil.setWidth(tabform, "95%");
|
||||||
ZKUpdateUtil.setHeight(tabform, "95%");
|
ZKUpdateUtil.setHeight(tabform, "95%");
|
||||||
tabform.appendChild (mainLayout);
|
tabform.appendChild(mainLayout);
|
||||||
LayoutUtils.addSclass("tab-editor-form-content", mainLayout);
|
LayoutUtils.addSclass("tab-editor-form-content", mainLayout);
|
||||||
tabform.setBorder("normal");
|
tabform.setBorder("normal");
|
||||||
|
|
||||||
|
@ -525,6 +656,8 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
mainLayout.appendChild(east);
|
mainLayout.appendChild(east);
|
||||||
east.appendChild(propGrid);
|
east.appendChild(propGrid);
|
||||||
ZKUpdateUtil.setWidth(east, "320px");
|
ZKUpdateUtil.setWidth(east, "320px");
|
||||||
|
east.setCollapsible(true);
|
||||||
|
east.setSplittable(true);
|
||||||
|
|
||||||
ListHead visibleHead = new ListHead();
|
ListHead visibleHead = new ListHead();
|
||||||
visibleHead.setParent(visible);
|
visibleHead.setParent(visible);
|
||||||
|
@ -564,19 +697,19 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
west.setCollapsible(true);
|
west.setCollapsible(true);
|
||||||
west.setSplittable(true);
|
west.setSplittable(true);
|
||||||
ZKUpdateUtil.setWidth(west, "200px");
|
ZKUpdateUtil.setWidth(west, "200px");
|
||||||
} // jbInit
|
} // jbInit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispose
|
* Dispose
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
SessionManager.getAppDesktop().closeActiveWindow();
|
SessionManager.getAppDesktop().closeActiveWindow();
|
||||||
} // dispose
|
} // dispose
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action Listener
|
* Action Listener
|
||||||
* @param e event
|
* @param e event
|
||||||
*/
|
*/
|
||||||
public void onEvent (Event e) throws Exception
|
public void onEvent (Event e) throws Exception
|
||||||
{
|
{
|
||||||
|
@ -628,7 +761,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
if (mult == -1 && field.getColumnSpan() <= 1) {
|
if (mult == -1 && field.getColumnSpan() <= 1) {
|
||||||
// shrinking when colspan = 1 is not valid
|
// shrinking when colspan = 1 is not valid
|
||||||
} else {
|
} else {
|
||||||
field.setColumnSpan(field.getColumnSpan()+mult);
|
field.setColumnSpan(field.getColumnSpan() + mult);
|
||||||
}
|
}
|
||||||
// select the field on the visible list and set focus
|
// select the field on the visible list and set focus
|
||||||
for (Listitem item : visible.getItems()) {
|
for (Listitem item : visible.getItems()) {
|
||||||
|
@ -644,7 +777,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (e instanceof DropEvent ) {
|
else if (e instanceof DropEvent) {
|
||||||
DropEvent me = (DropEvent) e;
|
DropEvent me = (DropEvent) e;
|
||||||
ListItem startItem = null;
|
ListItem startItem = null;
|
||||||
if (me.getDragged() instanceof ListItem) {
|
if (me.getDragged() instanceof ListItem) {
|
||||||
|
@ -664,7 +797,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
int actualxpos = posseq / POSSEQMULTIPLIER;
|
int actualxpos = posseq / POSSEQMULTIPLIER;
|
||||||
int seqno = posseq - (actualxpos * POSSEQMULTIPLIER);
|
int seqno = posseq - (actualxpos * POSSEQMULTIPLIER);
|
||||||
MField field = getMField((Integer) startItem.getValue());
|
MField field = getMField((Integer) startItem.getValue());
|
||||||
field.setSeqNo(seqno-5);
|
field.setSeqNo(seqno - 5);
|
||||||
field.setIsDisplayed(true);
|
field.setIsDisplayed(true);
|
||||||
field.setXPosition(actualxpos);
|
field.setXPosition(actualxpos);
|
||||||
resortArrays();
|
resortArrays();
|
||||||
|
@ -696,7 +829,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
// item moved from invisible to visible
|
// item moved from invisible to visible
|
||||||
MField field = getMField((Integer) startItem.getValue());
|
MField field = getMField((Integer) startItem.getValue());
|
||||||
MField fieldTo = getMField((Integer) endItem.getValue());
|
MField fieldTo = getMField((Integer) endItem.getValue());
|
||||||
field.setSeqNo(fieldTo.getSeqNo()-5);
|
field.setSeqNo(fieldTo.getSeqNo() - 5);
|
||||||
field.setIsDisplayed(true);
|
field.setIsDisplayed(true);
|
||||||
field.setXPosition(fieldTo.getXPosition());
|
field.setXPosition(fieldTo.getXPosition());
|
||||||
resortArrays();
|
resortArrays();
|
||||||
|
@ -711,7 +844,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
// item moved from visible to visible - reorder
|
// item moved from visible to visible - reorder
|
||||||
MField field = getMField((Integer) startItem.getValue());
|
MField field = getMField((Integer) startItem.getValue());
|
||||||
MField fieldTo = getMField((Integer) endItem.getValue());
|
MField fieldTo = getMField((Integer) endItem.getValue());
|
||||||
field.setSeqNo(fieldTo.getSeqNo()-5);
|
field.setSeqNo(fieldTo.getSeqNo() - 5);
|
||||||
field.setIsDisplayed(true);
|
field.setIsDisplayed(true);
|
||||||
field.setXPosition(fieldTo.getXPosition());
|
field.setXPosition(fieldTo.getXPosition());
|
||||||
resortArrays();
|
resortArrays();
|
||||||
|
@ -728,13 +861,13 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
tabform.detach();
|
tabform.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK - Save
|
// OK - Save
|
||||||
else if (e.getTarget().getId().equals("Ok"))
|
else if (e.getTarget().getId().equals("Ok"))
|
||||||
{
|
{
|
||||||
if (cmd_save())
|
if (cmd_save())
|
||||||
tabform.detach();
|
tabform.detach();
|
||||||
}
|
}
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
private ListItem getItemFromCell(Cell cell) {
|
private ListItem getItemFromCell(Cell cell) {
|
||||||
GridField field = mapCellField.get(cell);
|
GridField field = mapCellField.get(cell);
|
||||||
|
@ -750,23 +883,29 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBackgroundField(MField field) {
|
private void setBackgroundField(MField field) {
|
||||||
Iterator<Entry<Cell, GridField>> it = mapCellField.entrySet().iterator();
|
Iterator<Entry<Cell, GridField>> it = mapCellField.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<Cell, GridField> pairs = (Map.Entry<Cell, GridField>)it.next();
|
Map.Entry<Cell, GridField> pairs = (Map.Entry<Cell, GridField>) it.next();
|
||||||
Cell cell = pairs.getKey();
|
Cell cell = pairs.getKey();
|
||||||
GridField gridField = pairs.getValue();
|
GridField gridField = pairs.getValue();
|
||||||
if (gridField.getAD_Field_ID() == field.getAD_Field_ID()) {
|
if (gridField.getAD_Field_ID() == field.getAD_Field_ID()) {
|
||||||
cell.setStyle("background-color: #BBC2DB;");
|
cell.setStyle("background-color: #BBC2DB;");
|
||||||
} else {
|
} else {
|
||||||
cell.setStyle("");
|
cell.setStyle("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setProperties(MField field) {
|
private void setProperties(MField field) {
|
||||||
|
String displayLogic = field.getDisplayLogic() == null ? "" : field.getDisplayLogic();
|
||||||
|
String mandatoryLogic = field.getMandatoryLogic() == null ? "" : field.getMandatoryLogic();
|
||||||
|
String readOnlyLogic = field.getReadOnlyLogic() == null ? "" : field.getReadOnlyLogic();
|
||||||
|
|
||||||
editorName.setValue(field.getName());
|
editorName.setValue(field.getName());
|
||||||
|
editorDescription.setValue(field.getDescription());
|
||||||
|
editorHelp.setValue(field.getHelp());
|
||||||
|
editorPlaceholder.setValue(field.getPlaceholder());
|
||||||
editorSeqNo.setValue(field.getSeqNo());
|
editorSeqNo.setValue(field.getSeqNo());
|
||||||
editorIsDisplayed.setValue(field.isDisplayed());
|
editorIsDisplayed.setValue(field.isDisplayed());
|
||||||
if (field.getAD_FieldGroup_ID() > 0)
|
if (field.getAD_FieldGroup_ID() > 0)
|
||||||
|
@ -776,21 +915,41 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
editorXPosition.setValue(field.getXPosition());
|
editorXPosition.setValue(field.getXPosition());
|
||||||
editorColumnSpan.setValue(field.getColumnSpan());
|
editorColumnSpan.setValue(field.getColumnSpan());
|
||||||
editorNumLines.setValue(field.getNumLines());
|
editorNumLines.setValue(field.getNumLines());
|
||||||
|
editorDisplayLogic.setValue(displayLogic);
|
||||||
|
editorMandatoryLogic.setValue(mandatoryLogic);
|
||||||
|
editorReadOnlyLogic.setValue(readOnlyLogic);
|
||||||
|
editorIsReadOnly.setValue(field.isReadOnly());
|
||||||
|
editorColumn.setValue(MColumn.getColumnName(Env.getCtx(), field.getAD_Column_ID()));
|
||||||
|
|
||||||
GridField gridField = getGridField(field);
|
GridField gridField = getGridField(field);
|
||||||
String fieldGroup = "";
|
String fieldGroup = "";
|
||||||
String fieldGroupType = "";
|
String fieldGroupType = "";
|
||||||
if (field.getAD_FieldGroup_ID() > 0) {
|
if (field.getAD_FieldGroup_ID() > 0) {
|
||||||
fieldGroup = field.getAD_FieldGroup().getName();
|
if (isBaseLang)
|
||||||
fieldGroupType = field.getAD_FieldGroup().getFieldGroupType();
|
{
|
||||||
}
|
fieldGroup = field.getAD_FieldGroup().getName();
|
||||||
gridField.getVO().IsDisplayed = field.isDisplayed();
|
}
|
||||||
gridField.getVO().FieldGroup = fieldGroup;
|
else
|
||||||
gridField.getVO().FieldGroupType = fieldGroupType;
|
{
|
||||||
|
fieldGroup = ((X_AD_FieldGroup) field.getAD_FieldGroup()).get_Translation(X_AD_FieldGroup.COLUMNNAME_Name);
|
||||||
|
}
|
||||||
|
fieldGroupType = field.getAD_FieldGroup().getFieldGroupType();
|
||||||
|
}
|
||||||
|
gridField.getVO().Header = field.getName();
|
||||||
|
gridField.getVO().Description = field.getDescription();
|
||||||
|
gridField.getVO().Help = field.getHelp();
|
||||||
|
gridField.getVO().Placeholder = field.getPlaceholder();
|
||||||
|
gridField.getVO().IsDisplayed = field.isDisplayed();
|
||||||
|
gridField.getVO().FieldGroup = fieldGroup;
|
||||||
|
gridField.getVO().FieldGroupType = fieldGroupType;
|
||||||
gridField.getVO().XPosition = field.getXPosition();
|
gridField.getVO().XPosition = field.getXPosition();
|
||||||
gridField.getVO().ColumnSpan = field.getColumnSpan();
|
gridField.getVO().ColumnSpan = field.getColumnSpan();
|
||||||
gridField.getVO().NumLines = field.getNumLines();
|
gridField.getVO().NumLines = field.getNumLines();
|
||||||
|
gridField.getVO().DisplayLogic = displayLogic;
|
||||||
|
gridField.getVO().MandatoryLogic = mandatoryLogic;
|
||||||
|
gridField.getVO().ReadOnlyLogic = readOnlyLogic;
|
||||||
|
gridField.getVO().IsReadOnly = field.isReadOnly();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ADForm getForm()
|
public ADForm getForm()
|
||||||
|
@ -798,7 +957,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
return tabform;
|
return tabform;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLists(MField focusField){
|
private void updateLists(MField focusField) {
|
||||||
visible.removeAllItems();
|
visible.removeAllItems();
|
||||||
invisible.removeAllItems();
|
invisible.removeAllItems();
|
||||||
|
|
||||||
|
@ -807,6 +966,11 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
GridField gridField = getGridField(field);
|
GridField gridField = getGridField(field);
|
||||||
if (!field.isActive() || gridField.isToolbarOnlyButton())
|
if (!field.isActive() || gridField.isToolbarOnlyButton())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// when the field is at client level reload with customization
|
||||||
|
if (!isSystem && !field.is_Changed())
|
||||||
|
field = loadUserDefField(field);
|
||||||
|
|
||||||
KeyNamePair pair = new KeyNamePair(field.getAD_Field_ID(), field.getName());
|
KeyNamePair pair = new KeyNamePair(field.getAD_Field_ID(), field.getName());
|
||||||
if (field.isDisplayed()) {
|
if (field.isDisplayed()) {
|
||||||
visible.addItem(pair);
|
visible.addItem(pair);
|
||||||
|
@ -822,26 +986,58 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
invisible.addItem(new KeyNamePair(0, "..."));
|
invisible.addItem(new KeyNamePair(0, "..."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void valueChange(ValueChangeEvent e) {
|
public void valueChange(ValueChangeEvent e) {
|
||||||
// changed a value on the properties editors
|
// changed a value on the properties editors
|
||||||
MField field = getActiveMField();
|
MField field = getActiveMField();
|
||||||
|
// when the field is at client level reload with customization
|
||||||
|
if (!isSystem && !field.is_Changed())
|
||||||
|
field = loadUserDefField(field);
|
||||||
|
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
String propertyName = e.getPropertyName();
|
String propertyName = e.getPropertyName();
|
||||||
int intvalue = 0;
|
int intValue = 0;
|
||||||
|
String stringValue = "";
|
||||||
|
Boolean booleanValue = false;
|
||||||
if (e.getNewValue() != null)
|
if (e.getNewValue() != null)
|
||||||
intvalue = (Integer) e.getNewValue();
|
{
|
||||||
|
if (String.class.isInstance(e.getNewValue()))
|
||||||
|
stringValue = (String) e.getNewValue();
|
||||||
|
else if (e.getNewValue() instanceof Boolean)
|
||||||
|
booleanValue = (boolean) e.getNewValue();
|
||||||
|
else
|
||||||
|
intValue = (Integer) e.getNewValue();
|
||||||
|
}
|
||||||
|
|
||||||
if (MField.COLUMNNAME_AD_FieldGroup_ID.equals(propertyName)) {
|
if (MField.COLUMNNAME_AD_FieldGroup_ID.equals(propertyName)) {
|
||||||
field.setAD_FieldGroup_ID(intvalue);
|
field.setAD_FieldGroup_ID(intValue);
|
||||||
} else if (MField.COLUMNNAME_XPosition.equals(propertyName)) {
|
} else if (MField.COLUMNNAME_XPosition.equals(propertyName)) {
|
||||||
field.setXPosition(intvalue);
|
field.setXPosition(intValue);
|
||||||
} else if (MField.COLUMNNAME_ColumnSpan.equals(propertyName)) {
|
} else if (MField.COLUMNNAME_ColumnSpan.equals(propertyName)) {
|
||||||
int prevcolspan = field.getColumnSpan();
|
int prevcolspan = field.getColumnSpan();
|
||||||
if (!field.set_ValueOfColumnReturningBoolean(MField.COLUMNNAME_ColumnSpan, intvalue))
|
if (!field.set_ValueOfColumnReturningBoolean(MField.COLUMNNAME_ColumnSpan, intValue))
|
||||||
field.setColumnSpan(prevcolspan);
|
field.setColumnSpan(prevcolspan);
|
||||||
} else if (MField.COLUMNNAME_NumLines.equals(propertyName)) {
|
} else if (MField.COLUMNNAME_NumLines.equals(propertyName)) {
|
||||||
field.setNumLines(intvalue);
|
field.setNumLines(intValue);
|
||||||
|
} else if (MField.COLUMNNAME_DisplayLogic.equals(propertyName)) {
|
||||||
|
field.setDisplayLogic(stringValue);
|
||||||
|
} else if (MField.COLUMNNAME_MandatoryLogic.equals(propertyName)) {
|
||||||
|
field.setMandatoryLogic(stringValue);
|
||||||
|
} else if (MField.COLUMNNAME_ReadOnlyLogic.equals(propertyName)) {
|
||||||
|
field.setReadOnlyLogic(stringValue);
|
||||||
|
} else if (MField.COLUMNNAME_IsReadOnly.equals(propertyName)) {
|
||||||
|
field.setIsReadOnly(booleanValue);
|
||||||
|
} else if (MField.COLUMNNAME_Name.equals(propertyName)) {
|
||||||
|
field.setName(stringValue);
|
||||||
|
} else if (MField.COLUMNNAME_IsDisplayed.equals(propertyName)) {
|
||||||
|
field.setIsDisplayed(booleanValue);
|
||||||
|
} else if (MField.COLUMNNAME_Description.equals(propertyName)) {
|
||||||
|
field.setDescription(stringValue);
|
||||||
|
} else if (MField.COLUMNNAME_Help.equals(propertyName)) {
|
||||||
|
field.setHelp(stringValue);
|
||||||
|
} else if (MField.COLUMNNAME_Placeholder.equals(propertyName)) {
|
||||||
|
field.setPlaceholder(stringValue);
|
||||||
}
|
}
|
||||||
setProperties(field);
|
setProperties(field);
|
||||||
repaintGrid();
|
repaintGrid();
|
||||||
|
|
|
@ -14,17 +14,23 @@
|
||||||
|
|
||||||
package org.compiere.apps.form;
|
package org.compiere.apps.form;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
|
import org.compiere.model.I_AD_Field;
|
||||||
import org.compiere.model.MField;
|
import org.compiere.model.MField;
|
||||||
import org.compiere.model.MTab;
|
import org.compiere.model.MTab;
|
||||||
|
import org.compiere.model.MUserDefField;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +56,12 @@ public class TabEditor
|
||||||
private Map<Integer, MField> mapField = new HashMap<Integer, MField>();
|
private Map<Integer, MField> mapField = new HashMap<Integer, MField>();
|
||||||
|
|
||||||
private Map<Integer, GridField> mapGridField = new HashMap<Integer, GridField>();
|
private Map<Integer, GridField> mapGridField = new HashMap<Integer, GridField>();
|
||||||
|
|
||||||
|
protected boolean isBaseLang = Env.isBaseLanguage(Env.getCtx(), null);
|
||||||
|
|
||||||
|
protected boolean isSystem = true;
|
||||||
|
|
||||||
|
protected int AD_UserDef_Tab_ID;
|
||||||
|
|
||||||
public List<GridField> getGridFields() {
|
public List<GridField> getGridFields() {
|
||||||
return gridFields;
|
return gridFields;
|
||||||
|
@ -60,6 +72,7 @@ public class TabEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MField> getMFields() {
|
public List<MField> getMFields() {
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +83,36 @@ public class TabEditor
|
||||||
gridFields.add(gridField);
|
gridFields.add(gridField);
|
||||||
mapGridField.put(gridField.getAD_Field_ID(), gridField);
|
mapGridField.put(gridField.getAD_Field_ID(), gridField);
|
||||||
MField field = new MField(Env.getCtx(), gridField.getAD_Field_ID(), null);
|
MField field = new MField(Env.getCtx(), gridField.getAD_Field_ID(), null);
|
||||||
|
|
||||||
|
// load translated values and ovewrite field with it
|
||||||
|
if (!isBaseLang)
|
||||||
|
{
|
||||||
|
field.setName(field.get_Translation(MField.COLUMNNAME_Name, Env.getLanguage(Env.getCtx()).getAD_Language(), true));
|
||||||
|
field.setDescription(field.get_Translation(MField.COLUMNNAME_Description, Env.getLanguage(Env.getCtx()).getAD_Language(), true));
|
||||||
|
field.setPlaceholder(field.get_Translation(MField.COLUMNNAME_Placeholder, Env.getLanguage(Env.getCtx()).getAD_Language(), true));
|
||||||
|
field.setHelp(field.get_Translation(MField.COLUMNNAME_Help, Env.getLanguage(Env.getCtx()).getAD_Language(), true));
|
||||||
|
gridField.getVO().Header = field.get_Translation(MField.COLUMNNAME_Name, Env.getLanguage(Env.getCtx()).getAD_Language(), true);
|
||||||
|
gridField.getVO().Description = field.get_Translation(MField.COLUMNNAME_Description, Env.getLanguage(Env.getCtx()).getAD_Language(), true);
|
||||||
|
gridField.getVO().Placeholder = field.get_Translation(MField.COLUMNNAME_Placeholder, Env.getLanguage(Env.getCtx()).getAD_Language(), true);
|
||||||
|
gridField.getVO().Help = field.get_Translation(MField.COLUMNNAME_Help, Env.getLanguage(Env.getCtx()).getAD_Language(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if not system level load customization values and field with it
|
||||||
|
if (!isSystem) {
|
||||||
|
field = loadUserDefField(field);
|
||||||
|
if (field != null)
|
||||||
|
{
|
||||||
|
gridField.getVO().Header = field.getName();
|
||||||
|
gridField.getVO().Description = field.getDescription();
|
||||||
|
gridField.getVO().Placeholder = field.getPlaceholder();
|
||||||
|
gridField.getVO().Help = field.getHelp();
|
||||||
|
gridField.getVO().NumLines = field.getNumLines();
|
||||||
|
gridField.getVO().XPosition = field.getXPosition();
|
||||||
|
gridField.getVO().ColumnSpan = field.getColumnSpan();
|
||||||
|
gridField.getVO().IsDisplayed = field.isDisplayed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fields.add(field);
|
fields.add(field);
|
||||||
mapField.put(field.getAD_Field_ID(), field);
|
mapField.put(field.getAD_Field_ID(), field);
|
||||||
gridField.getVO().IsReadOnly = true;
|
gridField.getVO().IsReadOnly = true;
|
||||||
|
@ -81,19 +124,25 @@ public class TabEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean cmd_save() {
|
public boolean cmd_save() {
|
||||||
for (MField field : fields) {
|
for (MField field : fields) {
|
||||||
if (field.isActive())
|
if (field.isActive()) {
|
||||||
field.saveEx();
|
if (isSystem) {
|
||||||
}
|
updateTrl(field);
|
||||||
|
field.saveEx();
|
||||||
|
} else {
|
||||||
|
saveUserDefField(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MField getMField(int fieldid) {
|
protected MField getMField(int fieldid) {
|
||||||
return mapField.get(fieldid);
|
return mapField.get(fieldid);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected GridField getGridField(MField field) {
|
protected GridField getGridField(MField field) {
|
||||||
return mapGridField.get( field.getAD_Field_ID());
|
return mapGridField.get(field.getAD_Field_ID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MField getActiveMField() {
|
public MField getActiveMField() {
|
||||||
|
@ -119,14 +168,16 @@ public class TabEditor
|
||||||
return compare1.compareTo(compare2);
|
return compare1.compareTo(compare2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// only apply the SeqNo increment when running on system level
|
||||||
int seq = 10;
|
if (isSystem) {
|
||||||
for (MField field : fields) {
|
int seq = 10;
|
||||||
if (field.isDisplayed()) {
|
for (MField field : fields) {
|
||||||
field.setSeqNo(seq);
|
if (field.isDisplayed()) {
|
||||||
seq = seq + 10;
|
field.setSeqNo(seq);
|
||||||
} else {
|
seq = seq + 10;
|
||||||
field.setSeqNo(0);
|
} else {
|
||||||
|
field.setSeqNo(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +197,255 @@ public class TabEditor
|
||||||
return compare1.compareTo(compare2);
|
return compare1.compareTo(compare2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // TabEditor
|
/**
|
||||||
|
* Load MUserDefField data to MField
|
||||||
|
*
|
||||||
|
* @param field
|
||||||
|
* @return MField
|
||||||
|
*/
|
||||||
|
protected MField loadUserDefField(MField field) {
|
||||||
|
|
||||||
|
if (field == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
MUserDefField userDefField = MUserDefField.get(Env.getCtx(), field.getAD_Field_ID(), m_tab.getAD_Tab_ID(), m_tab.getAD_Window_ID(), true);
|
||||||
|
|
||||||
|
if (userDefField != null) {
|
||||||
|
if (userDefField.getName() != null)
|
||||||
|
field.setName(userDefField.getName());
|
||||||
|
|
||||||
|
if (userDefField.getDescription() != null)
|
||||||
|
field.setDescription(userDefField.getDescription());
|
||||||
|
|
||||||
|
if (userDefField.getHelp() != null)
|
||||||
|
field.setHelp(userDefField.getHelp());
|
||||||
|
|
||||||
|
if (userDefField.getPlaceholder() != null)
|
||||||
|
field.setPlaceholder(userDefField.getPlaceholder());
|
||||||
|
|
||||||
|
field.setIsActive(userDefField.isActive());
|
||||||
|
field.setDisplayLogic(userDefField.getDisplayLogic());
|
||||||
|
field.setDisplayLength(userDefField.getDisplayLength());
|
||||||
|
field.setIsDisplayed(userDefField.getIsDisplayed() == null ? field.isDisplayed()
|
||||||
|
: "Y".equals(userDefField.getIsDisplayed()));
|
||||||
|
field.setIsReadOnly(userDefField.getIsReadOnly() == null ? field.isReadOnly()
|
||||||
|
: "Y".equals(userDefField.getIsReadOnly()));
|
||||||
|
field.setSeqNo(userDefField.getSeqNo() != 0 ? userDefField.getSeqNo() : field.getSeqNo());
|
||||||
|
field.setXPosition(userDefField.getXPosition() > 0 ? userDefField.getXPosition():field.getXPosition());
|
||||||
|
field.setNumLines(userDefField.getNumLines() > 0?userDefField.getNumLines():field.getNumLines());
|
||||||
|
field.setColumnSpan(userDefField.getColumnSpan() > 0?userDefField.getColumnSpan():field.getColumnSpan());
|
||||||
|
field.setSortNo(BigDecimal.valueOf(userDefField.getSortNo()));
|
||||||
|
field.setReadOnlyLogic(userDefField.getReadOnlyLogic());
|
||||||
|
field.setMandatoryLogic(userDefField.getMandatoryLogic());
|
||||||
|
|
||||||
|
if (userDefField.getAD_FieldGroup_ID() > 0)
|
||||||
|
field.setAD_FieldGroup_ID(userDefField.getAD_FieldGroup_ID());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert MField to MUserDefField and save
|
||||||
|
*
|
||||||
|
* @param field
|
||||||
|
*/
|
||||||
|
protected void saveUserDefField(MField field) {
|
||||||
|
|
||||||
|
MField defaultField = new MField(Env.getCtx(), field.get_ID(), null);
|
||||||
|
|
||||||
|
// check if translated values was really changed and restore default value if not
|
||||||
|
if (field.getName() != null && field.getName().equals(defaultField.get_Translation(MField.COLUMNNAME_Name, Env.getAD_Language(Env.getCtx()), true)))
|
||||||
|
field.setName(defaultField.getName());
|
||||||
|
if (field.getDescription() != null && field.getDescription().equals(defaultField.get_Translation(MField.COLUMNNAME_Description, Env.getAD_Language(Env.getCtx()), true)))
|
||||||
|
field.setDescription(defaultField.getDescription());
|
||||||
|
if (field.getHelp() != null && field.getHelp().equals(defaultField.get_Translation(MField.COLUMNNAME_Help, Env.getAD_Language(Env.getCtx()), true)))
|
||||||
|
field.setHelp(defaultField.getHelp());
|
||||||
|
if (field.getPlaceholder() != null && field.getPlaceholder().equals(defaultField.get_Translation(MField.COLUMNNAME_Placeholder, Env.getAD_Language(Env.getCtx()), true)))
|
||||||
|
field.setPlaceholder(defaultField.getPlaceholder());
|
||||||
|
|
||||||
|
if (!field.is_Changed())
|
||||||
|
return;
|
||||||
|
|
||||||
|
MUserDefField udfield = MUserDefField.get(Env.getCtx(), field.getAD_Field_ID(), m_tab.getAD_Tab_ID(), m_tab.getAD_Window_ID(), true);
|
||||||
|
int AD_UserDef_Field_ID = 0;
|
||||||
|
if (udfield != null)
|
||||||
|
AD_UserDef_Field_ID = udfield.getAD_UserDef_Field_ID();
|
||||||
|
|
||||||
|
udfield = new MUserDefField(Env.getCtx(), AD_UserDef_Field_ID, null);
|
||||||
|
|
||||||
|
if (field.getName() != null)
|
||||||
|
udfield.setName(field.getName());
|
||||||
|
|
||||||
|
if (field.getDescription() != null)
|
||||||
|
udfield.setDescription(field.getDescription());
|
||||||
|
|
||||||
|
if (field.getHelp() != null)
|
||||||
|
udfield.setHelp(field.getHelp());
|
||||||
|
|
||||||
|
if (field.getPlaceholder() != null)
|
||||||
|
udfield.setPlaceholder(field.getPlaceholder());
|
||||||
|
|
||||||
|
udfield.setIsActive(field.isActive());
|
||||||
|
udfield.setDisplayLogic(field.getDisplayLogic());
|
||||||
|
udfield.setDisplayLength(field.getDisplayLength());
|
||||||
|
udfield.setIsDisplayed(field.isDisplayed() ? "Y" : "N");
|
||||||
|
udfield.setIsReadOnly(field.isReadOnly() ? "Y" : "N");
|
||||||
|
udfield.setAD_Field_ID(field.get_ID());
|
||||||
|
udfield.setSeqNo(field.getSeqNo());
|
||||||
|
udfield.setXPosition(field.getXPosition());
|
||||||
|
udfield.setNumLines(field.getNumLines());
|
||||||
|
udfield.setColumnSpan(field.getColumnSpan());
|
||||||
|
udfield.setAD_UserDef_Tab_ID(AD_UserDef_Tab_ID);
|
||||||
|
udfield.setSortNo(field.getSortNo().intValue());
|
||||||
|
udfield.setAD_Org_ID(m_tab.getAD_Org_ID());
|
||||||
|
udfield.setMandatoryLogic(field.getMandatoryLogic());
|
||||||
|
udfield.setReadOnlyLogic(field.getReadOnlyLogic());
|
||||||
|
|
||||||
|
if (field.getAD_FieldGroup_ID() > 0)
|
||||||
|
udfield.setAD_FieldGroup_ID(field.getAD_FieldGroup_ID());
|
||||||
|
else
|
||||||
|
udfield.set_ValueOfColumn("ad_fieldgroup_id", null);
|
||||||
|
|
||||||
|
udfield.saveEx();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When Tab Editor is called in System Role and not in Base Language, this
|
||||||
|
* method saves changes in ad_field_trl table when some change is made on translated field
|
||||||
|
*
|
||||||
|
* @param field
|
||||||
|
*/
|
||||||
|
private void updateTrl(MField field) {
|
||||||
|
|
||||||
|
// only execute when is not base language
|
||||||
|
if (isBaseLang)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// save current field values
|
||||||
|
String name = field.getName();
|
||||||
|
String description = field.getDescription();
|
||||||
|
String help = field.getHelp();
|
||||||
|
String placeholder = field.getPlaceholder();
|
||||||
|
|
||||||
|
// original values for compare
|
||||||
|
MField dbField = new MField(Env.getCtx(), field.getAD_Field_ID(), null);
|
||||||
|
String nameDB = isBaseLang ? dbField.getName() : dbField.get_Translation(MField.COLUMNNAME_Name, Env.getAD_Language(Env.getCtx()), true);
|
||||||
|
String descriptionDB = isBaseLang ? dbField.getDescription() : dbField.get_Translation(MField.COLUMNNAME_Description, Env.getAD_Language(Env.getCtx()), true);
|
||||||
|
String helpDB = isBaseLang ? dbField.getHelp() : dbField.get_Translation(MField.COLUMNNAME_Help, Env.getAD_Language(Env.getCtx()), true);
|
||||||
|
String placeholderDB = isBaseLang ? dbField.getPlaceholder() : dbField.get_Translation(MField.COLUMNNAME_Placeholder, Env.getAD_Language(Env.getCtx()), true);
|
||||||
|
|
||||||
|
// always restore db field values to avoid wrong changes
|
||||||
|
field.setName(dbField.getName());
|
||||||
|
field.setDescription(dbField.getDescription());
|
||||||
|
field.setHelp(dbField.getHelp());
|
||||||
|
field.setPlaceholder(dbField.getPlaceholder());
|
||||||
|
|
||||||
|
// compare values when changed and restore the state if needed
|
||||||
|
if (name != null && name.equals(nameDB))
|
||||||
|
{
|
||||||
|
name = null;
|
||||||
|
}
|
||||||
|
if (description != null && description.equals(descriptionDB))
|
||||||
|
{
|
||||||
|
description = null;
|
||||||
|
}
|
||||||
|
if (help != null && help.equals(helpDB))
|
||||||
|
{
|
||||||
|
help = null;
|
||||||
|
}
|
||||||
|
if (placeholder != null && placeholder.equals(placeholderDB))
|
||||||
|
{
|
||||||
|
placeholder = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// nothing to do if all fields are not changed
|
||||||
|
if (name == null && description == null && help == null && placeholder == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
StringBuilder mainSQL = new StringBuilder("UPDATE ").append(field.get_TableName()).append("_Trl SET ");
|
||||||
|
|
||||||
|
StringBuilder setSQL = new StringBuilder();
|
||||||
|
if (name != null)
|
||||||
|
{
|
||||||
|
setSQL.append(I_AD_Field.COLUMNNAME_Name).append("='").append(name).append("' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(description != null)
|
||||||
|
{
|
||||||
|
if (setSQL.length() > 0)
|
||||||
|
setSQL.append(",");
|
||||||
|
setSQL.append(I_AD_Field.COLUMNNAME_Description).append("='").append(description).append("' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(help != null)
|
||||||
|
{
|
||||||
|
if (setSQL.length() > 0)
|
||||||
|
setSQL.append(",");
|
||||||
|
setSQL.append(I_AD_Field.COLUMNNAME_Help).append("='").append(help).append("' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(placeholder != null)
|
||||||
|
{
|
||||||
|
if (setSQL.length() > 0)
|
||||||
|
setSQL.append(",");
|
||||||
|
setSQL.append(I_AD_Field.COLUMNNAME_Placeholder).append("='").append(placeholder).append("' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setSQL.length() > 0)
|
||||||
|
setSQL.append(",");
|
||||||
|
|
||||||
|
setSQL.append(I_AD_Field.COLUMNNAME_Updated).append("=").append(DB.TO_DATE(new Timestamp(System.currentTimeMillis()), false)).append(", ");
|
||||||
|
setSQL.append(I_AD_Field.COLUMNNAME_UpdatedBy).append("=").append(Env.getAD_User_ID(Env.getCtx()));
|
||||||
|
|
||||||
|
mainSQL.append(setSQL.toString());
|
||||||
|
|
||||||
|
mainSQL.append(" WHERE ").append(I_AD_Field.COLUMNNAME_AD_Field_ID).append("=").append(field.getAD_Field_ID()).append(" AND AD_Language ='").append(Env.getAD_Language(Env.getCtx())).append("'");
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int no = DB.executeUpdate(mainSQL.toString(), null);
|
||||||
|
if (no == 1)
|
||||||
|
{
|
||||||
|
if (log.isLoggable(Level.FINE)) log.fine(mainSQL.toString());
|
||||||
|
}
|
||||||
|
else if (no == 0)
|
||||||
|
log.warning ("Not Found - " + mainSQL.toString());
|
||||||
|
else
|
||||||
|
log.severe ("Update Rows=" + no + " (Should be 1) - " + mainSQL.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the current field list with new reloaded values for a field
|
||||||
|
*
|
||||||
|
* @param field
|
||||||
|
*/
|
||||||
|
public void updateFieldList(MField field) {
|
||||||
|
for (MField lstField : fields) {
|
||||||
|
if (lstField.getAD_Field_ID() == field.getAD_Field_ID()) {
|
||||||
|
lstField.setName(field.getName());
|
||||||
|
lstField.setDescription(field.getDescription());
|
||||||
|
lstField.setHelp(field.getHelp());
|
||||||
|
lstField.setPlaceholder(field.getPlaceholder());
|
||||||
|
lstField.setIsActive(field.isActive());
|
||||||
|
lstField.setDisplayLogic(field.getDisplayLogic());
|
||||||
|
lstField.setDisplayLength(field.getDisplayLength());
|
||||||
|
lstField.setIsDisplayed(field.isDisplayed());
|
||||||
|
lstField.setIsReadOnly(field.isReadOnly());
|
||||||
|
lstField.setSeqNo(field.getSeqNo());
|
||||||
|
lstField.setXPosition(field.getXPosition());
|
||||||
|
lstField.setNumLines(field.getNumLines());
|
||||||
|
lstField.setColumnSpan(field.getColumnSpan());
|
||||||
|
lstField.setSortNo(field.getSortNo());
|
||||||
|
mapField.put(lstField.get_ID(), lstField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // TabEditor
|
||||||
|
|
Loading…
Reference in New Issue