IDEMPIERE-379 Reporting wizard for end users / Refactor
This commit is contained in:
parent
bbba2cdd72
commit
7516e37f1f
|
@ -16,6 +16,7 @@ package org.adempiere.webui.apps.form;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
private boolean m_isCanExport;
|
||||
|
||||
private ReportEngine m_reportEngine=null;
|
||||
public MPrintFormatItem[] pfi ;
|
||||
public ArrayList<MPrintFormatItem> pfi ;
|
||||
|
||||
private Auxheader headerPanel=new Auxheader();
|
||||
private Listbox comboReport = new Listbox();
|
||||
|
@ -140,7 +141,11 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
m_reportEngine = re;
|
||||
m_isCanExport=MRole.getDefault().isCanExport();
|
||||
pfi= m_reportEngine.getPrintFormat().getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name");
|
||||
pfi = new ArrayList<MPrintFormatItem>() ;
|
||||
for (MPrintFormatItem item : m_reportEngine.getPrintFormat().getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name")) {
|
||||
pfi.add(item);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_ctx = m_reportEngine.getCtx();
|
||||
|
@ -229,6 +234,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
tpsc3.setMPrintFormat(fm);
|
||||
tpsc3.setPrintFormatItems(pfi);
|
||||
tpsc3.setListsColumns();
|
||||
tpsc3.init();
|
||||
tpsc3.refresh();
|
||||
tpsc3.setWReportCustomization(this);
|
||||
|
@ -359,9 +365,11 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
}
|
||||
|
||||
private void onSave() {
|
||||
for (int i=0; i < pfi.length ;i++){
|
||||
pfi[i].saveEx();
|
||||
}
|
||||
|
||||
for (MPrintFormatItem item : pfi)
|
||||
if (item.is_Changed())
|
||||
item.saveEx();
|
||||
|
||||
setIsChanged(false);
|
||||
}
|
||||
|
||||
|
@ -519,7 +527,9 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
public void copyFormat(){
|
||||
MPrintFormat newpf=MPrintFormat.copyToClient(m_ctx, m_reportEngine.getPrintFormat().get_ID() ,Env.getAD_Client_ID(m_ctx));
|
||||
pfi = newpf.getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name");
|
||||
|
||||
for (MPrintFormatItem item : newpf.getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name"))
|
||||
pfi.add(item);
|
||||
|
||||
tpdf1.setMPrintFormat(newpf);
|
||||
tpdf1.setPrintFormatItems(pfi);
|
||||
|
@ -532,6 +542,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
tpsc3.setMPrintFormat(newpf);
|
||||
tpsc3.setPrintFormatItems(pfi);
|
||||
tpfo2.setListColumns();
|
||||
tpsc3.refresh();
|
||||
|
||||
tpgc4.setMPrintFormat(newpf);
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.adempiere.webui.component.Rows;
|
|||
import org.adempiere.webui.component.Textbox;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
|
@ -59,9 +60,9 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
public void init() {
|
||||
|
||||
m_chkboxes = new Checkbox[m_pfi.length];
|
||||
m_textBoxes = new Textbox[m_pfi.length];
|
||||
m_oldLabel = new String[m_pfi.length];
|
||||
m_chkboxes = new Checkbox[m_pfi.size()];
|
||||
m_textBoxes = new Textbox[m_pfi.size()];
|
||||
m_oldLabel = new String[m_pfi.size()];
|
||||
|
||||
Window wind=new Window();
|
||||
wind.setWidth("90%");
|
||||
|
@ -99,20 +100,21 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
int curCol=0;
|
||||
Rows rows = grid.newRows();
|
||||
org.zkoss.zul.Row row = null;
|
||||
for(int i=0;i<m_pfi.length;i++){
|
||||
int i=0;
|
||||
for (MPrintFormatItem printItem : m_pfi){
|
||||
if(curCol==0){
|
||||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
}
|
||||
m_chkboxes[i] = new Checkbox();
|
||||
m_chkboxes[i].setChecked(m_pfi[i].isPrinted());
|
||||
m_chkboxes[i].setChecked(printItem.isPrinted());
|
||||
m_chkboxes[i].addEventListener(Events.ON_CHECK,this);
|
||||
row.appendChild(m_chkboxes[i]);
|
||||
|
||||
m_textBoxes[i] = new Textbox();
|
||||
String strValue = m_pfi[i].getPrintName();
|
||||
String strValue = printItem.getPrintName();
|
||||
if(strValue ==null || strValue.length()==0){
|
||||
strValue = m_pfi[i].getName();
|
||||
strValue = printItem.getName();
|
||||
}
|
||||
m_oldLabel[i] = strValue;
|
||||
m_textBoxes[i].setText(strValue);
|
||||
|
@ -120,26 +122,26 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
row.appendChild(m_textBoxes[i]);
|
||||
|
||||
curCol++;
|
||||
i++;
|
||||
curCol = curCol%RENDER_IN_COLUMNS;
|
||||
}
|
||||
}
|
||||
|
||||
public void save(){
|
||||
for(int i=0;i<m_pfi.length;i++){
|
||||
m_pfi[i].setIsActive(m_chkboxes[i].isChecked());
|
||||
m_pfi[i].setPrintName(m_textBoxes[i].getText());
|
||||
m_pfi[i].saveEx();
|
||||
int i=0;
|
||||
for (MPrintFormatItem item : m_pfi){
|
||||
item.setIsActive(m_chkboxes[i].isChecked());
|
||||
item.setPrintName(m_textBoxes[i].getText());
|
||||
item.saveEx();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public KeyNamePair[] getChecked(){
|
||||
KeyNamePair [] listcheck=new KeyNamePair[m_pfi.length];
|
||||
KeyNamePair [] listcheck=new KeyNamePair[m_pfi.size()];
|
||||
for(int i=0;i<m_chkboxes.length;i++){
|
||||
if(m_chkboxes[i].isChecked()){
|
||||
int ID=m_pfi[i].get_ID();
|
||||
String name=m_pfi[i].getName();
|
||||
KeyNamePair pair=new KeyNamePair(ID, name);
|
||||
listcheck[i]=pair;
|
||||
listcheck[i]= new KeyNamePair(m_pfi.get(i).get_ID(),m_pfi.get(i).getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -148,8 +150,8 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
@Override
|
||||
public void refresh() {
|
||||
for (int i=0 ; i< m_pfi.length ; i++){
|
||||
m_chkboxes[i].setChecked(m_pfi[i].isPrinted());
|
||||
for (int i=0 ; i< m_pfi.size(); i++){
|
||||
m_chkboxes[i].setChecked(m_pfi.get(i).isPrinted());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,21 +159,21 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
public void updatePFI() {
|
||||
for (int i=0 ;i < m_chkboxes.length ;i++){
|
||||
if(m_chkboxes[i].isChecked()){
|
||||
m_pfi[i].setIsPrinted(true);
|
||||
m_pfi.get(i).setIsPrinted(true);
|
||||
}
|
||||
else{
|
||||
m_pfi[i].setIsPrinted(false);
|
||||
m_pfi.get(i).setIsPrinted(false);
|
||||
}
|
||||
String printname = m_textBoxes[i].getValue();
|
||||
if (!Util.isEmpty(printname))
|
||||
if (! printname.equals(m_pfi[i].getPrintName()))
|
||||
m_pfi[i].setPrintName(m_textBoxes[i].getValue());
|
||||
if (! printname.equals(m_pfi.get(i).getPrintName()))
|
||||
m_pfi.get(i).setPrintName(m_textBoxes[i].getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePrinted(boolean value){
|
||||
for(int j=0 ; j< m_pfi.length ; j++){
|
||||
m_pfi[j].setIsPrinted(value);
|
||||
for(int j=0 ; j< m_pfi.size() ; j++){
|
||||
m_pfi.get(j).setIsPrinted(value);
|
||||
m_chkboxes[j].setChecked(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,10 @@
|
|||
package org.adempiere.webui.panel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.ListHead;
|
||||
|
@ -46,12 +48,12 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private Listbox sortList;
|
||||
private Button bUp = new Button();
|
||||
private Button bDown = new Button();
|
||||
|
||||
private ArrayList<MPrintFormatItem> listColumns=new ArrayList<MPrintFormatItem>();
|
||||
SimpleListModel sortModel;
|
||||
private Listbox sortList;
|
||||
|
||||
public WRC2FieldOrderPanel() {
|
||||
super();
|
||||
|
@ -59,13 +61,9 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
|
||||
public void setListColumns() {
|
||||
listColumns = new ArrayList<MPrintFormatItem>();
|
||||
if (m_pfi != null && m_pfi.length > 0) {
|
||||
for (int i = 0; i < m_pfi.length; i++) {
|
||||
if (m_pfi[i] != null && m_pfi[i].isPrinted()) {
|
||||
listColumns.add(m_pfi[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (MPrintFormatItem item : m_pfi)
|
||||
if(item!=null && item.isPrinted())
|
||||
listColumns.add(item);
|
||||
}
|
||||
|
||||
public void init()
|
||||
|
@ -100,37 +98,21 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
ListItem targetItem = (ListItem) me.getTarget();
|
||||
if (draggedItem.getListbox() == targetItem.getListbox() && draggedItem.getListbox() == sortList)
|
||||
{
|
||||
int draggedIndex = sortList.getIndexOfItem(draggedItem);
|
||||
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||
int targetIndex = sortList.getIndexOfItem(targetItem);
|
||||
ListElement targetElement = (ListElement) sortModel.getElementAt(targetIndex);
|
||||
ListElement draggedElement = (ListElement) sortModel.getElementAt(draggedIndex);
|
||||
|
||||
int firstposition=0, secondposition=0;
|
||||
MPrintFormatItem targetPFI = null;
|
||||
MPrintFormatItem draggedPFI = null;
|
||||
for(int j=0 ;j <m_pfi.length ;j++){
|
||||
if(m_pfi[j].get_ID() == targetElement.getKey()){
|
||||
targetPFI = m_pfi[j];
|
||||
firstposition=j;
|
||||
if (!draggedItem.isSelected())
|
||||
draggedItem.setSelected(true);
|
||||
|
||||
for (Object obj : sortList.getSelectedItems()) {
|
||||
ListItem listItem = (ListItem) obj;
|
||||
int index = sortList.getIndexOfItem(listItem);
|
||||
ListElement selObject = (ListElement)sortModel.getElementAt(index);
|
||||
selObjects.add(selObject);
|
||||
}
|
||||
if(m_pfi[j].get_ID() == draggedElement.getKey()){
|
||||
draggedPFI = m_pfi[j];
|
||||
secondposition=j;
|
||||
}
|
||||
}
|
||||
draggedPFI.setSeqNo(targetPFI.getSeqNo()-5);
|
||||
|
||||
MPrintFormatItem fi=m_pfi[firstposition];
|
||||
m_pfi[firstposition]=m_pfi[secondposition];
|
||||
m_pfi[secondposition]=fi;
|
||||
|
||||
sortModel.removeElement(draggedElement);
|
||||
targetIndex = sortModel.indexOf(targetElement);
|
||||
sortModel.add(targetIndex, draggedElement);
|
||||
|
||||
migrateValueWithinYesList (targetIndex, selObjects);
|
||||
wc.setIsChanged(true);
|
||||
refresh();
|
||||
sortList.setSelectedIndex(targetIndex);
|
||||
if ( sortList.getSelectedItem() != null)
|
||||
{
|
||||
AuFocus focus = new AuFocus(sortList.getSelectedItem());
|
||||
|
@ -168,12 +150,38 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
vbox.appendChild(bDown);
|
||||
vbox.setWidth("50px");
|
||||
vbox.setHflex("60");
|
||||
//vbox.setParent(wind);
|
||||
hlayout.appendChild(vbox);
|
||||
this.appendChild(hlayout);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Move within Yes List with Drag Event and Multiple Choice
|
||||
* @param event event
|
||||
*/
|
||||
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
|
||||
{
|
||||
int iniIndex =0;
|
||||
Arrays.sort(selObjects.toArray());
|
||||
ListElement selObject= null;
|
||||
ListElement endObject = (ListElement)sortModel.getElementAt(endIndex);
|
||||
int targetPFISeq = 0;
|
||||
MPrintFormatItem draggedPFI = null;
|
||||
|
||||
for (ListElement selected : selObjects) {
|
||||
iniIndex = sortModel.indexOf(selected);
|
||||
selObject = (ListElement)sortModel.getElementAt(iniIndex);
|
||||
draggedPFI =listColumns.get(iniIndex);
|
||||
sortModel.removeElement(selObject);
|
||||
listColumns.remove(draggedPFI);
|
||||
endIndex = sortModel.indexOf(endObject);
|
||||
targetPFISeq = listColumns.get(endIndex).getSeqNo();
|
||||
listColumns.add(endIndex, draggedPFI);
|
||||
sortModel.add(endIndex, selObject);
|
||||
draggedPFI.setSeqNo(targetPFISeq - 5);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
|
||||
|
@ -194,25 +202,14 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
if (listColumns.size() > 0 && listColumns != null) {
|
||||
int seq = 10;
|
||||
sortModel.removeAllElements();
|
||||
for (int i=0; i<listColumns.size(); i++) {
|
||||
MPrintFormatItem pfi = listColumns.get(i);
|
||||
if (pfi != null) {
|
||||
for (MPrintFormatItem pfi : listColumns){
|
||||
pfi.setSeqNo(seq);
|
||||
for(int j=0 ;j<m_pfi.length;j++){
|
||||
if(m_pfi[j].get_ID()== pfi.get_ID()){
|
||||
m_pfi[j].setSeqNo(seq);
|
||||
}
|
||||
}
|
||||
seq = seq + 10;
|
||||
int ID = pfi.get_ID();
|
||||
String name=pfi.getPrintName();
|
||||
if(name == null)
|
||||
name=pfi.getName();
|
||||
ListElement element =new ListElement(ID, name, pfi.getSeqNo(), pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
||||
m_pfi.get(m_pfi.indexOf(pfi)).setSeqNo(seq);
|
||||
String name= pfi.getPrintName()== null ? pfi.getName(): pfi.getPrintName() ;
|
||||
ListElement element =new ListElement(pfi.get_ID(), name, pfi.getSeqNo(), pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
||||
sortModel.addElement(element);
|
||||
KeyNamePair pair=new KeyNamePair(ID, name);
|
||||
sortList.addItem(pair);
|
||||
}
|
||||
sortList.addItem(new KeyNamePair(m_pfi.get(m_pfi.indexOf(pfi)).get_ID(), name));
|
||||
seq = seq + 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,9 +233,8 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
return;
|
||||
//
|
||||
int[] indices = sortList.getSelectedIndices();
|
||||
int firstposition=0, secondposition=0;
|
||||
boolean change = false;
|
||||
//
|
||||
MPrintFormatItem orig = null;
|
||||
Object source = event.getTarget();
|
||||
if (source == bUp)
|
||||
{
|
||||
|
@ -246,26 +242,19 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
int index = indices[i];
|
||||
if (index == 0)
|
||||
break;
|
||||
|
||||
ListElement selObject = (ListElement) sortModel.getElementAt(index);
|
||||
ListElement newObject = (ListElement)sortModel.getElementAt(index - 1);
|
||||
|
||||
sortModel.setElementAt(newObject, index);
|
||||
sortModel.setElementAt(selObject, index - 1);
|
||||
for(int j=0 ;j <m_pfi.length ;j++){
|
||||
if(m_pfi[j].get_ID() == selObject.getKey()){
|
||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()-10);
|
||||
firstposition=j;
|
||||
}
|
||||
if(m_pfi[j].get_ID() == newObject.getKey()){
|
||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()+10);
|
||||
secondposition=j;
|
||||
}
|
||||
}
|
||||
|
||||
listColumns.get(index).setSeqNo(listColumns.get(index).getSeqNo()-10);
|
||||
orig = listColumns.get(index);
|
||||
listColumns.get(index - 1).setSeqNo(listColumns.get(index - 1).getSeqNo()+10);
|
||||
listColumns.set(index, listColumns.get(index-1));
|
||||
listColumns.set(index-1 , orig);
|
||||
indices[i] = index - 1;
|
||||
change = true;
|
||||
MPrintFormatItem fi=m_pfi[firstposition];
|
||||
m_pfi[firstposition]=m_pfi[secondposition];
|
||||
m_pfi[secondposition]=fi;
|
||||
}
|
||||
} // up
|
||||
|
||||
|
@ -277,36 +266,24 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
break;
|
||||
ListElement selObject = (ListElement) sortModel.getElementAt(index);
|
||||
ListElement newObject = (ListElement)sortModel.getElementAt(index + 1);
|
||||
/*if (!selObject.isUpdateable() || !newObject.isUpdateable())
|
||||
break;*/
|
||||
|
||||
sortModel.setElementAt(newObject, index);
|
||||
sortModel.setElementAt(selObject, index + 1);
|
||||
sortList.setSelectedIndex(index + 1);
|
||||
for(int j=0 ;j <m_pfi.length ;j++){
|
||||
if(m_pfi[j].get_ID() == selObject.getKey()){
|
||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()+10);
|
||||
firstposition=j;
|
||||
}
|
||||
if(m_pfi[j].get_ID() == newObject.getKey()){
|
||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()-10);
|
||||
secondposition=j;
|
||||
}
|
||||
}
|
||||
//
|
||||
listColumns.get(index).setSeqNo(listColumns.get(index).getSeqNo()+10);
|
||||
orig = m_pfi.get(index);
|
||||
listColumns.get(index + 1).setSeqNo(listColumns.get(index + 1).getSeqNo()-10);
|
||||
listColumns.set(index, listColumns.get(index+1));
|
||||
listColumns.set(index+1,orig);
|
||||
indices[i] = index + 1;
|
||||
change = true;
|
||||
MPrintFormatItem fi=m_pfi[firstposition];
|
||||
m_pfi[firstposition]=m_pfi[secondposition];
|
||||
m_pfi[secondposition]=fi;
|
||||
}
|
||||
} // down
|
||||
|
||||
//
|
||||
if (change) {
|
||||
sortList.setSelectedIndices(indices);
|
||||
int idx = sortList.getSelectedIndex();
|
||||
refresh();
|
||||
wc.setIsChanged(true);
|
||||
sortList.setSelectedIndex(idx);
|
||||
if ( sortList.getSelectedItem() != null)
|
||||
{
|
||||
AuFocus focus = new AuFocus(sortList.getSelectedItem());
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package org.adempiere.webui.panel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -37,6 +38,7 @@ import org.zkoss.zk.ui.event.EventListener;
|
|||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Hlayout;
|
||||
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener<Event>
|
||||
|
@ -53,15 +55,13 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
private Button bRemove = new Button();
|
||||
private Button bUp = new Button();
|
||||
private Button bDown = new Button();
|
||||
|
||||
public ArrayList<MPrintFormatItem> yesItems=new ArrayList<MPrintFormatItem>();
|
||||
public ArrayList<MPrintFormatItem> noItems=new ArrayList<MPrintFormatItem>();
|
||||
|
||||
//
|
||||
SimpleListModel noModel = new SimpleListModel();
|
||||
SimpleListModel yesModel = new SimpleListModel();
|
||||
Listbox noList = new Listbox();
|
||||
Listbox yesList = new Listbox();
|
||||
ArrayList<MPrintFormatItem> yesItems =new ArrayList<MPrintFormatItem>();
|
||||
ArrayList<MPrintFormatItem> noItems =new ArrayList<MPrintFormatItem>();
|
||||
|
||||
public WRC3SortCriteriaPanel() {
|
||||
super();
|
||||
|
@ -111,58 +111,6 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
yesList.setItemDraggable(true);
|
||||
noList.setItemDraggable(true);
|
||||
|
||||
EventListener<Event> yesListMouseMotionListener = new EventListener<Event>()
|
||||
{
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if (event instanceof DropEvent)
|
||||
{
|
||||
DropEvent me = (DropEvent) event;
|
||||
ListItem startItem = (ListItem) me.getDragged();
|
||||
ListItem endItem = (ListItem) me.getTarget();
|
||||
if (startItem.getListbox() == endItem.getListbox() && startItem.getListbox() == yesList)
|
||||
{
|
||||
int startIndex = yesList.getIndexOfItem(startItem);
|
||||
int endIndex = yesList.getIndexOfItem(endItem);
|
||||
ListElement endElement = (ListElement) yesModel.getElementAt(endIndex);
|
||||
ListElement startElement = (ListElement) yesModel.getElementAt(startIndex);
|
||||
yesModel.removeElement(startElement);
|
||||
endIndex = yesModel.indexOf(endElement);
|
||||
yesModel.add(endIndex, startElement);
|
||||
yesList.setSelectedIndex(endIndex);
|
||||
|
||||
int firstposition=0, secondposition=0;
|
||||
MPrintFormatItem targetPFI = null;
|
||||
MPrintFormatItem draggedPFI = null;
|
||||
for(int j=0 ;j <m_pfi.length ;j++){
|
||||
if(m_pfi[j].get_ID() == endElement.getKey()){
|
||||
targetPFI = m_pfi[j];
|
||||
firstposition=j;
|
||||
}
|
||||
if(m_pfi[j].get_ID() == startElement.getKey()){
|
||||
draggedPFI = m_pfi[j];
|
||||
secondposition=j;
|
||||
}
|
||||
}
|
||||
draggedPFI.setSeqNo(targetPFI.getSeqNo()-5);
|
||||
|
||||
wc.setIsChanged(true);
|
||||
updateYesList();
|
||||
MPrintFormatItem fi=m_pfi[firstposition];
|
||||
m_pfi[firstposition]=m_pfi[secondposition];
|
||||
m_pfi[secondposition]=fi;
|
||||
|
||||
if ( yesList.getSelectedItem() != null)
|
||||
{
|
||||
AuFocus focus = new AuFocus(yesList.getSelectedItem());
|
||||
Clients.response(focus);
|
||||
}
|
||||
//setIsChanged(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
yesList.addOnDropListener(yesListMouseMotionListener);
|
||||
|
||||
ListHead listHead = new ListHead();
|
||||
listHead.setParent(yesList);
|
||||
ListHeader listHeader = new ListHeader();
|
||||
|
@ -220,68 +168,53 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
public void setListsColumns() {
|
||||
yesItems =new ArrayList<MPrintFormatItem>();
|
||||
noItems =new ArrayList<MPrintFormatItem>();
|
||||
if (m_pfi.length > 0 && m_pfi != null ) {
|
||||
int seq = 10;
|
||||
for(int i=0 ; i < m_pfi.length ; i++ ){
|
||||
if (m_pfi[i].isPrinted() && m_pfi[i] != null) {
|
||||
if (m_pfi[i].isOrderBy()) {
|
||||
m_pfi[i].setSortNo(seq);
|
||||
seq=seq+10;
|
||||
yesItems.add(m_pfi[i]);
|
||||
for(int i=0 ; i< m_pfi.size();i++){
|
||||
MPrintFormatItem item = m_pfi.get(i);
|
||||
if(item!=null && item.isPrinted()){
|
||||
if(item.isOrderBy()){
|
||||
yesItems.add(item);
|
||||
}else{
|
||||
noItems.add(m_pfi[i]);
|
||||
noItems.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(yesItems, new Comparator<MPrintFormatItem>() {
|
||||
@Override
|
||||
public int compare(MPrintFormatItem o1, MPrintFormatItem o2) {
|
||||
return o1.getSortNo()-o2.getSortNo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
|
||||
this.setListsColumns();
|
||||
yesList.removeAllItems();
|
||||
noList.removeAllItems();
|
||||
|
||||
if (yesItems.size() > 0 && yesItems != null) {
|
||||
yesModel.removeAllElements();
|
||||
for (int i=0 ; i < yesItems.size() ; i++) {
|
||||
MPrintFormatItem pfi = yesItems.get(i);
|
||||
if (pfi != null) {
|
||||
int ID= pfi.get_ID();
|
||||
String name =pfi.getPrintName();
|
||||
if(name == null)
|
||||
name=pfi.getName();
|
||||
KeyNamePair pair =new KeyNamePair(ID, name);
|
||||
yesList.addItem(pair);
|
||||
ListElement element =new ListElement(pfi.get_ID(), pfi.getName(), pfi.getSortNo(), true, pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
||||
yesModel.addElement(element);
|
||||
}
|
||||
int ID= yesItems.get(i).get_ID();
|
||||
String name = yesItems.get(i).getPrintName()==null? yesItems.get(i).getName():yesItems.get(i).getPrintName();
|
||||
yesList.addItem(new KeyNamePair(ID, name));
|
||||
yesModel.addElement(new ListElement(ID, name, yesItems.get(i).getSortNo(), true, yesItems.get(i).getAD_Client_ID(), yesItems.get(i).getAD_Org_ID()));
|
||||
}
|
||||
}
|
||||
|
||||
if (noItems.size() > 0 && noItems != null) {
|
||||
noModel.removeAllElements();
|
||||
for (int i=0 ; i < noItems.size() ; i++) {
|
||||
MPrintFormatItem pfi = noItems.get(i);
|
||||
if (pfi != null) {
|
||||
int ID= pfi.get_ID();
|
||||
pfi.setSortNo(0);
|
||||
pfi.setIsOrderBy(false);
|
||||
String name =pfi.getPrintName();
|
||||
if(name == null)
|
||||
name=pfi.getName();
|
||||
KeyNamePair pair =new KeyNamePair(ID, name);
|
||||
noList.addItem(pair);
|
||||
ListElement element =new ListElement(pfi.get_ID(), pfi.getName(), pfi.getSortNo(), false, pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
||||
noModel.add(i,element);
|
||||
}
|
||||
int ID= noItems.get(i).get_ID();
|
||||
String name = noItems.get(i).getPrintName()== null ? noItems.get(i).getName() : noItems.get(i).getPrintName();
|
||||
noItems.get(i).setSortNo(0);
|
||||
noItems.get(i).setIsOrderBy(false);
|
||||
noList.addItem(new KeyNamePair(ID, name));
|
||||
noModel.add(i,new ListElement(ID, name, noItems.get(i).getSortNo(), false, noItems.get(i).getAD_Client_ID(), noItems.get(i).getAD_Org_ID()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -302,45 +235,104 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
}
|
||||
Listbox listFrom = (source == bAdd || source == noList) ? noList : yesList;
|
||||
Listbox listTo = (source == bAdd || source == noList) ? yesList : noList;
|
||||
SimpleListModel lmFrom = (source == bAdd || source == noList) ?
|
||||
noModel : yesModel;
|
||||
|
||||
int endIndex = yesList.getIndexOfItem(listTo.getSelectedItem());
|
||||
//Listto is empty.
|
||||
if (endIndex<0 )
|
||||
endIndex=0;
|
||||
|
||||
migrateLists (listFrom,listTo,endIndex);
|
||||
} // migrateValueAcrossLists
|
||||
|
||||
void migrateLists (Listbox listFrom , Listbox listTo , int endIndex)
|
||||
{
|
||||
int index = 0;
|
||||
SimpleListModel lmFrom = (listFrom == yesList) ? yesModel:noModel;
|
||||
SimpleListModel lmTo = (lmFrom == yesModel) ? noModel:yesModel;
|
||||
Set<?> selectedItems = listFrom.getSelectedItems();
|
||||
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||
for (Object obj : selectedItems) {
|
||||
ListItem listItem = (ListItem) obj;
|
||||
int index = listFrom.getIndexOfItem(listItem);
|
||||
index = listFrom.getIndexOfItem(listItem);
|
||||
ListElement selObject = (ListElement)lmFrom.getElementAt(index);
|
||||
selObjects.add(selObject);
|
||||
}
|
||||
index = 0;
|
||||
boolean reOrder = false;
|
||||
Arrays.sort(selObjects.toArray());
|
||||
for (ListElement selObject : selObjects)
|
||||
{
|
||||
if (selObject == null)
|
||||
continue;
|
||||
|
||||
lmFrom.removeElement(selObject);
|
||||
lmTo.addElement(selObject);
|
||||
|
||||
for (int j=0 ; j<m_pfi.length ; j++) {
|
||||
if (m_pfi[j].get_ID() == selObject.m_key) {
|
||||
lmTo.add(endIndex, selObject);
|
||||
index = m_pfi.indexOf(getPrintFormatItem(selObject.m_key));
|
||||
if(listFrom.equals(noList)) {
|
||||
m_pfi[j].setIsOrderBy(true);
|
||||
m_pfi.get(index).setIsOrderBy(true);
|
||||
reOrder =true;
|
||||
}else{
|
||||
m_pfi[j].setIsOrderBy(false);
|
||||
m_pfi.get(index).setIsOrderBy(false);
|
||||
}
|
||||
}
|
||||
if(reOrder){
|
||||
int sortNo =10;
|
||||
ArrayList<ListElement> pp = new ArrayList<ListElement>();
|
||||
for(int i=0 ; i<lmTo.getSize(); i++) {
|
||||
ListElement aux = (ListElement)lmTo.getElementAt(i);
|
||||
aux.setSortNo(sortNo);
|
||||
sortNo =+10;
|
||||
pp.add(aux);
|
||||
}
|
||||
Collections.sort(pp, new Comparator<ListElement>() {
|
||||
@Override
|
||||
public int compare(ListElement o1, ListElement o2) {
|
||||
return o1.getSortNo()-o2.getSortNo();
|
||||
}
|
||||
});
|
||||
for(ListElement ele : pp) {
|
||||
int auxIndex = m_pfi.indexOf(getPrintFormatItem(ele.m_key));
|
||||
m_pfi.get(auxIndex).setSortNo(sortNo);
|
||||
sortNo = sortNo + 10;
|
||||
}
|
||||
wc.setIsChanged(true);
|
||||
}
|
||||
|
||||
refresh();
|
||||
if ( listTo.getSelectedItem() != null)
|
||||
{
|
||||
AuFocus focus = new AuFocus(listTo.getSelectedItem());
|
||||
Clients.response(focus);
|
||||
}
|
||||
}
|
||||
|
||||
} // migrateValueAcrossLists
|
||||
/**
|
||||
* Move within Yes List with Drag Event and Multiple Choice
|
||||
* @param event event
|
||||
*/
|
||||
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
|
||||
{
|
||||
int iniIndex =0;
|
||||
Arrays.sort(selObjects.toArray());
|
||||
ListElement selObject= null;
|
||||
ListElement endObject = (ListElement)yesModel.getElementAt(endIndex);
|
||||
for (ListElement selected : selObjects) {
|
||||
iniIndex = yesModel.indexOf(selected);
|
||||
selObject = (ListElement)yesModel.getElementAt(iniIndex);
|
||||
yesModel.removeElement(selObject);
|
||||
endIndex = yesModel.indexOf(endObject);
|
||||
yesModel.add(endIndex, selObject);
|
||||
}
|
||||
int sortNo = 10;
|
||||
int auxIndex =0;
|
||||
yesList.removeAllItems();
|
||||
for(int i=0 ; i<yesModel.getSize(); i++) {
|
||||
ListElement pp = (ListElement)yesModel.getElementAt(i);
|
||||
auxIndex = m_pfi.indexOf(getPrintFormatItem(pp.m_key));
|
||||
m_pfi.get(auxIndex).setSortNo(sortNo);
|
||||
yesList.addItem(new KeyNamePair(pp.m_key, pp.getName()));
|
||||
sortNo = sortNo + 10;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move within Yes List
|
||||
|
@ -358,7 +350,8 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
int[] indices = yesList.getSelectedIndices();
|
||||
//
|
||||
boolean change = false;
|
||||
//
|
||||
int selectedPI = 0 , targetPI = 0;
|
||||
MPrintFormatItem orig = null;
|
||||
Object source = event.getTarget();
|
||||
if (source == bUp)
|
||||
{
|
||||
|
@ -371,6 +364,18 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
yesModel.setElementAt(newObject, index);
|
||||
yesModel.setElementAt(selObject, index - 1);
|
||||
yesList.setSelectedIndex(index - 1);
|
||||
|
||||
selectedPI = m_pfi.indexOf(getPrintFormatItem(selObject.m_key));
|
||||
targetPI = m_pfi.indexOf(getPrintFormatItem(newObject.m_key));
|
||||
updateSortNo (selectedPI,targetPI);
|
||||
|
||||
yesItems.get(index).setSortNo(yesItems.get(index).getSortNo()-10);
|
||||
orig = yesItems.get(index);
|
||||
yesItems.get(index - 1).setSeqNo(yesItems.get(index - 1).getSeqNo()+10);
|
||||
yesItems.set(index, yesItems.get(index-1));
|
||||
yesItems.set(index-1 , orig);
|
||||
|
||||
indices[i] = index - 1;
|
||||
change = true;
|
||||
}
|
||||
|
@ -388,6 +393,17 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
yesModel.setElementAt(newObject, index);
|
||||
yesModel.setElementAt(selObject, index + 1);
|
||||
yesList.setSelectedIndex(index + 1);
|
||||
|
||||
selectedPI = m_pfi.indexOf(getPrintFormatItem(selObject.m_key));
|
||||
targetPI = m_pfi.indexOf(getPrintFormatItem(newObject.m_key));
|
||||
updateSortNo (selectedPI,targetPI);
|
||||
|
||||
yesItems.get(index).setSeqNo(yesItems.get(index).getSeqNo()+10);
|
||||
orig = m_pfi.get(index);
|
||||
yesItems.get(index + 1).setSeqNo(yesItems.get(index + 1).getSeqNo()-10);
|
||||
yesItems.set(index, yesItems.get(index+1));
|
||||
yesItems.set(index+1,orig);
|
||||
|
||||
indices[i] = index + 1;
|
||||
change = true;
|
||||
}
|
||||
|
@ -395,8 +411,12 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
//
|
||||
if (change) {
|
||||
yesList.setSelectedIndices(indices);
|
||||
updateYesList();
|
||||
yesList.removeAllItems();
|
||||
for(int i=0 ; i<yesModel.getSize(); i++) {
|
||||
ListElement pp = (ListElement)yesModel.getElementAt(i);
|
||||
yesList.addItem(new KeyNamePair(pp.m_key, pp.getName()));
|
||||
}
|
||||
wc.setIsChanged(true);
|
||||
if ( yesList.getSelectedItem() != null)
|
||||
{
|
||||
AuFocus focus = new AuFocus(yesList.getSelectedItem());
|
||||
|
@ -405,23 +425,15 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
}
|
||||
} // migrateValueWithinYesList
|
||||
|
||||
public void updateYesList(){
|
||||
yesList.removeAllItems();
|
||||
wc.setIsChanged(true);
|
||||
int sortNo=10;
|
||||
for(int i=0;i<yesModel.getSize();i++){
|
||||
ListElement obj=(ListElement) yesModel.getElementAt(i);
|
||||
for(int j=0;j<m_pfi.length;j++){
|
||||
if(m_pfi[j].get_ID() == obj.getKey()){
|
||||
String name=obj.getName();
|
||||
int ID=obj.getKey();
|
||||
KeyNamePair pair=new KeyNamePair(ID, name);
|
||||
yesList.addItem(pair);
|
||||
m_pfi[j].setSortNo(sortNo);
|
||||
sortNo=sortNo+10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int selIndexPI,int targetIndexPI
|
||||
*/
|
||||
private void updateSortNo(int selIndexPI,int targetIndexPI)
|
||||
{
|
||||
int selSortNo = m_pfi.get(selIndexPI).getSortNo();
|
||||
m_pfi.get(selIndexPI).setSortNo(m_pfi.get(targetIndexPI).getSortNo());
|
||||
m_pfi.get(targetIndexPI).setSortNo(selSortNo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -520,44 +532,35 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
}
|
||||
|
||||
public void onEvent(Event event) throws Exception {
|
||||
int endIndex=0;
|
||||
if (event instanceof DropEvent)
|
||||
{
|
||||
int endIndex = 0;
|
||||
DropEvent me = (DropEvent) event;
|
||||
|
||||
ListItem endItem = (ListItem) me.getTarget();
|
||||
if (!(endItem.getListbox() == yesList))
|
||||
{
|
||||
return; // move within noList
|
||||
}
|
||||
|
||||
ListItem startItem = (ListItem) me.getDragged();
|
||||
if (startItem.getListbox() == endItem.getListbox())
|
||||
|
||||
if (!startItem.isSelected())
|
||||
startItem.setSelected(true);
|
||||
|
||||
if (!(startItem.getListbox() == endItem.getListbox()))
|
||||
{
|
||||
return; //move within same list
|
||||
}
|
||||
int startIndex = noList.getIndexOfItem(startItem);
|
||||
ListElement element = (ListElement) noModel.getElementAt(startIndex);
|
||||
noModel.removeElement(element);
|
||||
Listbox listFrom = (Listbox)startItem.getListbox();
|
||||
Listbox listTo = (Listbox)endItem.getListbox();
|
||||
endIndex = yesList.getIndexOfItem(endItem);
|
||||
yesModel.add(endIndex, element);
|
||||
|
||||
for (int j=0 ; j<m_pfi.length ; j++) {
|
||||
if (m_pfi[j].get_ID() == element.m_key) {
|
||||
m_pfi[j].setIsOrderBy(true);
|
||||
m_pfi[j].setSortNo(endIndex*10);
|
||||
migrateLists (listFrom,listTo,endIndex);
|
||||
}else if (startItem.getListbox() == endItem.getListbox() && startItem.getListbox() == yesList)
|
||||
{
|
||||
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||
endIndex = yesList.getIndexOfItem(endItem);
|
||||
for (Object obj : yesList.getSelectedItems()) {
|
||||
ListItem listItem = (ListItem) obj;
|
||||
int index = yesList.getIndexOfItem(listItem);
|
||||
ListElement selObject = (ListElement)yesModel.getElementAt(index);
|
||||
selObjects.add(selObject);
|
||||
}
|
||||
migrateValueWithinYesList (endIndex, selObjects);
|
||||
}
|
||||
}
|
||||
wc.setIsChanged(true);
|
||||
}
|
||||
|
||||
refresh();
|
||||
//
|
||||
noList.clearSelection();
|
||||
yesList.clearSelection();
|
||||
|
||||
yesList.setSelectedIndex(endIndex);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,9 +48,9 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
|||
@Override
|
||||
public void refresh() {
|
||||
orderfield = new ArrayList<MPrintFormatItem>();
|
||||
for(int i=0 ; i < m_pfi.length ; i++){
|
||||
if(m_pfi[i] != null && m_pfi[i].isOrderBy() && m_pfi[i].isPrinted()){
|
||||
orderfield.add(m_pfi[i]);
|
||||
for(int i=0 ; i < m_pfi.size(); i++){
|
||||
if(m_pfi.get(i) != null && m_pfi.get(i).isOrderBy() && m_pfi.get(i).isPrinted()){
|
||||
orderfield.add(m_pfi.get(i));
|
||||
}
|
||||
}
|
||||
dynamicInit();
|
||||
|
@ -59,11 +59,8 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
|||
@Override
|
||||
public void updatePFI() {
|
||||
for(int i=0 ; i<orderfield.size() ; i++){
|
||||
for(int j=0 ;j<m_pfi.length ; j++){
|
||||
if(orderfield.get(i).get_ID() == m_pfi[j].get_ID()){
|
||||
m_pfi[j].setIsGroupBy(m_chkboxes[i].isChecked());
|
||||
}
|
||||
}
|
||||
int j = m_pfi.indexOf(getPrintFormatItem(orderfield.get(i).get_ID()));
|
||||
m_pfi.get(j).setIsGroupBy(m_chkboxes[i].isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +99,6 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
|||
columns.appendChild(cols[i+1]);
|
||||
}
|
||||
grid.appendChild(columns);
|
||||
|
||||
this.appendChild(wind);
|
||||
wind.appendChild(grid);
|
||||
}
|
||||
|
|
|
@ -84,9 +84,9 @@ public class WRC5SummaryFieldsPanel extends WRCTabPanel implements EventListener
|
|||
@Override
|
||||
public void refresh() {
|
||||
DisplayItems = new ArrayList<MPrintFormatItem>();
|
||||
for(int i=0 ; i<m_pfi.length ; i ++){
|
||||
if(m_pfi[i] != null && m_pfi[i].isPrinted()){
|
||||
DisplayItems.add(m_pfi[i]);
|
||||
for(int i=0 ; i<m_pfi.size() ; i ++){
|
||||
if(m_pfi.get(i) != null && m_pfi.get(i).isPrinted()){
|
||||
DisplayItems.add(m_pfi.get(i));
|
||||
}
|
||||
}
|
||||
dynamicInit();
|
||||
|
@ -95,17 +95,14 @@ public class WRC5SummaryFieldsPanel extends WRCTabPanel implements EventListener
|
|||
@Override
|
||||
public void updatePFI() {
|
||||
for(int i=0 ;i<DisplayItems.size() ; i++){
|
||||
for(int j=0 ; j<m_pfi.length ; j++){
|
||||
if(DisplayItems.get(i).get_ID() == m_pfi[j].get_ID()){
|
||||
m_pfi[j].setIsSummarized(m_chkSum[i].isChecked());
|
||||
m_pfi[j].setIsCounted(m_chkCount[i].isChecked());
|
||||
m_pfi[j].setIsMinCalc(m_chkMin[i].isChecked());
|
||||
m_pfi[j].setIsMaxCalc(m_chkMax[i].isChecked());
|
||||
m_pfi[j].setIsAveraged(m_chkMean[i].isChecked());
|
||||
m_pfi[j].setIsVarianceCalc(m_chkVariance[i].isChecked());
|
||||
m_pfi[j].setIsDeviationCalc(m_chkDesviation[i].isChecked());
|
||||
}
|
||||
}
|
||||
int j = m_pfi.indexOf(getPrintFormatItem(DisplayItems.get(i).get_ID()));
|
||||
m_pfi.get(j).setIsSummarized(m_chkSum[i].isChecked());
|
||||
m_pfi.get(j).setIsCounted(m_chkCount[i].isChecked());
|
||||
m_pfi.get(j).setIsMinCalc(m_chkMin[i].isChecked());
|
||||
m_pfi.get(j).setIsMaxCalc(m_chkMax[i].isChecked());
|
||||
m_pfi.get(j).setIsAveraged(m_chkMean[i].isChecked());
|
||||
m_pfi.get(j).setIsVarianceCalc(m_chkVariance[i].isChecked());
|
||||
m_pfi.get(j).setIsDeviationCalc(m_chkDesviation[i].isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,14 @@
|
|||
|
||||
package org.adempiere.webui.panel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.adempiere.webui.apps.form.WReportCustomization;
|
||||
import org.adempiere.webui.component.Tabpanel;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MField;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
|
||||
|
@ -25,9 +31,10 @@ public abstract class WRCTabPanel extends Tabpanel {
|
|||
*/
|
||||
private static final long serialVersionUID = -6858669581232541371L;
|
||||
|
||||
public MPrintFormatItem[] m_pfi;
|
||||
public ArrayList<MPrintFormatItem> m_pfi;
|
||||
public MPrintFormat m_pf;
|
||||
public WReportCustomization wc;
|
||||
public Map<Integer, MPrintFormatItem> mapPFormatItem = new HashMap<Integer, MPrintFormatItem>();
|
||||
|
||||
public abstract void refresh();
|
||||
|
||||
|
@ -35,9 +42,12 @@ public abstract class WRCTabPanel extends Tabpanel {
|
|||
|
||||
public void setMPrintFormat(MPrintFormat pf) {
|
||||
m_pf=pf;
|
||||
for (MPrintFormatItem item : m_pf.getAllItems() ){
|
||||
mapPFormatItem.put(item.get_ID(), item);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPrintFormatItems(MPrintFormatItem[] pfis) {
|
||||
public void setPrintFormatItems(ArrayList<MPrintFormatItem> pfis) {
|
||||
m_pfi = pfis;
|
||||
}
|
||||
|
||||
|
@ -45,4 +55,8 @@ public abstract class WRCTabPanel extends Tabpanel {
|
|||
wc=parent;
|
||||
}
|
||||
|
||||
public MPrintFormatItem getPrintFormatItem(int AD_PrintFormatItem_ID) {
|
||||
return mapPFormatItem.get(AD_PrintFormatItem_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue