1006181 Speed-up windows - Field to show read-only grid. Fixed selected label bug. Added clear selection context menu. (IDEMPIERE-3269)

This commit is contained in:
Heng Sin Low 2016-07-26 17:29:16 +08:00
parent e2d26b3a97
commit 3d1c1aea15
5 changed files with 75 additions and 17 deletions

View File

@ -0,0 +1,16 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jul 26, 2016 4:43:35 PM MYT
-- 1006181 Speed-up windows - Field to show read-only grid
UPDATE AD_Field SET DisplayLogic='@AD_Column_ID.AD_Reference_ID@=200127|@AD_Column_ID.AD_Reference_ID@=200128|@AD_Reference_ID@=200127|@AD_Reference_ID@=200128',Updated=TO_DATE('2016-07-26 16:43:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6432
;
-- Jul 26, 2016 4:45:34 PM MYT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,MsgTip,AD_Message_UU,Updated,Value,IsActive,CreatedBy,AD_Org_ID,AD_Client_ID,Created,UpdatedBy,EntityType) VALUES ('I','Clear Selection',200404,'Clear current selections','af2f6c7a-7f24-46e2-8ae7-0b67ca44890f',TO_DATE('2016-07-26 16:45:27','YYYY-MM-DD HH24:MI:SS'),'ClearSelection','Y',100,0,0,TO_DATE('2016-07-26 16:45:27','YYYY-MM-DD HH24:MI:SS'),100,'D')
;
SELECT register_migration_script('201607261600_Ticket_1006181.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- Jul 26, 2016 4:43:35 PM MYT
-- 1006181 Speed-up windows - Field to show read-only grid
UPDATE AD_Field SET DisplayLogic='@AD_Column_ID.AD_Reference_ID@=200127|@AD_Column_ID.AD_Reference_ID@=200128|@AD_Reference_ID@=200127|@AD_Reference_ID@=200128',Updated=TO_TIMESTAMP('2016-07-26 16:43:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6432
;
-- Jul 26, 2016 4:45:34 PM MYT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,MsgTip,AD_Message_UU,Updated,Value,IsActive,CreatedBy,AD_Org_ID,AD_Client_ID,Created,UpdatedBy,EntityType) VALUES ('I','Clear Selection',200404,'Clear current selections','af2f6c7a-7f24-46e2-8ae7-0b67ca44890f',TO_TIMESTAMP('2016-07-26 16:45:27','YYYY-MM-DD HH24:MI:SS'),'ClearSelection','Y',100,0,0,TO_TIMESTAMP('2016-07-26 16:45:27','YYYY-MM-DD HH24:MI:SS'),100,'D')
;
SELECT register_migration_script('201607261600_Ticket_1006181.sql') FROM dual
;

View File

@ -48,7 +48,7 @@ import org.zkoss.zul.ext.Selectable;
* @author Low Heng Sin
*
*/
public class GridTabSelectionListView extends Borderlayout implements EventListener<Event>
public class GridTabSelectionListView extends Borderlayout
{
/**
*
@ -262,7 +262,6 @@ public class GridTabSelectionListView extends Borderlayout implements EventListe
listbox.setVflex(true);
listbox.setHflex("1");
listbox.setSizedByContent(true);
listbox.addEventListener(Events.ON_SELECT, this);
updateModel();
@ -290,17 +289,6 @@ public class GridTabSelectionListView extends Borderlayout implements EventListe
public void deactivate() {
}
public void onEvent(Event event) throws Exception
{
if (event == null)
return;
else if (event.getTarget() == listbox)
{
int count = listbox.getSelectedCount();
selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : " + count);
}
}
/**
*
* @return Listbox

View File

@ -31,10 +31,12 @@ import org.compiere.model.GridTab;
import org.compiere.model.GridTabVO;
import org.compiere.model.GridWindow;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.Menuitem;
import org.zkoss.zul.ext.Selectable;
/**
@ -84,7 +86,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
{
if (tableEditor)
setVisible(false);
else if (gridField != null)
else if (gridField != null && gridField.getGridTab() != null)
{
int AD_Tab_ID = gridField.getIncluded_Tab_ID();
GridWindow gridWindow = gridField.getGridTab().getGridWindow();
@ -96,11 +98,24 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
{
GridTabVO vo = t.getVO();
listViewGridTab = new GridTab(vo, gridWindow);
listViewGridTab.setLinkColumnName(t.getLinkColumnName());
String lcn = t.getLinkColumnName();
if (Util.isEmpty(lcn)) {
t.setLinkColumnName(null);
lcn = t.getLinkColumnName();
}
listViewGridTab.setLinkColumnName(lcn);
getComponent().init(listViewGridTab);
break;
}
}
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
Menuitem clear = new Menuitem(Msg.getMsg(Env.getCtx(), "ClearSelection"), null);
clear.setAttribute("EVENT", "onClearSelection");
clear.addEventListener(Events.ON_CLICK, popupMenu);
popupMenu.appendChild(clear);
getComponent().getListbox().setContext(popupMenu);
}
}
@ -223,6 +238,12 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
{
WFieldRecordInfo.start(gridField);
}
else if ("onClearSelection".equals(evt.getContextEvent()))
{
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, null);
super.fireValueChange(changeEvent);
oldValue = null;
}
}
@Override

View File

@ -26,9 +26,11 @@ import org.compiere.model.GridTab;
import org.compiere.model.GridTabVO;
import org.compiere.model.GridWindow;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Menuitem;
/**
*
@ -77,7 +79,7 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
{
if (tableEditor)
setVisible(false);
else if (gridField != null)
else if (gridField != null && gridField.getGridTab() != null)
{
int AD_Tab_ID = gridField.getIncluded_Tab_ID();
GridWindow gridWindow = gridField.getGridTab().getGridWindow();
@ -89,11 +91,24 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
{
GridTabVO vo = t.getVO();
listViewGridTab = new GridTab(vo, gridWindow);
listViewGridTab.setLinkColumnName(t.getLinkColumnName());
String lcn = t.getLinkColumnName();
if (Util.isEmpty(lcn)) {
t.setLinkColumnName(null);
lcn = t.getLinkColumnName();
}
listViewGridTab.setLinkColumnName(lcn);
getComponent().init(listViewGridTab);
break;
}
}
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
Menuitem clear = new Menuitem(Msg.getMsg(Env.getCtx(), "ClearSelection"), null);
clear.setAttribute("EVENT", "onClearSelection");
clear.addEventListener(Events.ON_CLICK, popupMenu);
popupMenu.appendChild(clear);
getComponent().getListbox().setContext(popupMenu);
}
}
@ -174,6 +189,12 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
{
WFieldRecordInfo.start(gridField);
}
else if ("onClearSelection".equals(evt.getContextEvent()))
{
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, null);
super.fireValueChange(changeEvent);
oldValue = null;
}
}
@Override