IDEMPIERE-4601 Move Plugin manager from About to a Form (#469)

This commit is contained in:
Carlos Ruiz 2020-12-16 02:10:00 +01:00 committed by GitHub
parent 2ab2211f81
commit a9a2aeeeed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 619 additions and 230 deletions

View File

@ -0,0 +1,170 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Dec 15, 2020, 4:07:23 PM CET
INSERT INTO AD_Form (AD_Form_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,Classname,AccessLevel,EntityType,IsBetaFunctionality,AD_Form_UU) VALUES (200015,0,0,'Y',TO_DATE('2020-12-15 16:07:23','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-12-15 16:07:23','YYYY-MM-DD HH24:MI:SS'),100,'Plugin Manager','Plugin Manager','Plugin Manager','org.adempiere.webui.apps.form.WPluginManager','4','D','N','4641c756-4c24-4c2f-9c27-f62c86f0b940')
;
-- Dec 15, 2020, 4:07:52 PM CET
INSERT INTO AD_Menu (AD_Menu_ID,Name,Action,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,AD_Form_ID,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200177,'Plugin Manager','X',0,0,'Y',TO_DATE('2020-12-15 16:07:52','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-12-15 16:07:52','YYYY-MM-DD HH24:MI:SS'),100,'N','Y',200015,'N','D','Y','bb2ed8f6-2189-4d23-bf95-2a42abac4e64')
;
-- Dec 15, 2020, 4:07:52 PM CET
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', getDate(), 100, getDate(), 100,t.AD_Tree_ID, 200177, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200177)
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=218
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=153
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=263
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=166
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=203
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=53242
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=236
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=183
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=160
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=278
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=345
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=53296
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=53014
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=53108
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=0, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=161
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=1, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=367
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=2, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=456
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=3, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=501
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=4, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=326
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=5, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=566
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=6, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=392
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=7, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=113
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=8, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=220
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=9, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=351
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=10, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=289
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=11, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=302
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=12, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=200168
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=13, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=200169
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=14, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=303
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=15, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=200047
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=16, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=200048
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=17, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=321
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=18, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=461
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=19, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=53193
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=20, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=200161
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=21, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=53322
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=22, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=383
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=23, Updated=getDate() WHERE AD_Tree_ID=10 AND Node_ID=200177
;
SELECT register_migration_script('202012151609_IDEMPIERE-4601.sql') FROM dual
;

View File

@ -0,0 +1,167 @@
-- Dec 15, 2020, 4:07:23 PM CET
INSERT INTO AD_Form (AD_Form_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,Classname,AccessLevel,EntityType,IsBetaFunctionality,AD_Form_UU) VALUES (200015,0,0,'Y',TO_TIMESTAMP('2020-12-15 16:07:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-12-15 16:07:23','YYYY-MM-DD HH24:MI:SS'),100,'Plugin Manager','Plugin Manager','Plugin Manager','org.adempiere.webui.apps.form.WPluginManager','4','D','N','4641c756-4c24-4c2f-9c27-f62c86f0b940')
;
-- Dec 15, 2020, 4:07:52 PM CET
INSERT INTO AD_Menu (AD_Menu_ID,Name,"action",AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,AD_Form_ID,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200177,'Plugin Manager','X',0,0,'Y',TO_TIMESTAMP('2020-12-15 16:07:52','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-12-15 16:07:52','YYYY-MM-DD HH24:MI:SS'),100,'N','Y',200015,'N','D','Y','bb2ed8f6-2189-4d23-bf95-2a42abac4e64')
;
-- Dec 15, 2020, 4:07:52 PM CET
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200177, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200177)
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=218
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=153
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=263
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=166
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=203
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53242
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=236
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=183
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=160
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=278
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=345
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53296
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53014
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53108
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=161
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=367
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=456
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=501
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=326
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=566
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=392
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=113
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=220
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=351
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=289
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=302
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200168
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200169
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=303
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200047
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=16, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200048
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=17, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=321
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=18, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=461
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=19, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53193
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200161
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53322
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=383
;
-- Dec 15, 2020, 4:08:26 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=155, SeqNo=23, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200177
;
SELECT register_migration_script('202012151609_IDEMPIERE-4601.sql') FROM dual
;

View File

@ -0,0 +1,280 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss - bxservice *
**********************************************************************/
package org.adempiere.webui.apps.form;
import java.util.Properties;
import java.util.Vector;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.WebUIActivator;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ListModelTable;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.minigrid.IDColumn;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.wiring.BundleRevision;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Vbox;
/**
* A Custom Form to manage plugins in iDempiere
*
* @author Carlos Ruiz - globalqss - bxservice
*
*/
public class WPluginManager extends ADForm implements EventListener<Event> {
/**
*
*/
private static final long serialVersionUID = -2038792517003449189L;
/** Log. */
private static final CLogger log = CLogger.getCLogger(WPluginManager.class);
private WListbox pluginsTable;
private Listbox pluginActions;
private Button pluginProcess;
private Vector<Vector<Object>> pluginData;
private Vector<String> pluginColumnNames;
private static final int PLUGIN_ACTION_NONE = 0;
private static final int PLUGIN_ACTION_STOP = 1;
private static final int PLUGIN_ACTION_START = 2;
private static final int PLUGIN_ACTION_UPDATE = 3;
private static final int PLUGIN_ACTION_UNINSTALL = 4;
private static final int PLUGIN_ACTION_INSTALL = 5;
/**
* Default constructor.
*/
public WPluginManager() {
super();
}
@Override
protected void initForm() {
Properties ctx = Env.getCtx();
Vbox vbox = new Vbox();
ZKUpdateUtil.setHflex(vbox, "1");
ZKUpdateUtil.setVflex(vbox, "1");
pluginColumnNames = new Vector<String>();
pluginColumnNames.add("");
pluginColumnNames.add(Msg.getMsg(ctx, "Id"));
pluginColumnNames.add(Msg.getMsg(ctx, "State"));
pluginColumnNames.add(Msg.getCleanMsg(ctx, "Name"));
pluginColumnNames.add(Msg.getMsg(ctx, "Version"));
pluginsTable = ListboxFactory.newDataTableAutoSize();
pluginData = new Vector<Vector<Object>>();
int i = 0;
pluginsTable.setColumnClass(i++, IDColumn.class, true); // 0-bundleId
pluginsTable.setColumnClass(i++, Integer.class, true); // 1-bundleId
pluginsTable.setColumnClass(i++, String.class, true); // 2-State
pluginsTable.setColumnClass(i++, String.class, true); // 3-SymbolicName
pluginsTable.setColumnClass(i++, String.class, true); // 4-Version
vbox.appendChild(pluginsTable);
ZKUpdateUtil.setVflex(pluginsTable, "1");
ZKUpdateUtil.setHflex(pluginsTable, "1");
refreshPluginTable();
pluginsTable.autoSize();
pluginsTable.addEventListener(Events.ON_SELECT, this);
pluginActions = new Listbox(new KeyNamePair[] { new KeyNamePair(PLUGIN_ACTION_NONE, ""),
new KeyNamePair(PLUGIN_ACTION_STOP, Msg.getMsg(ctx, "Stop")),
new KeyNamePair(PLUGIN_ACTION_START, Msg.getMsg(ctx, "Start")),
new KeyNamePair(PLUGIN_ACTION_UPDATE, Msg.getMsg(ctx, "Update")),
new KeyNamePair(PLUGIN_ACTION_UNINSTALL, Msg.getMsg(ctx, "Uninstall")),
new KeyNamePair(PLUGIN_ACTION_INSTALL, Msg.getMsg(ctx, "Install")) });
pluginActions.setId("pluginActions");
pluginActions.setRows(0);
pluginActions.setMold("select");
ZKUpdateUtil.setWidth(pluginActions, "200px");
refreshActionList();
pluginProcess = new Button(Msg.getMsg(ctx, "Process"));
pluginProcess.addEventListener(Events.ON_CLICK, this);
Div div = new Div();
div.setStyle("text-align: right;");
div.appendChild(pluginActions);
div.appendChild(pluginProcess);
vbox.appendChild(div);
this.appendChild(vbox);
}
private String state(int state) {
switch (state) {
case Bundle.ACTIVE:
return "ACTIVE";
case Bundle.INSTALLED:
return "INSTALLED";
case Bundle.RESOLVED:
return "RESOLVED";
case Bundle.STARTING:
return "STARTING";
case Bundle.STOPPING:
return "STOPPING";
case Bundle.UNINSTALLED:
return "UNINSTALLED";
default:
return "UNKNOWN";
}
}
private void refreshActionList() {
pluginActions.getItemAtIndex(PLUGIN_ACTION_UPDATE).setVisible(false); // not implemented yet
pluginActions.getItemAtIndex(PLUGIN_ACTION_UNINSTALL).setVisible(false); // not implemented yet
pluginActions.getItemAtIndex(PLUGIN_ACTION_INSTALL).setVisible(false); // not implemented yet
pluginActions.getItemAtIndex(PLUGIN_ACTION_STOP).setVisible(false);
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(false);
pluginActions.setSelectedItem(null);
Bundle bundle = getSelectedBundle();
if (bundle == null)
return;
int state = bundle.getState();
boolean isFragment = false;
BundleRevision rev = bundle.adapt(BundleRevision.class);
if (rev != null) {
isFragment = (rev.getTypes() & BundleRevision.TYPE_FRAGMENT) != 0;
}
/*
* boolean hasFragments = false; if (!isFragment) { if (rev.getWiring() != null)
* { if (rev.getWiring().getProvidedWires(BundleRevision.HOST_NAMESPACE).size()
* > 0) { hasFragments = true; } } }
*/
if (bundle.getBundleId() == 0) {
// bundle 0 cannot be stopped
} else if (state == Bundle.ACTIVE) {
pluginActions.getItemAtIndex(PLUGIN_ACTION_STOP).setVisible(true);
} else if (state == Bundle.RESOLVED) {
if (!isFragment) {
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
}
} else if (state == Bundle.INSTALLED) {
if (!isFragment) {
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
}
} else if (state == Bundle.STARTING) {
if (!isFragment) {
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
}
} else if (state == Bundle.STOPPING) {
// no options yet for stopping
} else if (state == Bundle.UNINSTALLED) {
// no options yet for uninstalled
}
}
private Bundle getSelectedBundle() {
Bundle retValue = null;
int idx = pluginsTable.getSelectedIndex();
if (idx >= 0) {
Vector<Object> pluginVector = pluginData.get(idx);
int pluginId = ((IDColumn) pluginVector.get(0)).getRecord_ID();
BundleContext bundleCtx = WebUIActivator.getBundleContext();
retValue = bundleCtx.getBundle(pluginId);
}
return retValue;
}
private void processPlugin() {
Listitem actionItem = pluginActions.getSelectedItem();
if (actionItem != null && actionItem.getValue() instanceof Integer) {
int action = (Integer) actionItem.getValue();
Bundle bundle = getSelectedBundle();
if (action == PLUGIN_ACTION_STOP && bundle != null) {
try {
if (log.isLoggable(Level.INFO))
log.info("Stopping plugin " + bundle.getSymbolicName());
bundle.stop();
} catch (BundleException e) {
throw new AdempiereException(e);
}
} else if (action == PLUGIN_ACTION_START && bundle != null) {
try {
if (log.isLoggable(Level.INFO))
log.info("Starting plugin " + bundle.getSymbolicName());
bundle.start();
} catch (BundleException e) {
throw new AdempiereException(e);
}
} else if (action == PLUGIN_ACTION_UPDATE && bundle != null) {
// PLUGIN_ACTION_UPDATE not implemented yet
} else if (action == PLUGIN_ACTION_UNINSTALL && bundle != null) {
// PLUGIN_ACTION_UNINSTALL not implemented yet
} else if (action == PLUGIN_ACTION_INSTALL && bundle != null) {
// PLUGIN_ACTION_INSTALL not implemented yet
}
}
refreshPluginTable();
refreshActionList();
}
private void refreshPluginTable() {
int idx = pluginsTable.getSelectedIndex();
pluginsTable.getModel().removeAll(pluginData);
pluginData.removeAllElements();
BundleContext bundleCtx = WebUIActivator.getBundleContext();
for (Bundle bundle : bundleCtx.getBundles()) {
Vector<Object> line = new Vector<Object>();
Integer bundl = Long.valueOf(bundle.getBundleId()).intValue(); // potential problem converting Long to
// Integer, but WListBox cannot order Long
line.add(new IDColumn(bundl));
line.add(bundl);
line.add(state(bundle.getState()));
line.add(bundle.getSymbolicName());
line.add(bundle.getVersion());
pluginData.add(line);
}
ListModelTable model = new ListModelTable(pluginData);
pluginsTable.setData(model, pluginColumnNames);
pluginsTable.setSelectedIndex(idx);
}
public void onEvent(Event event) throws Exception {
if (Events.ON_SELECT.equals(event.getName()) && event.getTarget() == pluginsTable)
refreshActionList();
else if (Events.ON_CLICK.equals(event.getName()) && event.getTarget() == pluginProcess)
processPlugin();
}
}

View File

@ -22,7 +22,6 @@ import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.WebUIActivator;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox;
@ -31,7 +30,6 @@ import org.adempiere.webui.component.FolderBrowser;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListHead;
import org.adempiere.webui.component.ListHeader;
import org.adempiere.webui.component.ListModelTable;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.SimpleListModel;
@ -41,7 +39,6 @@ import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.factory.ButtonFactory;
@ -49,21 +46,15 @@ import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.FeedbackManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.Adempiere;
import org.compiere.minigrid.IDColumn;
import org.compiere.model.MUser;
import org.compiere.util.CLogErrorBuffer;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Ini;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.SecureEngine;
import org.compiere.util.Util;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.wiring.BundleRevision;
import org.zkoss.util.media.AMedia;
import org.zkoss.zhtml.Pre;
import org.zkoss.zhtml.Text;
@ -113,19 +104,6 @@ public class AboutWindow extends Window implements EventListener<Event> {
private Listbox levelListBox;
private WListbox pluginsTable;
private Listbox pluginActions;
private Button pluginProcess;
private Vector<Vector<Object>> pluginData;
private Vector<String> pluginColumnNames;
private static final int PLUGIN_ACTION_NONE = 0;
private static final int PLUGIN_ACTION_STOP = 1;
private static final int PLUGIN_ACTION_START = 2;
private static final int PLUGIN_ACTION_UPDATE = 3;
private static final int PLUGIN_ACTION_UNINSTALL = 4;
private static final int PLUGIN_ACTION_INSTALL = 5;
public AboutWindow() {
super();
init();
@ -222,15 +200,6 @@ public class AboutWindow extends Window implements EventListener<Event> {
tabPanel = createTrace();
tabPanel.setParent(tabPanels);
//Plugins
tab = new Tab();
tab.setLabel("Plugins");
tabPlugins= tab;
tabPanel = createPlugins();
if (tabPanel != null) {
tab.setParent(tabs);
tabPanel.setParent(tabPanels);
}
}
protected Tabpanel createTrace() {
@ -357,197 +326,6 @@ public class AboutWindow extends Window implements EventListener<Event> {
tabLog.setLabel(Msg.getMsg(Env.getCtx(), "TraceInfo") + " (" + data.size() + ")");
}
protected Tabpanel createPlugins() {
Properties ctx = Env.getCtx();
MUser user = MUser.get(ctx);
Tabpanel tabPanel = null;
if (Env.getAD_Client_ID(ctx) == 0 && user.isAdministrator()) {
tabPanel = new Tabpanel();
Vbox vbox = new Vbox();
ZKUpdateUtil.setHflex(vbox, "1");
ZKUpdateUtil.setVflex(vbox, "1");
pluginColumnNames = new Vector<String>();
pluginColumnNames.add("");
pluginColumnNames.add(Msg.getMsg(ctx, "Id"));
pluginColumnNames.add(Msg.getMsg(ctx, "State"));
pluginColumnNames.add(Msg.getCleanMsg(ctx, "Name"));
pluginColumnNames.add(Msg.getMsg(ctx, "Version"));
pluginsTable = ListboxFactory.newDataTableAutoSize();
pluginData = new Vector<Vector<Object>>();
int i = 0;
pluginsTable.setColumnClass(i++, IDColumn.class, true); // 0-bundleId
pluginsTable.setColumnClass(i++, Integer.class, true); // 1-bundleId
pluginsTable.setColumnClass(i++, String.class, true); // 2-State
pluginsTable.setColumnClass(i++, String.class, true); // 3-SymbolicName
pluginsTable.setColumnClass(i++, String.class, true); // 4-Version
vbox.appendChild(pluginsTable);
ZKUpdateUtil.setVflex(pluginsTable, "1");
ZKUpdateUtil.setHflex(pluginsTable, "1");
refreshPluginTable();
pluginsTable.autoSize();
pluginsTable.addEventListener(Events.ON_SELECT, this);
pluginActions = new Listbox(
new KeyNamePair[] {
new KeyNamePair(PLUGIN_ACTION_NONE, ""),
new KeyNamePair(PLUGIN_ACTION_STOP, Msg.getMsg(ctx, "Stop")),
new KeyNamePair(PLUGIN_ACTION_START, Msg.getMsg(ctx, "Start")),
new KeyNamePair(PLUGIN_ACTION_UPDATE, Msg.getMsg(ctx, "Update")),
new KeyNamePair(PLUGIN_ACTION_UNINSTALL, Msg.getMsg(ctx, "Uninstall")),
new KeyNamePair(PLUGIN_ACTION_INSTALL, Msg.getMsg(ctx, "Install"))
});
pluginActions.setId("pluginActions");
pluginActions.setRows(0);
pluginActions.setMold("select");
ZKUpdateUtil.setWidth(pluginActions, "200px");
refreshActionList();
pluginProcess = new Button(Msg.getMsg(ctx, "Process"));
pluginProcess.addEventListener(Events.ON_CLICK, this);
Div div = new Div();
div.setStyle("text-align: right;");
div.appendChild(pluginActions);
div.appendChild(pluginProcess);
vbox.appendChild(div);
vbox.setParent(tabPanel);
tabPlugins.setLabel(Msg.getMsg(ctx, "Plugins") + " (" + pluginData.size() + ")");
}
return tabPanel;
}
private String state(int state) {
switch (state) {
case Bundle.ACTIVE:
return "ACTIVE";
case Bundle.INSTALLED:
return "INSTALLED";
case Bundle.RESOLVED:
return "RESOLVED";
case Bundle.STARTING:
return "STARTING";
case Bundle.STOPPING:
return "STOPPING";
case Bundle.UNINSTALLED:
return "UNINSTALLED";
default:
return "UNKNOWN";
}
}
private void refreshActionList() {
pluginActions.getItemAtIndex(PLUGIN_ACTION_UPDATE).setVisible(false); // not implemented yet
pluginActions.getItemAtIndex(PLUGIN_ACTION_UNINSTALL).setVisible(false); // not implemented yet
pluginActions.getItemAtIndex(PLUGIN_ACTION_INSTALL).setVisible(false); // not implemented yet
pluginActions.getItemAtIndex(PLUGIN_ACTION_STOP).setVisible(false);
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(false);
pluginActions.setSelectedItem(null);
Bundle bundle = getSelectedBundle();
if (bundle == null)
return;
int state = bundle.getState();
boolean isFragment = false;
BundleRevision rev = bundle.adapt(BundleRevision.class);
if (rev != null) {
isFragment = (rev.getTypes() & BundleRevision.TYPE_FRAGMENT) != 0;
}
/*
boolean hasFragments = false;
if (!isFragment) {
if (rev.getWiring() != null) {
if (rev.getWiring().getProvidedWires(BundleRevision.HOST_NAMESPACE).size() > 0) {
hasFragments = true;
}
}
}
*/
if (bundle.getBundleId() == 0) {
// bundle 0 cannot be stopped
} else if (state == Bundle.ACTIVE) {
pluginActions.getItemAtIndex(PLUGIN_ACTION_STOP).setVisible(true);
} else if (state == Bundle.RESOLVED) {
if (!isFragment) {
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
}
} else if (state == Bundle.INSTALLED) {
if (!isFragment) {
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
}
} else if (state == Bundle.STARTING) {
if (!isFragment) {
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
}
} else if (state == Bundle.STOPPING) {
// no options yet for stopping
} else if (state == Bundle.UNINSTALLED) {
// no options yet for uninstalled
}
}
private Bundle getSelectedBundle() {
Bundle retValue = null;
int idx = pluginsTable.getSelectedIndex();
if (idx >= 0) {
Vector<Object> pluginVector = pluginData.get(idx);
int pluginId = ((IDColumn)pluginVector.get(0)).getRecord_ID();
BundleContext bundleCtx = WebUIActivator.getBundleContext();
retValue = bundleCtx.getBundle(pluginId);
}
return retValue;
}
private void processPlugin() {
Listitem actionItem = pluginActions.getSelectedItem();
if (actionItem != null && actionItem.getValue() instanceof Integer) {
int action = (Integer)actionItem.getValue();
Bundle bundle = getSelectedBundle();
if (action == PLUGIN_ACTION_STOP && bundle != null) {
try {
bundle.stop();
} catch (BundleException e) {
throw new AdempiereException(e);
}
} else if (action == PLUGIN_ACTION_START && bundle != null) {
try {
bundle.start();
} catch (BundleException e) {
throw new AdempiereException(e);
}
} else if (action == PLUGIN_ACTION_UPDATE && bundle != null) {
// PLUGIN_ACTION_UPDATE not implemented yet
} else if (action == PLUGIN_ACTION_UNINSTALL && bundle != null) {
// PLUGIN_ACTION_UNINSTALL not implemented yet
} else if (action == PLUGIN_ACTION_INSTALL && bundle != null) {
// PLUGIN_ACTION_INSTALL not implemented yet
}
}
refreshPluginTable();
refreshActionList();
}
private void refreshPluginTable() {
int idx = pluginsTable.getSelectedIndex();
pluginsTable.getModel().removeAll(pluginData);
pluginData.removeAllElements();
BundleContext bundleCtx = WebUIActivator.getBundleContext();
for (Bundle bundle : bundleCtx.getBundles()) {
Vector<Object> line = new Vector<Object>();
Integer bundl = Long.valueOf(bundle.getBundleId()).intValue(); // potential problem converting Long to Integer, but WListBox cannot order Long
line.add(new IDColumn(bundl));
line.add(bundl);
line.add(state(bundle.getState()));
line.add(bundle.getSymbolicName());
line.add(bundle.getVersion());
pluginData.add(line);
}
ListModelTable model = new ListModelTable(pluginData);
pluginsTable.setData(model, pluginColumnNames);
pluginsTable.setSelectedIndex(idx);
}
protected Tabpanel createInfo() {
Tabpanel tabPanel = new Tabpanel();
Div div = new Div();
@ -668,15 +446,9 @@ public class AboutWindow extends Window implements EventListener<Event> {
reloadLogProps();
else if (event.getTarget() == levelListBox)
setTraceLevel();
else if (Events.ON_SELECT.equals(event.getName()) && event.getTarget() == pluginsTable)
refreshActionList();
else if (Events.ON_CLICK.equals(event.getName())) {
if (event.getTarget() == pluginProcess)
processPlugin();
else
else if (Events.ON_CLICK.equals(event.getName()))
this.detach();
}
}
private void reloadLogProps() {
Properties props = new Properties();