diff --git a/migration/i1.0z/oracle/201309120100_IDEMPIERE-1328.sql b/migration/i1.0z/oracle/201309120100_IDEMPIERE-1328.sql new file mode 100644 index 0000000000..20a1088944 --- /dev/null +++ b/migration/i1.0z/oracle/201309120100_IDEMPIERE-1328.sql @@ -0,0 +1,156 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 12, 2013 12:33:04 AM CEST +-- IDEMPIERE-1328 Change tab name dynamically +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202611,'ee851d43-325a-4dd4-8145-8e678ad2438c',0,'TitleLogic',TO_DATE('2013-09-12 00:33:04','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Title Logic','Title Logic',TO_DATE('2013-09-12 00:33:04','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Sep 12, 2013 12:33:20 AM CEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,210870,'3eda4c98-a396-4f5e-9ee3-1871f2715ea2',202611,0,10,105,'TitleLogic',TO_DATE('2013-09-12 00:33:20','YYYY-MM-DD HH24:MI:SS'),100,'D',255,'Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','Title Logic',0,0,TO_DATE('2013-09-12 00:33:20','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Sep 12, 2013 12:33:21 AM CEST +ALTER TABLE AD_Window ADD TitleLogic NVARCHAR2(255) DEFAULT NULL +; + +-- Sep 12, 2013 12:33:33 AM CEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (0,210870,202516,'fddaf61f-aed7-4dcb-b53c-9706b10f134c',0,105,5,TO_DATE('2013-09-12 00:33:33','YYYY-MM-DD HH24:MI:SS'),100,255,'D','Y','Y','Y','N','N','N','N','N','Title Logic',180,TO_DATE('2013-09-12 00:33:33','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Sep 12, 2013 12:33:41 AM CEST +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=202514 +; + +-- Sep 12, 2013 12:33:41 AM CEST +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=202516 +; + +-- Sep 12, 2013 12:33:41 AM CEST +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=3203 +; + +-- Sep 12, 2013 12:33:46 AM CEST +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=269 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=1988 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y' WHERE AD_Field_ID=114 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y' WHERE AD_Field_ID=115 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y' WHERE AD_Field_ID=116 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y' WHERE AD_Field_ID=268 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y' WHERE AD_Field_ID=10569 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y' WHERE AD_Field_ID=267 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=5379 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=4942 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=4943 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=5124 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=8194 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=10397 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=10396 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y' WHERE AD_Field_ID=202516 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y' WHERE AD_Field_ID=3203 +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Element SET Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +'||chr(64)||'TaxID@ +'||chr(64)||'DocumentNo@ +'||chr(64)||'Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.', Description='The result determines the title to be displayed for this window',Updated=TO_DATE('2013-09-25 12:42:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202611 +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Column SET ColumnName='TitleLogic', Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +'||chr(64)||'TaxID@ +'||chr(64)||'DocumentNo@ +'||chr(64)||'Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.' WHERE AD_Element_ID=202611 +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Process_Para SET ColumnName='TitleLogic', Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +'||chr(64)||'TaxID@ +'||chr(64)||'DocumentNo@ +'||chr(64)||'Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.', AD_Element_ID=202611 WHERE UPPER(ColumnName)='TITLELOGIC' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Process_Para SET ColumnName='TitleLogic', Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +'||chr(64)||'TaxID@ +'||chr(64)||'DocumentNo@ +'||chr(64)||'Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.' WHERE AD_Element_ID=202611 AND IsCentrallyMaintained='Y' +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_InfoColumn SET ColumnName='TitleLogic', Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +'||chr(64)||'TaxID@ +'||chr(64)||'DocumentNo@ +'||chr(64)||'Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.' WHERE AD_Element_ID=202611 AND IsCentrallyMaintained='Y' +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Field SET Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +'||chr(64)||'TaxID@ +'||chr(64)||'DocumentNo@ +'||chr(64)||'Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=202611) AND IsCentrallyMaintained='Y' +; + +SELECT register_migration_script('201309120100_IDEMPIERE-1328.sql') FROM dual +; diff --git a/migration/i1.0z/postgresql/201309120100_IDEMPIERE-1328.sql b/migration/i1.0z/postgresql/201309120100_IDEMPIERE-1328.sql new file mode 100644 index 0000000000..05c57ce34a --- /dev/null +++ b/migration/i1.0z/postgresql/201309120100_IDEMPIERE-1328.sql @@ -0,0 +1,153 @@ +-- Sep 12, 2013 12:33:05 AM CEST +-- IDEMPIERE-1328 Change tab name dynamically +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202611,'ee851d43-325a-4dd4-8145-8e678ad2438c',0,'TitleLogic',TO_TIMESTAMP('2013-09-12 00:33:04','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Title Logic','Title Logic',TO_TIMESTAMP('2013-09-12 00:33:04','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Sep 12, 2013 12:33:20 AM CEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,210870,'3eda4c98-a396-4f5e-9ee3-1871f2715ea2',202611,0,10,105,'TitleLogic',TO_TIMESTAMP('2013-09-12 00:33:20','YYYY-MM-DD HH24:MI:SS'),100,'D',255,'Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','Title Logic',0,0,TO_TIMESTAMP('2013-09-12 00:33:20','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Sep 12, 2013 12:33:21 AM CEST +ALTER TABLE AD_Window ADD COLUMN TitleLogic VARCHAR(255) DEFAULT NULL +; + +-- Sep 12, 2013 12:33:33 AM CEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (0,210870,202516,'fddaf61f-aed7-4dcb-b53c-9706b10f134c',0,105,5,TO_TIMESTAMP('2013-09-12 00:33:33','YYYY-MM-DD HH24:MI:SS'),100,255,'D','Y','Y','Y','N','N','N','N','N','Title Logic',180,TO_TIMESTAMP('2013-09-12 00:33:33','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Sep 12, 2013 12:33:41 AM CEST +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=202514 +; + +-- Sep 12, 2013 12:33:41 AM CEST +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=202516 +; + +-- Sep 12, 2013 12:33:41 AM CEST +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=3203 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=269 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=1988 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y' WHERE AD_Field_ID=114 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y' WHERE AD_Field_ID=115 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y' WHERE AD_Field_ID=116 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y' WHERE AD_Field_ID=268 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y' WHERE AD_Field_ID=10569 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y' WHERE AD_Field_ID=267 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=5379 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=4942 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=4943 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=5124 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=8194 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=10397 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=10396 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y' WHERE AD_Field_ID=202516 +; + +-- Sep 12, 2013 12:33:47 AM CEST +UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y' WHERE AD_Field_ID=3203 +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Element SET Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +@TaxID@ +@DocumentNo@ +@Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.', Description='The result determines the title to be displayed for this window',Updated=TO_TIMESTAMP('2013-09-25 12:42:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202611 +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Column SET ColumnName='TitleLogic', Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +@TaxID@ +@DocumentNo@ +@Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.' WHERE AD_Element_ID=202611 +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Process_Para SET ColumnName='TitleLogic', Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +@TaxID@ +@DocumentNo@ +@Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.', AD_Element_ID=202611 WHERE UPPER(ColumnName)='TITLELOGIC' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Process_Para SET ColumnName='TitleLogic', Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +@TaxID@ +@DocumentNo@ +@Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.' WHERE AD_Element_ID=202611 AND IsCentrallyMaintained='Y' +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_InfoColumn SET ColumnName='TitleLogic', Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +@TaxID@ +@DocumentNo@ +@Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.' WHERE AD_Element_ID=202611 AND IsCentrallyMaintained='Y' +; + +-- Sep 25, 2013 12:42:02 PM COT +UPDATE AD_Field SET Name='Title Logic', Description='The result determines the title to be displayed for this window', Help='The result determines the title to be displayed for this Window, used also as the label for Recent Items. +Format is just one or several context variables surrounded by @, examples: +@TaxID@ +@DocumentNo@ +@Value@ @Name@ +if this field is left empty a default title/label is created using the DocumentNo, Value and Name fields if they exist.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=202611) AND IsCentrallyMaintained='Y' +; + +SELECT register_migration_script('201309120100_IDEMPIERE-1328.sql') FROM dual +; diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutWindowCustomization.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutWindowCustomization.java index 0c999da4ef..73dc4bbc8a 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutWindowCustomization.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutWindowCustomization.java @@ -44,7 +44,7 @@ public class CalloutWindowCustomization extends CalloutEngine I_AD_UserDef_Win ud_win = GridTabWrapper.create(mTab, I_AD_UserDef_Win.class); - MWindow window = new MWindow(Env.getCtx(),AD_Window_ID, null); + MWindow window = MWindow.get(Env.getCtx(),AD_Window_ID); String lang = (String)mTab.getValue("AD_Language"); ud_win.setName(window.get_Translation("Name", lang)); diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Window.java b/org.adempiere.base/src/org/compiere/model/I_AD_Window.java index 9bc7e10dbc..abeec426f2 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Window.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Window.java @@ -245,6 +245,15 @@ public interface I_AD_Window /** Get Process Now */ public boolean isProcessing(); + /** Column name TitleLogic */ + public static final String COLUMNNAME_TitleLogic = "TitleLogic"; + + /** Set Title Logic */ + public void setTitleLogic (String TitleLogic); + + /** Get Title Logic */ + public String getTitleLogic(); + /** Column name Updated */ public static final String COLUMNNAME_Updated = "Updated"; diff --git a/org.adempiere.base/src/org/compiere/model/MRecentItem.java b/org.adempiere.base/src/org/compiere/model/MRecentItem.java index 394d3ec490..0bedd7db83 100644 --- a/org.adempiere.base/src/org/compiere/model/MRecentItem.java +++ b/org.adempiere.base/src/org/compiere/model/MRecentItem.java @@ -29,6 +29,7 @@ import org.compiere.util.CCache; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.Util; import org.idempiere.distributed.IMessageService; import org.idempiere.distributed.ITopic; import org.osgi.service.event.Event; @@ -277,11 +278,11 @@ public class MRecentItem extends X_AD_RecentItem public String getLabel() { String windowName; + MWindow win = MWindow.get(getCtx(), getAD_Window_ID()); MUserDefWin userDef = MUserDefWin.getBestMatch(getCtx(), getAD_Window_ID()); if (userDef != null) { windowName = userDef.getName(); } else { - MWindow win = new MWindow(getCtx(), getAD_Window_ID(), null); windowName = win.get_Translation("Name"); } MTable table = MTable.get(getCtx(), getAD_Table_ID()); @@ -291,20 +292,30 @@ public class MRecentItem extends X_AD_RecentItem this.deleteEx(true, null); return null; } - String recordIdentifier = ""; - if (po.get_ColumnIndex("DocumentNo") > 0) - recordIdentifier = recordIdentifier + "_" + po.get_ValueAsString("DocumentNo"); - if (po.get_ColumnIndex("Value") > 0) - recordIdentifier = recordIdentifier + "_" + po.get_ValueAsString("Value"); - if (po.get_ColumnIndex("Name") > 0) - recordIdentifier = recordIdentifier + "_" + po.get_ValueAsString("Name"); - if (recordIdentifier.length() == 0) - recordIdentifier = "_" + po.toString(); - if (recordIdentifier.length() == 0) - recordIdentifier = "_[" + po.get_ID() + "]"; - if (recordIdentifier.length() == 0) - recordIdentifier = "_[no identifier]"; + String titleLogic = win.getTitleLogic(); + StringBuilder recordIdentifier = new StringBuilder(""); + + if (! Util.isEmpty(titleLogic)) { // default way + titleLogic = Env.parseVariable(titleLogic, po, null, false); + if (! Util.isEmpty(titleLogic)) + recordIdentifier.append(titleLogic); + } + + if (recordIdentifier.length() == 0) { + if (po.get_ColumnIndex("DocumentNo") > 0) + recordIdentifier.append(" ").append(po.get_ValueAsString("DocumentNo")); + if (po.get_ColumnIndex("Value") > 0) + recordIdentifier.append(" ").append(po.get_ValueAsString("Value")); + if (po.get_ColumnIndex("Name") > 0) + recordIdentifier.append(" ").append(po.get_ValueAsString("Name")); + if (recordIdentifier.length() == 0) + recordIdentifier.append(" ").append(po.toString()); + if (recordIdentifier.length() == 0) + recordIdentifier.append(" [").append(po.get_ID()).append("]"); + if (recordIdentifier.length() == 0) + recordIdentifier.append(" [no identifier]"); + } return windowName + ": " + recordIdentifier.substring(1); } diff --git a/org.adempiere.base/src/org/compiere/model/MWindow.java b/org.adempiere.base/src/org/compiere/model/MWindow.java index 9e032c22a8..0d960004d6 100644 --- a/org.adempiere.base/src/org/compiere/model/MWindow.java +++ b/org.adempiere.base/src/org/compiere/model/MWindow.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; +import org.compiere.util.CCache; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.wf.MWFNode; @@ -39,10 +40,34 @@ public class MWindow extends X_AD_Window /** * */ - private static final long serialVersionUID = -7604318488890368565L; + private static final long serialVersionUID = 8966733945232755787L; + /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (MWindow.class); - + + /** Cache */ + private static CCache s_cache = new CCache(Table_Name, 20); + + /** + * Get Window from Cache + * @param ctx context + * @param AD_Window_ID id + * @return MWindow + */ + public static MWindow get (Properties ctx, int AD_Window_ID) + { + Integer key = Integer.valueOf(AD_Window_ID); + MWindow retValue = s_cache.get (key); + if (retValue != null && retValue.getCtx() == ctx) { + return retValue; + } + retValue = new MWindow (ctx, AD_Window_ID, null); + if (retValue.get_ID () != 0) { + s_cache.put (key, retValue); + } + return retValue; + } // get + /** * Standard Constructor * @param ctx context diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Window.java b/org.adempiere.base/src/org/compiere/model/X_AD_Window.java index 01f8d2c277..e7f97d5775 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Window.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Window.java @@ -30,7 +30,7 @@ public class X_AD_Window extends PO implements I_AD_Window, I_Persistent /** * */ - private static final long serialVersionUID = 20130626L; + private static final long serialVersionUID = 20130925L; /** Standard Constructor */ public X_AD_Window (Properties ctx, int AD_Window_ID, String trxName) @@ -344,6 +344,20 @@ public class X_AD_Window extends PO implements I_AD_Window, I_Persistent return false; } + /** Set Title Logic. + @param TitleLogic Title Logic */ + public void setTitleLogic (String TitleLogic) + { + set_Value (COLUMNNAME_TitleLogic, TitleLogic); + } + + /** Get Title Logic. + @return Title Logic */ + public String getTitleLogic () + { + return (String)get_Value(COLUMNNAME_TitleLogic); + } + /** WindowType AD_Reference_ID=108 */ public static final int WINDOWTYPE_AD_Reference_ID=108; /** Single Record = S */ diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index d11bd64a0d..fb60a29fb4 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -1473,46 +1473,47 @@ public final class Env outStr.append("@"+token+"@"); } else if (po != null) { //take from po - Object v = po.get_Value(token); - MColumn colToken = MColumn.get(ctx, po.get_TableName(), token); - String foreignTable = colToken.getReferenceTableName(); - if (v != null) { - if (format != null && format.length() > 0) { - if (v instanceof Integer && (Integer) v > 0 && token.endsWith("_ID")) { - int tblIndex = format.indexOf("."); - String tableName = null; - if (tblIndex > 0) - tableName = format.substring(0, tblIndex); - else - tableName = foreignTable; - MTable table = MTable.get(ctx, tableName); - if (table != null && tableName.equalsIgnoreCase(foreignTable)) { - String columnName = tblIndex > 0 ? format.substring(tblIndex + 1) : format; - MColumn column = table.getColumn(columnName); - if (column != null) { - if (column.isSecure()) { - outStr.append("********"); - } else { - outStr.append(DB.getSQLValueString(trxName, - "SELECT " + columnName + " FROM " + tableName + " WHERE " + tableName + "_ID = ?", (Integer)v)); + if (po.get_ColumnIndex(token) >= 0) { + Object v = po.get_Value(token); + MColumn colToken = MColumn.get(ctx, po.get_TableName(), token); + String foreignTable = colToken.getReferenceTableName(); + if (v != null) { + if (format != null && format.length() > 0) { + if (v instanceof Integer && (Integer) v > 0 && token.endsWith("_ID")) { + int tblIndex = format.indexOf("."); + String tableName = null; + if (tblIndex > 0) + tableName = format.substring(0, tblIndex); + else + tableName = foreignTable; + MTable table = MTable.get(ctx, tableName); + if (table != null && tableName.equalsIgnoreCase(foreignTable)) { + String columnName = tblIndex > 0 ? format.substring(tblIndex + 1) : format; + MColumn column = table.getColumn(columnName); + if (column != null) { + if (column.isSecure()) { + outStr.append("********"); + } else { + outStr.append(DB.getSQLValueString(trxName, + "SELECT " + columnName + " FROM " + tableName + " WHERE " + tableName + "_ID = ?", (Integer)v)); + } } } + } else if (v instanceof Date) { + SimpleDateFormat df = new SimpleDateFormat(format); + outStr.append(df.format((Date)v)); + } else if (v instanceof Number) { + DecimalFormat df = new DecimalFormat(format); + outStr.append(df.format(((Number)v).doubleValue())); + } else { + MessageFormat mf = new MessageFormat(format); + outStr.append(mf.format(v)); } - } else if (v instanceof Date) { - SimpleDateFormat df = new SimpleDateFormat(format); - outStr.append(df.format((Date)v)); - } else if (v instanceof Number) { - DecimalFormat df = new DecimalFormat(format); - outStr.append(df.format(((Number)v).doubleValue())); } else { - MessageFormat mf = new MessageFormat(format); - outStr.append(mf.format(v)); + outStr.append(v.toString()); } - } else { - outStr.append(v.toString()); } - } - else if (keepUnparseable) { + } else if (keepUnparseable) { outStr.append("@"+token+"@"); } } diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java index 89ced5b94f..a7c12021ca 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java @@ -2630,7 +2630,7 @@ public final class APanel extends CPanel size = new Dimension (0,0); } // - MWindow win = new MWindow(m_ctx, m_curTab.getAD_Window_ID(), null); + MWindow win = MWindow.get(m_ctx, m_curTab.getAD_Window_ID()); win.setWindowSize(size); win.saveEx(); } // cmdWinSize diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index ce81248b86..6b046b6953 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -83,6 +83,7 @@ import org.compiere.model.MProcess; import org.compiere.model.MQuery; import org.compiere.model.MRecentItem; import org.compiere.model.MRole; +import org.compiere.model.MWindow; import org.compiere.model.X_AD_CtxHelp; import org.compiere.process.DocAction; import org.compiere.process.ProcessInfo; @@ -302,7 +303,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements boolean autoNew = Env.isAutoNew(ctx); Env.setAutoNew(ctx, curWindowNo, autoNew); - + // WindowName variable preserved for backward compatibility + // please consider it as DEPRECATED and use _WinInfo_WindowName instead + Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName()); // deprecated + Env.setContext(ctx, curWindowNo, "_WinInfo_WindowName", gridWindow.getName()); + Env.setContext(ctx, curWindowNo, "_WinInfo_AD_Window_ID", gridWindow.getAD_Window_ID()); + Env.setContext(ctx, curWindowNo, "_WinInfo_AD_Window_UU", gridWindow.getAD_Window_UU()); // Set SO/AutoNew for Window Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx()); @@ -338,12 +344,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements if (tab == 0 && gridTab == null && m_findCancelled) return false; } - // WindowName variable preserved for backward compatibility - // please consider it as DEPRECATED and use _WinInfo_WindowName instead - Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName()); // deprecated - Env.setContext(ctx, curWindowNo, "_WinInfo_WindowName", gridWindow.getName()); - Env.setContext(ctx, curWindowNo, "_WinInfo_AD_Window_ID", gridWindow.getAD_Window_ID()); - Env.setContext(ctx, curWindowNo, "_WinInfo_AD_Window_UU", gridWindow.getAD_Window_UU()); if (gridTab != null) gridTab.getTableModel().setChanged(false); @@ -1258,7 +1258,34 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive()) dbInfo = "[ " + dbInfo + " ]"; breadCrumb.setStatusDB(dbInfo, e); - } else if (adTabbox.getSelectedDetailADTabpanel() == null) + + String prefix = null; + if (dbInfo.contains("*")) + prefix = "*"; + + String titleLogic = null; + int windowID = getADTab().getSelectedGridTab().getAD_Window_ID(); + if (windowID > 0) { + titleLogic = MWindow.get(Env.getCtx(), windowID).getTitleLogic(); + } + String header = null; + if (! Util.isEmpty(titleLogic)) { + StringBuilder sb = new StringBuilder(); + if (prefix != null) + sb.append(prefix); + sb.append(Env.getContext(ctx, curWindowNo, "_WinInfo_WindowName", false)).append(": "); + titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true); + sb.append(titleLogic); + header = sb.toString().trim(); + if (header.endsWith(":")) + header = header.substring(0, header.length()-1); + } + if (Util.isEmpty(header)) + header = AEnv.getDialogHeader(Env.getCtx(), curWindowNo, prefix); + + SessionManager.getAppDesktop().setTabTitle(header); + } + else if (adTabbox.getSelectedDetailADTabpanel() == null) { return; } @@ -1689,6 +1716,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements if (adTabbox.getSelectedGridTab() == null) return; + clearTitleRelatedContext(); + onSave(false, false, new Callback() { @Override @@ -1769,6 +1798,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements } else { + clearTitleRelatedContext(); + adTabbox.dataIgnore(); toolbar.enableIgnore(false); if (newrecod) { @@ -2794,4 +2825,42 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements return boolChanges; } + private void clearTitleRelatedContext() { + // IDEMPIERE-1328 + // clear the values for the tab header + String titleLogic = null; + int windowID = getADTab().getSelectedGridTab().getAD_Window_ID(); + if (windowID > 0) { + titleLogic = MWindow.get(Env.getCtx(), windowID).getTitleLogic(); + } + if (titleLogic != null) { + String token; + String inStr = new String(titleLogic); + + int i = inStr.indexOf('@'); + while (i != -1) + { + inStr = inStr.substring(i+1, inStr.length()); // from first @ + + int j = inStr.indexOf('@'); // next @ + if (j < 0) + { + logger.log(Level.SEVERE, "No second tag: " + inStr); + return; // no second tag + } + + token = inStr.substring(0, j); + Env.setContext(ctx, curWindowNo, token, ""); + + inStr = inStr.substring(j+1, inStr.length()); // from second @ + i = inStr.indexOf('@'); + } + } else { + Env.setContext(ctx, curWindowNo, "DocumentNo", ""); + Env.setContext(ctx, curWindowNo, "Value", ""); + Env.setContext(ctx, curWindowNo, "Name", ""); + } + + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 1582fc0d6d..8426495d63 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -668,12 +668,15 @@ public final class AEnv * Get title for dialog window * @param ctx * @param windowNo + * @param prefix * @return dialog header */ - public static String getDialogHeader(Properties ctx, int windowNo) { + public static String getDialogHeader(Properties ctx, int windowNo, String prefix) { StringBuilder sb = new StringBuilder(); + if (prefix != null) + sb.append(prefix); if (windowNo > 0){ - sb.append(Env.getContext(ctx, windowNo, "_WinInfo_WindowName", false)).append(" "); + sb.append(Env.getContext(ctx, windowNo, "_WinInfo_WindowName", false)).append(": "); final String documentNo = Env.getContext(ctx, windowNo, "DocumentNo", false); final String value = Env.getContext(ctx, windowNo, "Value", false); final String name = Env.getContext(ctx, windowNo, "Name", false); @@ -690,8 +693,14 @@ public final class AEnv String header = sb.toString().trim(); if (header.length() == 0) header = ThemeManager.getBrowserTitle(); + if (header.endsWith(":")) + header = header.substring(0, header.length()-1); return header; } + + public static String getDialogHeader(Properties ctx, int windowNo) { + return getDialogHeader(ctx, windowNo, null); + } /** * Execute synchronous task in UI thread. diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java index 7e46b55a56..16b0516755 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java @@ -206,6 +206,8 @@ public interface IDesktop extends UIPart { public void updateHelpTooltip(GridField gridField); public boolean isPendingWindow(); + + public void setTabTitle(String title); public void renderHomeTab(); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java index 4a9c46cb29..e81a6757a8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java @@ -408,4 +408,9 @@ public abstract class TabbedDesktop extends AbstractDesktop { } } } + + public void setTabTitle(String title) { + windowContainer.setTabTitle(title); + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java index 46995dfa64..e9d0ef2d0b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java @@ -202,6 +202,10 @@ public class WindowContainer extends AbstractUIPart return tab; } + public void setTabTitle(String title) { + setTabTitle(title, getSelectedTab()); + } + public void setTabTitle(String title, org.zkoss.zul.Tab tab) { title = title.replaceAll("[&]", ""); if (title.length() <= MAX_TITLE_LENGTH)