IDEMPIERE-1328 Change tab name dynamically

This commit is contained in:
Carlos Ruiz 2013-09-25 12:48:53 -05:00
parent 7e974b0535
commit 7ae2284700
14 changed files with 521 additions and 63 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -44,7 +44,7 @@ public class CalloutWindowCustomization extends CalloutEngine
I_AD_UserDef_Win ud_win = GridTabWrapper.create(mTab, I_AD_UserDef_Win.class); 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"); String lang = (String)mTab.getValue("AD_Language");
ud_win.setName(window.get_Translation("Name", lang)); ud_win.setName(window.get_Translation("Name", lang));

View File

@ -245,6 +245,15 @@ public interface I_AD_Window
/** Get Process Now */ /** Get Process Now */
public boolean isProcessing(); 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 */ /** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated"; public static final String COLUMNNAME_Updated = "Updated";

View File

@ -29,6 +29,7 @@ import org.compiere.util.CCache;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Util;
import org.idempiere.distributed.IMessageService; import org.idempiere.distributed.IMessageService;
import org.idempiere.distributed.ITopic; import org.idempiere.distributed.ITopic;
import org.osgi.service.event.Event; import org.osgi.service.event.Event;
@ -277,11 +278,11 @@ public class MRecentItem extends X_AD_RecentItem
public String getLabel() { public String getLabel() {
String windowName; String windowName;
MWindow win = MWindow.get(getCtx(), getAD_Window_ID());
MUserDefWin userDef = MUserDefWin.getBestMatch(getCtx(), getAD_Window_ID()); MUserDefWin userDef = MUserDefWin.getBestMatch(getCtx(), getAD_Window_ID());
if (userDef != null) { if (userDef != null) {
windowName = userDef.getName(); windowName = userDef.getName();
} else { } else {
MWindow win = new MWindow(getCtx(), getAD_Window_ID(), null);
windowName = win.get_Translation("Name"); windowName = win.get_Translation("Name");
} }
MTable table = MTable.get(getCtx(), getAD_Table_ID()); MTable table = MTable.get(getCtx(), getAD_Table_ID());
@ -291,20 +292,30 @@ public class MRecentItem extends X_AD_RecentItem
this.deleteEx(true, null); this.deleteEx(true, null);
return 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); return windowName + ": " + recordIdentifier.substring(1);
} }

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.util.CCache;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.wf.MWFNode; 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 */ /** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MWindow.class); private static CLogger s_log = CLogger.getCLogger (MWindow.class);
/** Cache */
private static CCache<Integer,MWindow> s_cache = new CCache<Integer,MWindow>(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 * Standard Constructor
* @param ctx context * @param ctx context

View File

@ -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 */ /** Standard Constructor */
public X_AD_Window (Properties ctx, int AD_Window_ID, String trxName) 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; 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 */ /** WindowType AD_Reference_ID=108 */
public static final int WINDOWTYPE_AD_Reference_ID=108; public static final int WINDOWTYPE_AD_Reference_ID=108;
/** Single Record = S */ /** Single Record = S */

View File

@ -1473,6 +1473,7 @@ public final class Env
outStr.append("@"+token+"@"); outStr.append("@"+token+"@");
} else if (po != null) { } else if (po != null) {
//take from po //take from po
if (po.get_ColumnIndex(token) >= 0) {
Object v = po.get_Value(token); Object v = po.get_Value(token);
MColumn colToken = MColumn.get(ctx, po.get_TableName(), token); MColumn colToken = MColumn.get(ctx, po.get_TableName(), token);
String foreignTable = colToken.getReferenceTableName(); String foreignTable = colToken.getReferenceTableName();
@ -1512,7 +1513,7 @@ public final class Env
outStr.append(v.toString()); outStr.append(v.toString());
} }
} }
else if (keepUnparseable) { } else if (keepUnparseable) {
outStr.append("@"+token+"@"); outStr.append("@"+token+"@");
} }
} }

View File

@ -2630,7 +2630,7 @@ public final class APanel extends CPanel
size = new Dimension (0,0); 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.setWindowSize(size);
win.saveEx(); win.saveEx();
} // cmdWinSize } // cmdWinSize

View File

@ -83,6 +83,7 @@ import org.compiere.model.MProcess;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRecentItem; import org.compiere.model.MRecentItem;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MWindow;
import org.compiere.model.X_AD_CtxHelp; import org.compiere.model.X_AD_CtxHelp;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
@ -302,7 +303,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
boolean autoNew = Env.isAutoNew(ctx); boolean autoNew = Env.isAutoNew(ctx);
Env.setAutoNew(ctx, curWindowNo, autoNew); 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 // Set SO/AutoNew for Window
Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx()); 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) if (tab == 0 && gridTab == null && m_findCancelled)
return false; 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) if (gridTab != null)
gridTab.getTableModel().setChanged(false); gridTab.getTableModel().setChanged(false);
@ -1258,7 +1258,34 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive()) if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
dbInfo = "[ " + dbInfo + " ]"; dbInfo = "[ " + dbInfo + " ]";
breadCrumb.setStatusDB(dbInfo, e); 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; return;
} }
@ -1689,6 +1716,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (adTabbox.getSelectedGridTab() == null) if (adTabbox.getSelectedGridTab() == null)
return; return;
clearTitleRelatedContext();
onSave(false, false, new Callback<Boolean>() { onSave(false, false, new Callback<Boolean>() {
@Override @Override
@ -1769,6 +1798,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
else else
{ {
clearTitleRelatedContext();
adTabbox.dataIgnore(); adTabbox.dataIgnore();
toolbar.enableIgnore(false); toolbar.enableIgnore(false);
if (newrecod) { if (newrecod) {
@ -2794,4 +2825,42 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
return boolChanges; 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", "");
}
}
} }

View File

@ -668,12 +668,15 @@ public final class AEnv
* Get title for dialog window * Get title for dialog window
* @param ctx * @param ctx
* @param windowNo * @param windowNo
* @param prefix
* @return dialog header * @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(); StringBuilder sb = new StringBuilder();
if (prefix != null)
sb.append(prefix);
if (windowNo > 0){ 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 documentNo = Env.getContext(ctx, windowNo, "DocumentNo", false);
final String value = Env.getContext(ctx, windowNo, "Value", false); final String value = Env.getContext(ctx, windowNo, "Value", false);
final String name = Env.getContext(ctx, windowNo, "Name", false); final String name = Env.getContext(ctx, windowNo, "Name", false);
@ -690,9 +693,15 @@ public final class AEnv
String header = sb.toString().trim(); String header = sb.toString().trim();
if (header.length() == 0) if (header.length() == 0)
header = ThemeManager.getBrowserTitle(); header = ThemeManager.getBrowserTitle();
if (header.endsWith(":"))
header = header.substring(0, header.length()-1);
return header; return header;
} }
public static String getDialogHeader(Properties ctx, int windowNo) {
return getDialogHeader(ctx, windowNo, null);
}
/** /**
* Execute synchronous task in UI thread. * Execute synchronous task in UI thread.
* @param runnable * @param runnable

View File

@ -207,5 +207,7 @@ public interface IDesktop extends UIPart {
public boolean isPendingWindow(); public boolean isPendingWindow();
public void setTabTitle(String title);
public void renderHomeTab(); public void renderHomeTab();
} }

View File

@ -408,4 +408,9 @@ public abstract class TabbedDesktop extends AbstractDesktop {
} }
} }
} }
public void setTabTitle(String title) {
windowContainer.setTabTitle(title);
}
} }

View File

@ -202,6 +202,10 @@ public class WindowContainer extends AbstractUIPart
return tab; return tab;
} }
public void setTabTitle(String title) {
setTabTitle(title, getSelectedTab());
}
public void setTabTitle(String title, org.zkoss.zul.Tab tab) { public void setTabTitle(String title, org.zkoss.zul.Tab tab) {
title = title.replaceAll("[&]", ""); title = title.replaceAll("[&]", "");
if (title.length() <= MAX_TITLE_LENGTH) if (title.length() <= MAX_TITLE_LENGTH)