Dynamic title for window in ADempiere

Problem Statement:

In ADempiere, each window will be opened as new tab . We can open as many number of windows. Each window will have parent tab and one of more child tabs. Current functionality of ADempiere, If Parent tab key is displayed in Child tab then only we can come to know under which parent we are adding or deleting child, Other wise we have to open Parent tab and see what is the parent. To avoid this problem If we display Parent tab selected record name on window title, It will be very easy to User all the time to know under which Parent he/she is adding or deleting child.  ADempiere has flexibility to achieve functionality by making code changes.

Scope of Article:

As a part of this Article, we will be covering changing of window title dynamically in ADempiere based on current record name ( appending name to window title ).

Technology :

ADempiere 342 or above

Current Behavior

  • Verify the title of Business Partner window.Configured window title is not changed based on current record value.1
  • Open Contact (User) tab in Business Partner window.And verify the title of Window, it is not changed.2

Changes Detail

To append current record name in Window title we need to make code changes in following java files.

  • org.adempiere.webui.panel.AbstractADWindowPanel.java
  • org.adempiere.webui.desktop.DefaultDesktop.java

Make following changes in  org.adempiere.webui.panel.AbstractADWindowPanel.java file.

  • Add following import statements.
import org.adempiere.webui.desktop.DefaultDesktop;
import org.adempiere.webui.component.Tab;
  • Add following new method in AbstractADWindowPanel.java.

In this method, We can add condition to check whether current window is valid to change it’s title or not, If yes then window title can be modified with current record name else title can’t be modified. In this article, I have taken Business Partner window as a example and It has space in it’s title, That is why I have appended temp[1] to title to retain  original title of window. If you want to add same logic ( changing window title )  for some other windows then extend switch cases based on window id and based on window title spaces add properly logic to retain original title.

public Boolean requiresTitleUpdate(int WindowId) {
boolean status = false;
Object titlenow = null;
String[] temp = null;
String firstOne = null;
IADTabpanel adTabPanel = adTab.getSelectedTabpanel();
if(adTab.getSelectedIndex() == 0) {
 titlenow = adTabPanel.getGridTab().getValue("name"); 
if( null != titlenow ) {
temp = this.title.split(" ");
firstOne = temp[0];
switch(WindowId) {
case 123 :{ firstOne = firstOne +" "+ temp[1]; // 123 is a Business Partner window Id
this.title = firstOne + (null != titlenow ? " ["+ titlenow +"]":"");
status = true;
return status;
  • Add following code in private void focusToActivePanel() method to update window title based on Tab switching.
//  modify window title
Boolean titleUpdate = requiresTitleUpdate(curTab.getAD_Window_ID());
if ( titleUpdate ) {
DefaultDesktop dd =((DefaultDesktop)SessionManager.getAppDesktop());
Tab tab = dd.getContainer().getSelectedTab();
  • Add following code in public void dataStatusChanged(DataStatusEvent e) method to update window title based on value change of record.
try {
Boolean titleUpdate = requiresTitleUpdate(curTab.getAD_Window_ID());
if ( titleUpdate ) {
    if( null != Executions.getCurrent() && null != SessionManager.getAppDesktop() ) {
        DefaultDesktop dd = ((DefaultDesktop)SessionManager.getAppDesktop()) ;
        Tab tab = dd.getContainer().getSelectedTab();
} catch (Exception e1) {
  logger.severe(" Default Desktop was not found "+e1.getMessage());
  • Add following statement in public String getTitle() method to update window title on initial creation of window.

Make following code changes in org.adempiere.webui.desktop.DefaultDesktop.java file.

  • Add below import statement.
import org.adempiere.webui.part.WindowContainer;
  • Add following method in DefaultDesktop.java to get the window container.
public WindowContainer getContainer() {
return windowContainer;

After applying above changes, clean and restart application and verify the Business Partner window title. Whether it is changing as expected or not.

  • Open Business Partner window and verify title, It has been changed with name of current record. Window title size has been set to fixed number in WindowContainer.java file, that is why is appended to title by truncating extract letters. If we want, we can increase the title width.3
  • Open Contact ( User ) tab and verify the window title. Window title has been changed by appending parent record name.4
  • Go to Parent tab ( Business Partner ), In this case title width constraint related logic can’t be executed, That is why we can see total title without truncating any letters.5Business Partner window title has been changed based on selected record name.


As a part of this article we have learned changing of window title based selected record’s name ( that could be any field, In this article I have taken name ) by making code changes in ADempiere. Hope you have enjoyed reading this article.

Walking Tree promotes ADempiere and we support the users as well as the developers to ensure that the business is able to take complete advantage of ADempiere’s wonderful capability. In case you are looking for a professional assistance then do visit our website to get in touch with us.

References :

Tagged with: ,
Posted in ADempiere, EagleRP
One comment on “Dynamic title for window in ADempiere
  1. Good implementation,
    if we extend the functionality then its really great.
    like, Dynamic Title should be configured value at tab level and also we should have a provision to select the field Name ( Which field we are going to show at title).
    I think this is easy to development also ( Not only for business partner window, no switch cases and splitting string is not required )


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

We Have Moved Our Blog!

We have moved our blog to our company site. Check out https://walkingtree.tech/index.php/blog for all latest blogs.

Sencha Select Partner Sencha Training Partner
Xamarin Authorized Partner
Recent Publication
%d bloggers like this: