IDEMPIERE-1334:Run one or more processes from Info Window

fix comment of carlos
This commit is contained in:
hieplq 2014-05-29 16:35:05 -05:00
parent 3d53cf43db
commit c656bd52ad
8 changed files with 165 additions and 110 deletions

View File

@ -0,0 +1,68 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- May 29, 2014 6:19:41 AM ICT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_Field_Trl WHERE AD_Field_ID=203032
;
-- May 29, 2014 6:19:41 AM ICT
DELETE FROM AD_Field WHERE AD_Field_ID=203032
;
-- May 29, 2014 6:19:52 AM ICT
DELETE FROM AD_Field_Trl WHERE AD_Field_ID=203033
;
-- May 29, 2014 6:19:52 AM ICT
DELETE FROM AD_Field WHERE AD_Field_ID=203033
;
-- May 29, 2014 6:19:52 AM ICT
DELETE FROM AD_Field_Trl WHERE AD_Field_ID=203034
;
-- May 29, 2014 6:19:52 AM ICT
DELETE FROM AD_Field WHERE AD_Field_ID=203034
;
-- May 29, 2014 6:20:37 AM ICT
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=211251
;
-- May 29, 2014 6:20:37 AM ICT
DELETE FROM AD_Column WHERE AD_Column_ID=211251
;
-- May 29, 2014 6:20:38 AM ICT
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=211256
;
-- May 29, 2014 6:20:38 AM ICT
DELETE FROM AD_Column WHERE AD_Column_ID=211256
;
-- May 29, 2014 6:20:38 AM ICT
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=211250
;
-- May 29, 2014 6:20:38 AM ICT
DELETE FROM AD_Column WHERE AD_Column_ID=211250
;
ALTER TABLE ad_infoprocess DROP COLUMN name
;
ALTER TABLE ad_infoprocess DROP COLUMN description
;
ALTER TABLE ad_infoprocess DROP COLUMN help
;
-- May 29, 2014 6:21:41 AM ICT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('M','Process Menu',200275,'D','c7cb8357-7a1f-46ab-9957-cda58431adfd','ProcessMenu','Y',TO_DATE('2014-05-29 06:21:35','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2014-05-29 06:21:35','YYYY-MM-DD HH24:MI:SS'))
;
SELECT register_migration_script('201405291604_IDEMPIERE-1334.sql') FROM dual
;

View File

@ -0,0 +1,63 @@
-- May 29, 2014 6:19:41 AM ICT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_Field_Trl WHERE AD_Field_ID=203032
;
-- May 29, 2014 6:19:41 AM ICT
DELETE FROM AD_Field WHERE AD_Field_ID=203032
;
-- May 29, 2014 6:19:52 AM ICT
DELETE FROM AD_Field_Trl WHERE AD_Field_ID=203033
;
-- May 29, 2014 6:19:52 AM ICT
DELETE FROM AD_Field WHERE AD_Field_ID=203033
;
-- May 29, 2014 6:19:52 AM ICT
DELETE FROM AD_Field_Trl WHERE AD_Field_ID=203034
;
-- May 29, 2014 6:19:52 AM ICT
DELETE FROM AD_Field WHERE AD_Field_ID=203034
;
-- May 29, 2014 6:20:37 AM ICT
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=211251
;
-- May 29, 2014 6:20:37 AM ICT
DELETE FROM AD_Column WHERE AD_Column_ID=211251
;
-- May 29, 2014 6:20:38 AM ICT
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=211256
;
-- May 29, 2014 6:20:38 AM ICT
DELETE FROM AD_Column WHERE AD_Column_ID=211256
;
-- May 29, 2014 6:20:38 AM ICT
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=211250
;
-- May 29, 2014 6:20:38 AM ICT
DELETE FROM AD_Column WHERE AD_Column_ID=211250
;
ALTER TABLE ad_infoprocess DROP COLUMN name
;
ALTER TABLE ad_infoprocess DROP COLUMN description
;
ALTER TABLE ad_infoprocess DROP COLUMN help
;
-- May 29, 2014 6:21:41 AM ICT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('M','Process Menu',200275,'D','c7cb8357-7a1f-46ab-9957-cda58431adfd','ProcessMenu','Y',TO_TIMESTAMP('2014-05-29 06:21:35','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2014-05-29 06:21:35','YYYY-MM-DD HH24:MI:SS'))
;
SELECT register_migration_script('201405291604_IDEMPIERE-1334.sql') FROM dual
;

View File

@ -126,32 +126,6 @@ public interface I_AD_InfoProcess
*/ */
public int getCreatedBy(); public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name Help */
public static final String COLUMNNAME_Help = "Help";
/** Set Comment/Help.
* Comment or Hint
*/
public void setHelp (String Help);
/** Get Comment/Help.
* Comment or Hint
*/
public String getHelp();
/** Column name ImageURL */ /** Column name ImageURL */
public static final String COLUMNNAME_ImageURL = "ImageURL"; public static final String COLUMNNAME_ImageURL = "ImageURL";
@ -191,19 +165,6 @@ public interface I_AD_InfoProcess
*/ */
public String getLayoutType(); public String getLayoutType();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name SeqNo */ /** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo"; public static final String COLUMNNAME_SeqNo = "SeqNo";

View File

@ -29,7 +29,7 @@ public class X_AD_InfoProcess extends PO implements I_AD_InfoProcess, I_Persiste
/** /**
* *
*/ */
private static final long serialVersionUID = 20140528L; private static final long serialVersionUID = 20140529L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_InfoProcess (Properties ctx, int AD_InfoProcess_ID, String trxName) public X_AD_InfoProcess (Properties ctx, int AD_InfoProcess_ID, String trxName)
@ -42,7 +42,6 @@ public class X_AD_InfoProcess extends PO implements I_AD_InfoProcess, I_Persiste
setAD_Process_ID (0); setAD_Process_ID (0);
setLayoutType (null); setLayoutType (null);
// B // B
setName (null);
setSeqNo (0); setSeqNo (0);
// @SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_InfoProcess WHERE AD_InfoWindow_ID=@AD_InfoWindow_ID@ // @SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_InfoProcess WHERE AD_InfoWindow_ID=@AD_InfoWindow_ID@
} */ } */
@ -166,40 +165,6 @@ public class X_AD_InfoProcess extends PO implements I_AD_InfoProcess, I_Persiste
return ii.intValue(); return ii.intValue();
} }
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Image URL. /** Set Image URL.
@param ImageURL @param ImageURL
URL of image URL of image
@ -243,23 +208,6 @@ public class X_AD_InfoProcess extends PO implements I_AD_InfoProcess, I_Persiste
return (String)get_Value(COLUMNNAME_LayoutType); return (String)get_Value(COLUMNNAME_LayoutType);
} }
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Sequence. /** Set Sequence.
@param SeqNo @param SeqNo
Method of ordering records; lowest number comes first Method of ordering records; lowest number comes first

View File

@ -56,6 +56,7 @@ import org.compiere.model.MInfoColumn;
import org.compiere.model.MInfoWindow; import org.compiere.model.MInfoWindow;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MLookupInfo; import org.compiere.model.MLookupInfo;
import org.compiere.model.MProcess;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.X_AD_InfoColumn; import org.compiere.model.X_AD_InfoColumn;
@ -165,8 +166,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
infoContext = new Properties(Env.getCtx()); infoContext = new Properties(Env.getCtx());
p_loadedOK = loadInfoDefinition(); p_loadedOK = loadInfoDefinition();
// make process button only in windown mode
if (!m_lookup){
// IDEMPIERE-1334 // IDEMPIERE-1334
initInfoProcess(); boolean haveProcess = initInfoProcess();
// when have a process, force multi select mode
if (haveProcess)
p_multipleSelection = true;
}
loadInfoRelatedTabs(); loadInfoRelatedTabs();
if (loadedOK()) { if (loadedOK()) {
@ -188,10 +195,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* IDEMPIERE-1334 * IDEMPIERE-1334
* load info process info * load info process info
* layout each info process as button or dropdown item * layout each info process as button or dropdown item
* @return true when have process, false when no process
*/ */
protected void initInfoProcess() { protected boolean initInfoProcess() {
if (infoWindow == null){ if (infoWindow == null){
return; return false;
} }
MInfoProcess [] infoProcessList = infoWindow.getInfoProcess(false); MInfoProcess [] infoProcessList = infoWindow.getInfoProcess(false);
@ -199,18 +207,22 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
// ** layout info process flow order (button list, drop down, dialog,...) // ** layout info process flow order (button list, drop down, dialog,...)
// each layout type in a loop to ensure this order // each layout type in a loop to ensure this order
// get info from process (name, help, des), set to name of button, item menu,...
MProcess process = null;
// make list process button // make list process button
for (MInfoProcess infoProcess : infoProcessList){ for (MInfoProcess infoProcess : infoProcessList){
// just add info process have layout is button // just add info process have layout is button
if (!MInfoProcess.LAYOUTTYPE_Button.equals(infoProcess.getLayoutType())){ if (!MInfoProcess.LAYOUTTYPE_Button.equals(infoProcess.getLayoutType())){
continue; continue;
} }
Button btProcess = confirmPanel.addProcessButton(infoProcess.getName(), infoProcess.getImageURL()); process = MProcess.get(Env.getCtx(), infoProcess.getAD_Process_ID());
Button btProcess = confirmPanel.addProcessButton(process.get_Translation(MProcess.COLUMNNAME_Name), infoProcess.getImageURL());
// save process_id, handle event will use // save process_id, handle event will use
btProcess.setAttribute(PROCESS_ID_KEY, new Integer(infoProcess.getAD_Process_ID())); btProcess.setAttribute(PROCESS_ID_KEY, new Integer(infoProcess.getAD_Process_ID()));
btProcess.addEventListener(Events.ON_CLICK, this); btProcess.addEventListener(Events.ON_CLICK, this);
// save info process to use in handle event // save info process to use in handle event
btProcess.setAttribute(ATT_INFO_PROCESS_KEY, infoProcess); btProcess.setAttribute(ATT_INFO_PROCESS_KEY, process);
// update tooltip hepl when focus // update tooltip hepl when focus
btProcess.addEventListener(Events.ON_FOCUS, this); btProcess.addEventListener(Events.ON_FOCUS, this);
btProcessList.add(btProcess); btProcessList.add(btProcess);
@ -231,8 +243,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
// render item, use name to display // render item, use name to display
cbbProcess.setItemRenderer(new ComboitemRenderer<MInfoProcess>() { cbbProcess.setItemRenderer(new ComboitemRenderer<MInfoProcess>() {
public void render(Comboitem item, MInfoProcess data, int index){ public void render(Comboitem item, MInfoProcess data, int index){
item.setValue(data); MProcess process = MProcess.get(Env.getCtx(), data.getAD_Process_ID());
item.setLabel(data.getName()); item.setValue(process);
item.setLabel(process.get_Translation(MProcess.COLUMNNAME_Name));
if (data.getImageURL() != null && data.getImageURL().trim().length() > 0){ if (data.getImageURL() != null && data.getImageURL().trim().length() > 0){
item.setImage(ThemeManager.getThemeResource("images/" + data.getImageURL() + ".png")); item.setImage(ThemeManager.getThemeResource("images/" + data.getImageURL() + ".png"));
} }
@ -257,6 +270,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
continue; continue;
} }
process = MProcess.get(Env.getCtx(), infoProcess.getAD_Process_ID());
// init popup menu // init popup menu
if (ipMenu == null){ if (ipMenu == null){
ipMenu = new Menupopup(); ipMenu = new Menupopup();
@ -264,13 +279,13 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
confirmPanel.appendChild(ipMenu); confirmPanel.appendChild(ipMenu);
// init button to show menu // init button to show menu
btMenuProcess = confirmPanel.addProcessButton(Msg.getMsg(Env.getCtx(), ConfirmPanel.A_PROCESS), null); btMenuProcess = confirmPanel.addProcessButton("ProcessMenu", null);
btMenuProcess.setPopup("ipMenu, before_start"); btMenuProcess.setPopup("ipMenu, before_start");
} }
// make menu item for each info process // make menu item for each info process
Menuitem ipMenuItem = new Menuitem(); Menuitem ipMenuItem = new Menuitem();
ipMenuItem.setLabel(infoProcess.getName()); ipMenuItem.setLabel(process.get_Translation(MProcess.COLUMNNAME_Name));
if (infoProcess.getImageURL() != null && infoProcess.getImageURL().trim().length() > 0){ if (infoProcess.getImageURL() != null && infoProcess.getImageURL().trim().length() > 0){
ipMenuItem.setImage(ThemeManager.getThemeResource("images/" + infoProcess.getImageURL() + ".png")); ipMenuItem.setImage(ThemeManager.getThemeResource("images/" + infoProcess.getImageURL() + ".png"));
} }
@ -279,6 +294,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
ipMenu.appendChild(ipMenuItem); ipMenu.appendChild(ipMenuItem);
} }
return infoProcessList.length > 0;
} }
private void processQueryValue() { private void processQueryValue() {
@ -1175,8 +1191,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (event.getName().equals(Events.ON_FOCUS) && event.getTarget() != null && if (event.getName().equals(Events.ON_FOCUS) && event.getTarget() != null &&
event.getTarget().getAttribute(ATT_INFO_PROCESS_KEY) != null){ event.getTarget().getAttribute(ATT_INFO_PROCESS_KEY) != null){
MInfoProcess ipOfBt = (MInfoProcess)event.getTarget().getAttribute(ATT_INFO_PROCESS_KEY); MProcess process = (MProcess)event.getTarget().getAttribute(ATT_INFO_PROCESS_KEY);
SessionManager.getAppDesktop().updateHelpTooltip(ipOfBt.getName(), ipOfBt.getDescription(), ipOfBt.getHelp(), null); SessionManager.getAppDesktop().updateHelpTooltip(process.get_Translation(MProcess.COLUMNNAME_Name), process.get_Translation(MProcess.COLUMNNAME_Description), process.get_Translation(MProcess.COLUMNNAME_Help), null);
} }
else if (event.getName().equals(Events.ON_FOCUS)) { else if (event.getName().equals(Events.ON_FOCUS)) {
for (WEditor editor : editors) for (WEditor editor : editors)
@ -1191,8 +1207,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
// update help panel when change select item in combobox process // update help panel when change select item in combobox process
Comboitem selectedItem = cbbProcess.getSelectedItem(); Comboitem selectedItem = cbbProcess.getSelectedItem();
if (selectedItem != null && selectedItem.getValue() != null){ if (selectedItem != null && selectedItem.getValue() != null){
MInfoProcess selectedValue = (MInfoProcess)selectedItem.getValue(); MProcess selectedValue = (MProcess)selectedItem.getValue();
SessionManager.getAppDesktop().updateHelpTooltip(selectedValue.getName(), selectedValue.getDescription(), selectedValue.getHelp(), null);
SessionManager.getAppDesktop().updateHelpTooltip(selectedValue.get_Translation(MProcess.COLUMNNAME_Name), selectedValue.get_Translation(MProcess.COLUMNNAME_Description), selectedValue.get_Translation(MProcess.COLUMNNAME_Help), null);
} }
} }

View File

@ -32,8 +32,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Vector; import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.model.MInfoProcess;
import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.BusyDialog; import org.adempiere.webui.apps.BusyDialog;
@ -136,7 +134,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
/** Window Width */ /** Window Width */
static final int INFO_WIDTH = 800; static final int INFO_WIDTH = 800;
private boolean m_lookup; protected boolean m_lookup;
/************************************************** /**************************************************
* Detail Constructor * Detail Constructor
@ -1168,8 +1166,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
return; return;
} }
MInfoProcess selectedInfoProcess = (MInfoProcess)cbbSelectedItem.getValue(); MProcess selectedProcess = (MProcess)cbbSelectedItem.getValue();
preRunProcess(selectedInfoProcess.getAD_Process_ID()); preRunProcess(selectedProcess.getAD_Process_ID());
} }
else if (btProcessList.contains(event.getTarget())){ else if (btProcessList.contains(event.getTarget())){
// click bt process in case display button list // click bt process in case display button list

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB