Upload
carlcols
View
230
Download
2
Embed Size (px)
Citation preview
POWER WINDOW THE NEW IDEMPIERE INFO-WINDOW
by
REDHUAN D. OON
Doc Version 0.1
With Super Sub-Info Tabs
from Anthony Soosah (Xolali), GHANA
My effort sponsored by SYSNOVA of BANGLADESH
www.sysnova.com
MORE MAGIC FROM THE BEST ERP SOFTWARE IN THE WORLD
Get One View of Your Data Islands: What You Want To
See, How You Want To See It, What You Want It To Do, and
What Else Is Related To It
The 3 Laws of red1:Information is Free
YOU HAVE TO KNOW
People are NotYOU HAVE TO PAY
Contributors are PricelessYOU HAVE TO BE
BANGLADESHp r e s e n t e d b y
TABLE OF CONTENTS
Preamble 5
Some Politics 5
Part of iDempiere 8
Movie Tutorials 8
Operations 9
WMS Example 9
Setting the Table Query 10
Columns Setting 11
Using Info-Window 12
Introducing Sub-Infos 14
Setting Up Sub-Infos 14
Using Sub-Infos 15
Developer Work 17
Coding the Process 17
PREAMBLE
Some Politics
An Info-Window is a display panel that contains Search criteria to select a set of data across dif-
ferent tables, resolved in an SQL JOIN statement. It differs from the traditional Compiere type of
Window-Tabs where each Tab displays a particular table. Even though Compiere has a View ta-
ble that is based on an SQL JOIN statement too, you still need to go to the Advanced Search tab
to specify your Search criteria. An Info-Window is more usable in a single-window or same-page
display. It is also meant to be hard-coded in its panel design thus giving a more customised and
dynamic look. Take a look at this traditional Order Info display below, that has existed since
Compiere days to get the idea.
After the selling off of Compiere to a closed-minded business group, the community needed to
continue the freedom to change the source as a temporal project which I headed for a while called
ADempiere. Then with the latest OSGi framework adoption, it is now known as iDempiere un-
der the more able stewardship of Carlos Ruiz and Low Heng Sin. During ADempiere days, e-
Evolution of Mexico introduced the Smart-Browser which is an abstraction of the Inf0-Window
with the addition of a process button. Over here in iDempiere, Heng Sin, not to be outdone, in-
troduced a more efficient Inf0-Window but without the process feature. Still, Heng Sin’s ap-
proach is versatile in that he does not completely deprecate the Compiere regime. Later on this.
So finally I introduced the process function to make it on par with Smart-Browser and quite the
same time noticed another innovation from Ghana, by Anthony Soosah (Xolali) that added sub
info-windows to the same Info-Window. Worried about breaking his work or vice versa, I took in
his code and changes and resynched and test to ensure all can work well in one base.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page5 of 17
With sparks of technical guru-ship from Low Heng Sin and the ever-fast final review and release
effort of Carlos Ruiz, both IDEMPIERE-1711 and IDEMPIERE-1045, as these add-ons are
tracked in our JIRA (http://jira.idempiere.com) as, we can finally enjoy a highly versatile Inf0-
Window as a work of the best a community can give.
This Info-Window has a unified single store of handling the Info-Window initial SQL JOIN, un-
like Smart-Browser that must access another separate View table. The single-store approach al-
lows the user to manage the SQL WHERE clause on the same page, during fast assembling or
maintaining of any Info-Window.
With the Process field been set, the singular radio-buttons of the Info-Window will turn to
check-boxes for multiple selection before the Process button is pressed to process the selected
records. If a single record in selected, in both modes, the Zoom look-up still works.
With Xolali’s sub infos, the Info-Window can become a building block of Info captures that re-
late to each other by any of its common key index. For example the sample below which I setup as
a sample setup in the Garden World sample of iDempiere is a Business Partner Info-Window
that relates the Sales Order sub info-window and the Invoice sub info-window via the BPartner
value.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page6 of 17
As you can see from above, this Info-Window is only available in ZK HTML user interface and
not the Swing interface. This is because the two main maintainers of iDempiere regard Swing as
an old technology that has hardly evolved the last decade and the ZK Ajax is still a very open and
fast evolving technology.
I mentioned earlier how Heng Sin did not completely deprecate the old way of Info-Window but
set it more free and versatile. This is because you can still extend the base Info-Window class.
The Info-Order you see above is actually such a case. This is a clever use of Java polymorphism to
make this so. This allow different implementations to reuse back the same base of Info-Panel
class. This is something an accomplished Java guru can achieve which I find absent in innards of
the present ADempiere’s Smart-Browser code.
The elegant design of the DefaultInfoFactory to InfoWindow to InfoPanel resulted in so few final
changes to bring about the Process feature that I worked on. When Carlos Ruiz finally reviewed
this for inclusion last week, after congratulating me, remarked how such few lines of code change
brought such a huge impact to the Info-Window. I in turn told him that we have to thank Heng
Sin who reduced my bad coding of changing 4 Java classes and more lines to only 3 classes and
less lines.
Written in Bangkok, in the midst of another spate of protest and snap elections that dots Thailand’s colourful politics.
February 3, 2014
Feb 1, I visited Siam Mall, one of the 7
sites across Bangkok, locked down by the Yellow-Shirt led sit-in protests, crippling what they called a fraudulent govern-
ment. The democrati-cally elected govt’s
only response was to call for a snap elec-
tions (Feb 2) of which the opposition has
frustrated, demand-ing electoral reform be set in place prior.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page7 of 17
Part of iDempiere
Unlike my previous work, this one found itself into the core and is now an integral part of
iDempiere officially. It is set for the upcoming Version 3.0:
http://wiki.idempiere.org/en/NF3.0_Process_on_Info_Window
The JIRA tracker associated with this is:
http://idempiere.atlassian.net/browse/IDEMPIERE-1711
Movie Tutorials
I have made two movies to demonstrate the use of Info-Windows and also the Sub-Infos:
http://www.youtube.com/watch?v=MHj7Nl2ZXp8
http://www.youtube.com/watch?v=6lp3n8jKBPw
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page8 of 17
OPERATIONS
WMS Example
I will be referring to the same sample I written in a previous documentation, WMS.pdf that de-
scribes the Libero Warehouse Management System (WMS) as a plugin. Ensuite, this plugin now
runs off this new Power-Window feature. Let’s go to that Info-Window definition again.
(Please see also: http://sourceforge.net/projects/red1/files/p2/WMS/WMS.pdf/download)
Notice that this time we have an extra field, Process. It can be assigned to any Process defined in
the Report & Process window. By selecting the OutBound process, we are all done to go and try
it out. But wait a minute, you may ask. How did you setup the Info-Window in the first place?
As nightfall will see a massive build-up prior to Elections day and possible violence, my friends advised that we should leave. I turned back to snap a shot here. You can see people coming in by foot as roads are not accessible due to traffic blockages. Most who came are middle class contributors to the GDP but robbed of controlling the corruptive schemings the ruling elite has hold sway for successive rounds of winning the elections by patronising the ru-ral electorate with hand-outs.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page9 of 17
Setting the Table Query
We have good use of Info-Window in the WMS and we can now look at how that is really done.
(I am referring to older screenshots that has no Process selection. Otherwise they are the same.)
In the image below you can see the Table value as C_Order. This is important because it will be
the reference stored in T_Selection for the Process class to access.
The SQL FROM statement is defined here. It will access the main table and pull look-up infor-
mation from the JOIN tables. (Please refer to the Web for more information on how to make a
good JOIN statement. In principle it can give you whatever set of information you want from the
huge ERP database. It is so powerful that I do not understand why some people rebelled against
SQL as been outmoded or outdated. Perhaps they are referring more to the FORM way in a mod-
ern Facebook age of instant learning curve. Yes, it can be complex, but mastering it is very fulfill-
ing in the end as you can be very exact in your DB design and analysis.)
As you can see above, the Sql FROM box filled with the SQL string that comes after the FROM.
Note that you can set the JOIN values as if you are writing the SQL exactly from the point FROM.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page10 of 17
Here the Sql FROM is pasted in text:
C_Order oINNER JOIN C_OrderLine ol ON (ol.C_Order_ID=o.C_Order_ID)INNER JOIN C_BPartner bp ON (bp.C_BPartner_ID=o.C_BPartner_ID)INNER JOIN C_BPartner_Location bpl ON (bpl.C_BPartner_Location_ID=o.C_BPartner_Location_ID)INNER JOIN C_Location l ON (l.C_Location_ID=bpl.C_Location_ID)INNER JOIN M_Product p ON (p.M_Product_ID=ol.M_Product_ID)INNER JOIN M_Product_Category pc ON (pc.M_Product_Category_ID=p.M_Product_Category_ID)
In the Sql WHERE box is:
IsSOTrx='Y' AND DocStatus='CO' AND NOT EXISTS (SELECT 1 FROM WM_InOutBoundLine WHERE WM_InOutBoundLine.C_OrderLine_ID = ol.C_OrderLine_ID)
Columns Setting
Next is the Column Tab which is important, as they will specify which column is to appear in the
results panel. Note also which item act as Query Criteria that appears in the upper panel of the
Info-Window.
Comparing this with the SmartBrowser over at ADempiere, I regard this Info-Window done by
Low Heng Sin as more usable as there is no need for an extra layer of View table to refer to as it is
done right in the Sql FROM with the described JOIN statements.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page11 of 17
Using Info-Window
Having set all the above, we can go to the WMS Menu, and select the Info-Window, Order-
sToPicking.
Note that now the Process iconic button is now visible. However it is not enabled until you select
any number of records in the result panel. Pressing the ReQuery button, a result-set of records
shall appear. If they do not, then you have to check your Sql FROM and Sql WHERE values, as
well as the Column tab. If there are no items in Column tab, then it will definitely show nothing
in the target Info-Window.
Life goes on as Thais are used to the yo-yo political swings of the warring two factions (Yellow vs Red Shirts). Been a strong Buddhist nation, and never colonised, the Thais are hardly English speak-ing. However in the reign of King Chulalongkorn or Rama V (1853–1910), English was intoduced to the nation but nationalistic spirit swept that advan-tage away soon after his passing.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page12 of 17
Now we go and click on the Process button.
The result is the usual Process dialog panel pop-up. Upon clicking OK or submit, we see a re-
sponse dialog box and the chosen records then disappeared from the result-set panel.
(This grand closing with a message box was done by Heng Sin in one of our lunch cafe meetings)
(Later in Developer Section, we will see how the process class handling is done from that side.)
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page13 of 17
Introducing Sub-Infos
It so happened, that while I was submitting this, Xolali in the chatroom prompted me to take a
look at his slightly earlier contribution that has yet to receive any peer reviewer, and so i down-
loaded it, tried it out and adjusted it to work within the same code base i was working on. It
turned out beautifully and I submitted a fresh patch off my changes for Carlos Ruiz to quickly
accept it, that these two are now in source and passed the nightly build. Here we shall go back to
the Info-Window screens, but now imbued with this yet another wonderful new feature.
Setting Up Sub-Infos
In the Info-Window, select the Business Partner Info record, then go to the Related Info Window
tab. Create a new related info with the Order Info and its related column as Business Partner.
Create another new one this time for relating the Invoice Info and with the same related column.
Here, both new records are shown in grid format .
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page14 of 17
Using Sub-Infos
Now we can go to the ZK UI to view the resulting changes done to the Business Partner Info win-
dow. (Info-Window as in many new features done by the main contributor, Heng Sin happens in
the ZK UI client and not the other using Swing technology which is not FOSS, having no im-
provement the last decade. ZK Ajax at the same time is at Version 7, which Heng Sin is migrating
our client to.)
Note that the Zoom button is in use above and about to launch another tab displaying the full
Business Partner window. I have tested manually that this does not break backward compatibility.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page15 of 17
I have also tested this with a combi. The Info Window framework is robust that even when I
added a Related Info Window to the Process type of main Info Window it still maintain data op-
erational integrity as shown below.
Note also the right arrow down crumb control to slide off the lower sub panel.
I was training GrandLinux Solution Ltd Thailand on how to migrate from ADempiere to iDempiere. GSLT is founded by Sureeraya Limpaibul, seated nearest, in 2002 as a Compiere implemen-tation company. She is the first contributor on Thai localisation such as character display, lan-guage files and account-ing schema. Here in this 4
day class series, we even managed to prove her Budgetary system as a trial case to convert into a plugin. I am thinking of spending time after this to fully convert over and document it.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page16 of 17
DEVELOPER WORK
Coding the Process
Because the InfoPanel class will embed your selected data with:
// store in T_Selection table selected rows for Execute Process that retrieves from T_Selection in code. DB.createT_Selection(instance.getAD_PInstance_ID(), getSelectedKeysCollection(),
The Process class for the Power Window is slightly different. Note the sample snippet below of
the SQL query at the doIt() method in the InOutBound example.
All you need is to access the T_Selection table again and ensure it is the same Process Instance
(AD_PInstance_ID), checked via getAD_PInstance_ID() from the SvrProcess. In the same T_Selec-
tion table is also the corresponding ID of the main record in this case its C_Order_ID.
The return statement in the form of return "@DocumentNo@ " + outbound.getDocumentNo();
will return whatever string content you passed into it for display as the final pop-up dialog box. In
this case it is the text Document No and the Outbound record new Document No as shown at the
end of page 13.
Power Window The New iDempiere Info-Window
Copyleft 2014 - Redhuan D. Oon, SYSNOVA Page17 of 17