IDEMPIERE-2230:Info Window - remember selection during pagination

in muilti selection mode, show selected record at status
This commit is contained in:
hieplq 2015-08-14 06:59:18 +08:00
parent 323d8186af
commit 8589e0ab04
5 changed files with 74 additions and 4 deletions

View File

@ -0,0 +1,10 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- Aug 14, 2015 6:52:36 AM WITA
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Selected {0} rows',0,0,'Y',TO_DATE('2015-08-14 06:52:36','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-08-14 06:52:36','YYYY-MM-DD HH24:MI:SS'),100,1000000,'IWStatusSelected','D','316251b1-093c-4f33-bf37-4d5af0f000d5')
;
SELECT register_migration_script('201514081982-IDEMPIERE-2230.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- Aug 14, 2015 6:52:36 AM WITA
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Selected {0} rows',0,0,'Y',TO_TIMESTAMP('2015-08-14 06:52:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-08-14 06:52:36','YYYY-MM-DD HH24:MI:SS'),100,1000000,'IWStatusSelected','D','316251b1-093c-4f33-bf37-4d5af0f000d5')
;
SELECT register_migration_script('201514081982-IDEMPIERE-2230.sql') FROM dual
;

View File

@ -113,11 +113,10 @@ import org.zkoss.zul.ext.Sortable;
*/
public abstract class InfoPanel extends Window implements EventListener<Event>, WTableModelListener, Sortable<Object>, IHelpContext
{
/**
*
*/
private static final long serialVersionUID = -7706948638874794856L;
private static final long serialVersionUID = 3761627143274259211L;
private final static int DEFAULT_PAGE_SIZE = 100;
private final static int DEFAULT_PAGE_RELOAD = 4;
protected List<Button> btProcessList = new ArrayList<Button>();
@ -470,6 +469,38 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
statusBar.setStatusDB(text);
} // setStatusDB
/**
* Set Status DB
* @param text text
*/
public void setStatusSelected ()
{
if (!p_multipleSelection)
return;
int selectedCount = recordSelectedData.size();
for (int rowIndex = 0; rowIndex < contentPanel.getModel().getRowCount(); rowIndex++){
Integer keyCandidate = getColumnValue(rowIndex);
@SuppressWarnings("unchecked")
List<Object> candidateRecord = (List<Object>)contentPanel.getModel().get(rowIndex);
if (contentPanel.getModel().isSelected(candidateRecord)){
if (!recordSelectedData.containsKey(keyCandidate)){
selectedCount++;
}
}else{
if (recordSelectedData.containsKey(keyCandidate)){// unselected record
selectedCount--;
}
}
}
String msg = Msg.getMsg(Env.getCtx(), "IWStatusSelected", new Object [] {String.valueOf(selectedCount)});
statusBar.setSelectedRowNumber(msg);
} // setStatusDB
protected void prepareTable (ColumnInfo[] layout,
String from,
String where,
@ -739,7 +770,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
int no = m_count;
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no));
setStatusSelected ();
addDoubleClickListener();
}
@ -1576,6 +1607,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
}
else if (event.getTarget() == contentPanel && event.getName().equals(Events.ON_SELECT))
{
setStatusSelected ();
m_lastOnSelectItem = null;
SelectEvent<?, ?> selectEvent = (SelectEvent<?, ?>) event;
if (selectEvent.getReference() != null && selectEvent.getReference() instanceof Listitem)

View File

@ -67,6 +67,7 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
private Label statusDB;
private Label infoLine;
private Label statusLine;
private Label selectedLine;
private DataStatusEvent m_dse;
@ -107,6 +108,11 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
west = new Div();
west.setStyle("text-align: left; ");
selectedLine = new Label();
west.appendChild(selectedLine);
selectedLine.setVisible(false);
LayoutUtils.addSclass("status-selected", selectedLine);
west.appendChild(statusLine);
Vbox vbox = new Vbox();
vbox.setPack("center");
@ -117,7 +123,8 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
east = new Div();
east.setWidth("100%");
east.setStyle("text-align: right; ");
infoLine = new Label();
infoLine = new Label();
east.appendChild(infoLine);
infoLine.setVisible(false);
east.appendChild(statusDB);
@ -298,6 +305,13 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
infoLine.setVisible(true);
} // setInfo
public void setSelectedRowNumber (String rowNum){
selectedLine.setVisible(rowNum != null);
if (rowNum != null){
selectedLine.setValue(rowNum);
}
}
public void onEvent(Event event) throws Exception {
if (Events.ON_CLICK.equals(event.getName()) && event.getTarget() == statusDB)
{

View File

@ -78,6 +78,13 @@
padding-right: 10px;
border-left: solid 1px #9CBDFF;
}
.status-selected{
padding-right: 5px;
padding-right: 5px;
border-right: solid 1px #9CBDFF;
}
.status-border {
border: solid 1px #9CBDFF;
}