- Archived documents/reports implemented

- Report viewer implemented
- Advanced search criteria implemented
This commit is contained in:
Heng Sin Low 2008-08-01 04:58:25 +00:00
parent 37fd8920d0
commit fc522d72bb
23 changed files with 2550 additions and 241 deletions

View File

@ -518,7 +518,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
"Notice : " + noOfNotice + ", Request : " + noOfRequest + ", Workflow Activities : " + noOfWorkflow);
}
public void addWindow2TabPanel(Window window)
public void showWindowInTabPanel(Window window)
{
Tabpanel tabPanel = new Tabpanel();
window.setParent(tabPanel);

View File

@ -26,4 +26,5 @@ public interface IDesktop {
public void unregisterWindow(int windowNo);
public void showWindowInTabPanel(Window win); // Elaine 2008/07/30
}

View File

@ -0,0 +1,170 @@
package org.adempiere.webui;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import org.adempiere.webui.apps.form.WArchiveViewer;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MBPartner;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.Component;
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.Menuitem;
import org.zkoss.zul.Menupopup;
/**
* Archive Button Consequences.
* Popup Menu
*
* @author Jorg Janke
* @version $Id: AArchive.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
*/
public class WArchive implements EventListener
{
/**
* Constructor
* @param invoker button
* @param AD_Table_ID table
* @param Record_ID record
*/
public WArchive (Component invoker, int AD_Table_ID, int Record_ID)
{
log.config("AD_Table_ID=" + AD_Table_ID + ", Record_ID=" + Record_ID);
m_AD_Table_ID = AD_Table_ID;
m_Record_ID = Record_ID;
getArchives(invoker);
}
/** The Table */
private int m_AD_Table_ID;
/** The Record */
private int m_Record_ID;
/** The Popup */
private Menupopup m_popup = new Menupopup();
private Menuitem m_reports = null;
private Menuitem m_reportsAll = null;
private Menuitem m_documents = null;
// private JPopupMenu m_popup = new JPopupMenu("ArchiveMenu");
/** Where Clause */
StringBuffer m_where = null;
/** Logger */
private static CLogger log = CLogger.getCLogger (WArchive.class);
/**
* Display Request Options - New/Existing.
* @param invoker button
*/
private void getArchives(Component invoker)
{
int reportCount = 0;
int documentCount = 0;
m_where = new StringBuffer();
m_where.append("(AD_Table_ID=").append(m_AD_Table_ID)
.append(" AND Record_ID=").append(m_Record_ID)
.append(")");
// Get all for BP
if (m_AD_Table_ID == MBPartner.Table_ID)
m_where.append(" OR C_BPartner_ID=").append(m_Record_ID);
//
StringBuffer sql = new StringBuffer("SELECT IsReport, COUNT(*) FROM AD_Archive ")
.append("WHERE (AD_Table_ID=? AND Record_ID=?) ");
if (m_AD_Table_ID == MBPartner.Table_ID)
sql.append(" OR C_BPartner_ID=?");
sql.append(" GROUP BY IsReport");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql.toString(), null);
pstmt.setInt(1, m_AD_Table_ID);
pstmt.setInt(2, m_Record_ID);
if (m_AD_Table_ID == MBPartner.Table_ID)
pstmt.setInt(3, m_Record_ID);
rs = pstmt.executeQuery ();
while (rs.next ())
{
if ("Y".equals(rs.getString(1)))
reportCount += rs.getInt(2);
else
documentCount += rs.getInt(2);
}
}
catch (Exception e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
//
if (documentCount > 0)
{
m_documents = new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedDocuments")
+ " (" + documentCount + ")");
m_documents.addEventListener(Events.ON_CLICK, this);
m_popup.appendChild(m_documents);
}
if (reportCount > 0)
{
m_reports = new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedReports")
+ " (" + reportCount + ")");
m_reports.addEventListener(Events.ON_CLICK, this);
m_popup.appendChild(m_reports);
}
// All Reports
String sql1 = "SELECT COUNT(*) FROM AD_Archive WHERE AD_Table_ID=? AND IsReport='Y'";
int allReports = DB.getSQLValue(null, sql1, m_AD_Table_ID);
if (allReports > 0)
{
m_reportsAll = new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedReportsAll")
+ " (" + reportCount + ")");
m_reportsAll.addEventListener(Events.ON_CLICK, this);
m_popup.appendChild(m_reportsAll);
}
if (documentCount == 0 && reportCount == 0 && allReports == 0)
m_popup.appendChild(new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedNone")));
//
m_popup.setPage(invoker.getPage());
m_popup.open(invoker);
} // getZoomTargets
/**
* Listner
* @param e event
*/
public void onEvent(Event e) throws Exception
{
if (e.getTarget() instanceof Menuitem)
{
int AD_Form_ID = 118; // ArchiveViewer
Window form = ADForm.openForm(AD_Form_ID);
WArchiveViewer av = (WArchiveViewer) form;
if (e.getTarget() == m_documents)
av.query(false, m_AD_Table_ID, m_Record_ID);
else if (e.getTarget() == m_reports)
av.query(true, m_AD_Table_ID, m_Record_ID);
else // all Reports
av.query(true, m_AD_Table_ID, 0);
SessionManager.getAppDesktop().showWindowInTabPanel(form);
}
}
}

View File

@ -969,17 +969,9 @@ public class WAcctViewer extends Window implements EventListener
else
{
Listhead listhead = table.getListhead();
// remove existing column header
for (int i = listhead.getChildren().size() - 1; i >= 0; i--)
{
Object o = listhead.getChildren().get(i);
if(o instanceof Listheader)
{
Listheader listheader = (Listheader) o;
listhead.removeChild(listheader);
}
}
listhead.getChildren().clear();
// add in new column header
for (int i = 0; i < rmodel.getColumnCount(); i++)

View File

@ -23,7 +23,6 @@ import java.util.logging.Level;
import javax.sql.RowSet;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.window.FDialog;
import org.compiere.apps.ProcessCtl;
import org.compiere.model.MQuery;
@ -35,14 +34,15 @@ import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportCtl;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.util.ASyncProcess;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.zkoss.zk.ui.Component;
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.ListModelList;
import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Menupopup;
/**
* Base on org.compiere.print.AReport
@ -72,7 +72,7 @@ public class WReport implements EventListener {
* @param parent The invoking parent window
* @param WindowNo The invoking parent window number
*/
public WReport (int AD_Table_ID, MQuery query, ASyncProcess parent,
public WReport (int AD_Table_ID, MQuery query, Component parent,
int WindowNo)
{
log.config("AD_Table_ID=" + AD_Table_ID + " " + query);
@ -94,13 +94,13 @@ public class WReport implements EventListener {
private MQuery m_query;
/** The Popup */
private Listbox m_listbox;
private Window m_popup;
private Menupopup m_popup;
/** The Option List */
private ArrayList<KeyNamePair> m_list = new ArrayList<KeyNamePair>();
/** Logger */
private static CLogger log = CLogger.getCLogger(AReport.class);
/** The parent window for locking/unlocking during process execution */
ASyncProcess parent;
Component parent;
/** The parent window number */
int WindowNo;
@ -148,17 +148,17 @@ public class WReport implements EventListener {
} // getPrintFormats
private void showPopup() {
m_listbox = new Listbox();
m_listbox.setModel(ListModelList.instance(m_list));
m_listbox.addEventListener(Events.ON_SELECT, this);
m_listbox.setHeight("300px");
m_popup = new Window();
m_popup.setTitle("Select Report");
m_popup.appendChild(m_listbox);
m_popup.setAttribute("mode", "popup");
m_popup.setWidth("200px");
m_popup.setPosition("center");
AEnv.showWindow(m_popup);
m_popup = new Menupopup();
for(int i = 0; i < m_list.size(); i++)
{
KeyNamePair pp = (KeyNamePair) m_list.get(i);
Menuitem menuitem = new Menuitem(pp.getName());
menuitem.setValue(i + "");
menuitem.addEventListener(Events.ON_CLICK, this);
m_popup.appendChild(menuitem);
}
m_popup.setPage(parent.getPage());
m_popup.open(parent);
}
/**
@ -213,7 +213,7 @@ public class WReport implements EventListener {
ProcessInfo pi = new ProcessInfo ("", pf.getJasperProcess_ID());
// Execute Process
ProcessCtl worker = ProcessCtl.process(parent, WindowNo, pi, null);
ProcessCtl worker = ProcessCtl.process(null, WindowNo, pi, null);
}
else
{
@ -238,14 +238,10 @@ public class WReport implements EventListener {
}
public void onEvent(Event event) {
if (event.getTarget() == m_listbox) {
int i = m_listbox.getSelectedIndex();
if (i >= 0 ) {
KeyNamePair pp = (KeyNamePair)m_list.get(i);
m_popup.setVisible(false);
m_popup.detach();
launchReport (pp);
}
}
if(event.getTarget() instanceof Menuitem)
{
Menuitem mi = (Menuitem) event.getTarget();
launchReport(m_list.get(Integer.parseInt(mi.getValue().toString())));
}
}
}

View File

@ -28,20 +28,21 @@ import java.util.logging.Level;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Tab;
import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.component.WConfirmPanel;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.panel.ADForm;
@ -62,9 +63,9 @@ import org.zkoss.util.media.AMedia;
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.Hbox;
import org.zkoss.zul.Iframe;
import org.zkoss.zul.Separator;
/**
* Archive Viewer
@ -96,14 +97,14 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
private static CLogger log = CLogger.getCLogger(WArchiveViewer.class);
private VerticalBox queryPanel = new VerticalBox();
// private Vbox queryPanel = new Vbox();
private Checkbox reportField = new Checkbox();
private Label processLabel = new Label(Msg.translate(Env.getCtx(), "AD_Process_ID"));
private Listbox processField = new Listbox();
private Label tableLabel = new Label(Msg.translate(Env.getCtx(), "AD_Table_ID"));
private Listbox tableField = new Listbox();
private Label bPartnerLabel = new Label(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
private WEditor bPartnerField = null;
private WSearchEditor bPartnerField = null;
private Label nameQLabel = new Label(Msg.translate(Env.getCtx(), "Name"));
private Textbox nameQField = new Textbox();
private Label descriptionQLabel = new Label(Msg.translate(Env.getCtx(), "Description"));
@ -116,7 +117,7 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
private Datebox createdQFrom = new Datebox();
private Datebox createdQTo = new Datebox();
private VerticalBox viewEnterPanel = new VerticalBox();
// private Vbox viewEnterPanel = new Vbox();
private Button bBack = new Button();
private Button bNext = new Button();
private Label positionInfo = new Label(".");
@ -125,12 +126,12 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
private Datebox createdField = new Datebox();
private Label nameLabel = new Label(Msg.translate(Env.getCtx(), "Name"));
private Textbox nameField = new Textbox("Name");
private Textbox nameField = new Textbox();
private Label descriptionLabel = new Label(Msg.translate(Env.getCtx(), "Description"));
private Textbox descriptionField = new Textbox("Description");
private Textbox descriptionField = new Textbox();
private Label helpLabel = new Label(Msg.translate(Env.getCtx(), "Help"));
private Textbox helpField = new Textbox("Help");
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private Textbox helpField = new Textbox();
private WConfirmPanel confirmPanel = new WConfirmPanel(true);
private Button updateArchive = new Button();
private Tabbox tabbox = new Tabbox();
@ -138,6 +139,7 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
private Tabpanels tabpanels = new Tabpanels();
private Iframe iframe = new Iframe();
private Button bRefresh = new Button();
public WArchiveViewer()
{
@ -232,17 +234,16 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
MLookup lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo,
0, 2762, DisplayType.Search);
bPartnerField = new WTableDirEditor(lookup, Msg.translate(
bPartnerField = new WSearchEditor(lookup, Msg.translate(
Env.getCtx(), "C_BPartner_ID"), "", true, false, true);
bPartnerField.addValueChangeListner(this);
} // dynInit
private void reportViewer(byte[] data)
{
AMedia media = new AMedia("Archive Viewer", "pdf", "application/pdf", data);
iframe.setContent(media);
iframe.invalidate();
}
/**
@ -253,8 +254,10 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
private void jbInit() throws Exception
{
tabbox.setWidth("100%");
tabbox.setHeight("90%");
tabbox.appendChild(tabs);
tabbox.appendChild(tabpanels);
tabbox.addEventListener(Events.ON_SELECT, this);
processField.setMold("select");
processField.setRows(1);
@ -265,131 +268,227 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
createdByQField.setMold("select");
createdByQField.setRows(1);
updateArchive.setImage("/images/Ok24.gif");
updateArchive.setTooltiptext("Save Archive");
updateArchive.addEventListener(Events.ON_CLICK, this);
bRefresh.setImage("/images/Refresh24.gif");
bRefresh.setTooltiptext("Refresh");
bRefresh.addEventListener(Events.ON_CLICK, this);
bBack.setImage("/images/Parent24.gif");
bBack.setTooltiptext("Back");
bBack.addEventListener(Events.ON_CLICK, this);
bNext.setImage("/images/Detail24.gif");
bNext.setTooltiptext("Next");
bNext.addEventListener(Events.ON_CLICK, this);
nameField.addEventListener(Events.ON_CHANGE, this);
descriptionField.addEventListener(Events.ON_SELECT, this);
helpField.addEventListener(Events.ON_SELECT, this);
updateArchive.addEventListener(Events.ON_CLICK, this);
reportField.setLabel(Msg.translate(Env.getCtx(), "IsReport"));
reportField.addEventListener(Events.ON_CLICK, this);
Hbox boxProcess = new Hbox();
boxProcess.setWidth("100%");
boxProcess.setWidth("30%, 70%");
boxProcess.appendChild(processLabel);
boxProcess.appendChild(processField);
Hbox boxBPartner = new Hbox();
boxBPartner.setWidth("100%");
boxBPartner.setWidths("30%, 70%");
boxBPartner.appendChild(bPartnerLabel);
boxBPartner.appendChild(bPartnerField.getComponent());
Hbox boxTable = new Hbox();
boxTable.setWidth("100%");
boxTable.setWidths("30%, 70%");
boxTable.appendChild(tableLabel);
boxTable.appendChild(tableField);
Hbox boxNameQ = new Hbox();
boxNameQ.setWidth("100%");
boxNameQ.setWidths("30%, 70%");
boxNameQ.appendChild(nameQLabel);
boxNameQ.appendChild(nameQField);
Grid gridQuery = new Grid();
gridQuery.setWidth("500px");
gridQuery.setStyle("margin:0; padding:0;");
gridQuery.setSclass("grid-no-striped");
gridQuery.setOddRowSclass("even");
Rows rows = new Rows();
gridQuery.appendChild(rows);
Hbox boxDescritionQ = new Hbox();
boxDescritionQ.setWidth("100%");
boxDescritionQ.setWidths("30%, 70%");
boxDescritionQ.appendChild(descriptionQLabel);
boxDescritionQ.appendChild(descriptionQField);
Row row = new Row();
rows.appendChild(row);
row.setSpans("3");
row.setAlign("right");
row.appendChild(reportField);
Hbox boxHelpQ = new Hbox();
boxHelpQ.setWidth("100%");
boxHelpQ.setWidths("30%, 70%");
boxHelpQ.appendChild(helpQLabel);
boxHelpQ.appendChild(helpQField);
row = new Row();
rows.appendChild(row);
row.setSpans("1, 2");
Div div = new Div();
div.setAlign("right");
div.appendChild(processLabel);
row.appendChild(div);
row.appendChild(processField);
processField.setWidth("100%");
Hbox boxCreatedBy = new Hbox();
boxCreatedBy.setWidth("100%");
boxCreatedBy.setWidths("30%, 70%");
boxCreatedBy.appendChild(createdByQLabel);
boxCreatedBy.appendChild(createdByQField);
row = new Row();
rows.appendChild(row);
row.setSpans("1, 2");
div = new Div();
div.setAlign("right");
div.appendChild(bPartnerLabel);
row.appendChild(div);
row.appendChild(bPartnerField.getComponent());
Hbox boxCreatedQ = new Hbox();
boxCreatedQ.setWidth("100%");
boxCreatedQ.setWidths("30%, 35%, 35%");
boxCreatedQ.appendChild(createdQLabel);
boxCreatedQ.appendChild(createdQFrom);
boxCreatedQ.appendChild(createdQTo);
row = new Row();
rows.appendChild(row);
row.setSpans("1, 2");
div = new Div();
div.setAlign("right");
div.appendChild(tableLabel);
row.appendChild(div);
row.appendChild(tableField);
tableField.setWidth("100%");
queryPanel.setWidth("50%");
queryPanel.appendChild(reportField);
queryPanel.appendChild(boxProcess);
queryPanel.appendChild(boxBPartner);
queryPanel.appendChild(boxTable);
queryPanel.appendChild(boxNameQ);
queryPanel.appendChild(boxDescritionQ);
queryPanel.appendChild(boxHelpQ);
queryPanel.appendChild(boxCreatedBy);
queryPanel.appendChild(boxCreatedQ);
row = new Row();
rows.appendChild(row);
row.setSpans("1, 2");
div = new Div();
div.setAlign("right");
div.appendChild(nameQLabel);
row.appendChild(div);
row.appendChild(nameQField);
nameQField.setWidth("100%");
row = new Row();
rows.appendChild(row);
row.setSpans("1, 2");
div = new Div();
div.setAlign("right");
div.appendChild(descriptionQLabel);
row.appendChild(div);
row.appendChild(descriptionQField);
descriptionQField.setWidth("100%");
row = new Row();
rows.appendChild(row);
row.setSpans("1, 2");
div = new Div();
div.setAlign("right");
div.appendChild(helpQLabel);
row.appendChild(div);
row.appendChild(helpQField);
helpQField.setWidth("100%");
row = new Row();
rows.appendChild(row);
row.setSpans("1, 2");
div = new Div();
div.setAlign("right");
div.appendChild(createdByQLabel);
row.appendChild(div);
row.appendChild(createdByQField);
createdByQField.setWidth("100%");
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(createdQLabel);
row.appendChild(div);
row.appendChild(createdQFrom);
createdQFrom.setWidth("100%");
row.appendChild(createdQTo);
createdQTo.setWidth("100%");
div = new Div();
div.setAlign("center");
div.appendChild(gridQuery);
Tabpanel tabQueryPanel = new Tabpanel();
tabQueryPanel.appendChild(queryPanel);
tabQueryPanel.appendChild(div);
Tab tabQuery = new Tab("Query");
tabpanels.appendChild(tabQueryPanel);
tabs.appendChild(tabQuery);
Grid gridView = new Grid();
gridView.setStyle("margin:0; padding:0;");
gridView.setSclass("grid-no-striped");
gridView.setOddRowSclass("even");
rows = new Rows();
gridView.appendChild(rows);
row = new Row();
rows.appendChild(row);
row.setSpans("1, 2, 1");
div = new Div();
div.setAlign("left");
div.appendChild(bBack);
row.appendChild(div);
div = new Div();
div.setAlign("center");
div.appendChild(positionInfo);
row.appendChild(div);
div = new Div();
div.setAlign("right");
div.appendChild(bNext);
row.appendChild(div);
bBack.addEventListener(Events.ON_CLICK, this);
bNext.addEventListener(Events.ON_CLICK, this);
row = new Row();
rows.appendChild(row);
row.setSpans("4");
row.appendChild(createdByLabel);
createdByLabel.setWidth("100%");
Hbox boxViewEnter = new Hbox();
row = new Row();
rows.appendChild(row);
row.setSpans("4");
row.appendChild(createdByField);
createdByField.setWidth("100%");
bBack.setImage("/images/Parent24.gif");
bNext.setImage("/images/Detail24.gif");
row = new Row();
rows.appendChild(row);
row.setSpans("4");
div = new Div();
div.setAlign("right");
div.appendChild(createdField);
row.appendChild(div);
boxViewEnter.setWidth("100%");
boxViewEnter.setWidths("10%, 80%, 10%");
boxViewEnter.appendChild(bBack);
boxViewEnter.appendChild(positionInfo);
boxViewEnter.appendChild(bNext);
Hbox boxCreatedByV = new Hbox();
boxCreatedByV.setWidth("100%");
boxCreatedByV.setWidths("30%, 50%, 20%");
boxCreatedByV.appendChild(createdByLabel);
boxCreatedByV.appendChild(createdByField);
boxCreatedByV.appendChild(createdField);
Hbox boxName = new Hbox();
boxName.setWidth("100%");
boxName.setWidths("40%, 60%");
boxName.appendChild(nameLabel);
boxName.appendChild(nameField);
row = new Row();
rows.appendChild(row);
row.setSpans("4");
row.appendChild(nameLabel);
nameLabel.setWidth("100%");
Hbox boxDescription = new Hbox();
boxDescription.setWidth("100%");
boxDescription.setWidths("40%, 60%");
boxDescription.appendChild(descriptionLabel);
boxDescription.appendChild(descriptionField);
row = new Row();
rows.appendChild(row);
row.setSpans("4");
row.appendChild(nameField);
nameField.setWidth("100%");
Hbox boxHelp = new Hbox();
boxHelp.setWidth("100%");
boxHelp.setWidths("40%, 60%");
boxHelp.appendChild(helpLabel);
boxHelp.appendChild(helpField);
row = new Row();
rows.appendChild(row);
row.setSpans("4");
row.appendChild(descriptionLabel);
descriptionLabel.setWidth("100%");
updateArchive.setImage("/images/Ok24.gif");
row = new Row();
rows.appendChild(row);
row.setSpans("4");
row.appendChild(descriptionField);
descriptionField.setRows(3);
descriptionField.setWidth("100%");
viewEnterPanel.setWidth("100%");
viewEnterPanel.appendChild(boxViewEnter);
viewEnterPanel.appendChild(boxCreatedByV);
viewEnterPanel.appendChild(boxName);
viewEnterPanel.appendChild(boxDescription);
viewEnterPanel.appendChild(boxHelp);
viewEnterPanel.appendChild(updateArchive);
row = new Row();
rows.appendChild(row);
row.setSpans("4");
row.appendChild(helpLabel);
helpLabel.setWidth("100%");
row = new Row();
rows.appendChild(row);
row.setSpans("4");
row.appendChild(helpField);
helpField.setRows(3);
helpField.setWidth("100%");
row = new Row();
rows.appendChild(row);
row.setSpans("4");
div = new Div();
div.setAlign("right");
div.appendChild(bRefresh);
div.appendChild(updateArchive);
row.appendChild(div);
createdByField.setEnabled(false);
createdField.setEnabled(false);
@ -398,24 +497,28 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
Tabpanel tabViewPanel = new Tabpanel();
Hbox boxViewSeparator = new Hbox();
boxViewSeparator.setWidth("100%");
boxViewSeparator.setWidths("50%, 50%");
boxViewSeparator.setHeight("100%");
boxViewSeparator.setWidths("70%, 30%");
boxViewSeparator.appendChild(iframe);
boxViewSeparator.appendChild(viewEnterPanel);
boxViewSeparator.appendChild(gridView);
tabViewPanel.appendChild(boxViewSeparator);
tabs.appendChild(tabView);
tabpanels.appendChild(tabViewPanel);
confirmPanel.addActionListener(Events.ON_CLICK, this);
confirmPanel.addEventListener(this);
updateQDisplay();
iframe.setId("reportFrame");
iframe.setHeight("100%");
int height = Double.valueOf(SessionManager.getAppDesktop().getClientInfo().desktopHeight * 0.8).intValue();
height = height - 50;
iframe.setHeight(height + "px");
iframe.setWidth("100%");
iframe.setAutohide(true);
this.setWidth("900px");
this.setWidth("100%");
this.setHeight("100%");
this.appendChild(tabbox);
this.appendChild(new Separator());
this.appendChild(confirmPanel);
}
@ -425,9 +528,9 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
if (e.getTarget() == updateArchive)
cmd_updateArchive();
else if (confirmPanel.getButton("Cancel").equals(e.getTarget()))
else if (e.getName().equals(WConfirmPanel.A_CANCEL))
SessionManager.getAppDesktop().removeWindow();
else if (confirmPanel.getButton("Ok").equals(e.getTarget()))
else if (e.getName().equals(WConfirmPanel.A_OK))
{
if (tabbox.getSelectedIndex() == 1)
SessionManager.getAppDesktop().removeWindow();
@ -440,6 +543,13 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
updateVDisplay(false);
else if (e.getTarget() == bNext)
updateVDisplay(true);
else if (e.getTarget() == bRefresh)
iframe.invalidate();
else if (e.getTarget() instanceof Tab)
{
if(tabbox.getSelectedIndex() == 1)
iframe.invalidate();
}
}
public void valueChange(ValueChangeEvent evt)
@ -758,7 +868,8 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
log.info("Length=" + m_archives.length);
// Display
//this.setSelectedIndex(1);
tabbox.setSelectedIndex(1);
m_index = 1;
updateVDisplay(false);
} // cmd_query

View File

@ -1,6 +1,5 @@
package org.adempiere.webui.apps.graph;
import org.adempiere.webui.Desktop;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MGoal;
@ -29,6 +28,6 @@ public class WPerformanceDetail extends Window
WBarGraph barPanel = new WBarGraph(goal);
appendChild(barPanel);
((Desktop) SessionManager.getAppDesktop()).addWindow2TabPanel(this);
SessionManager.getAppDesktop().showWindowInTabPanel(this);
} // PerformanceDetail
}

View File

@ -7,7 +7,6 @@ import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ComboItem;
import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Label;
@ -40,6 +39,7 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.South;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
@ -444,8 +444,8 @@ public class WWFActivity extends ADForm implements EventListener
ValueNamePair[] values = MRefList.getList(Env.getCtx(), 319, false); // _YesNo
for(int i = 0; i < values.length; i++)
{
ComboItem item = new ComboItem(values[i].getName(), values[i].getValue());
fAnswerList.appendChild(item);
Comboitem ci = fAnswerList.appendItem(values[i].getName());
ci.setId(values[i].getValue());
}
// fAnswerList.setModel(new DefaultComboBoxModel(values));
fAnswerList.setVisible(true);
@ -455,8 +455,8 @@ public class WWFActivity extends ADForm implements EventListener
ValueNamePair[] values = MRefList.getList(Env.getCtx(), m_column.getAD_Reference_Value_ID(), false);
for(int i = 0; i < values.length; i++)
{
ComboItem item = new ComboItem(values[i].getName(), values[i].getValue());
fAnswerList.appendChild(item);
Comboitem ci = fAnswerList.appendItem(values[i].getName());
ci.setId(values[i].getValue());
}
// fAnswerList.setModel(new DefaultComboBoxModel(values));
fAnswerList.setVisible(true);
@ -649,8 +649,9 @@ public class WWFActivity extends ADForm implements EventListener
{
// ValueNamePair pp = (ValueNamePair)fAnswerList.getSelectedItem();
// value = pp.getValue();
ComboItem item = fAnswerList.getSelectedItem();
value = (String) item.getValue();
int index = fAnswerList.getSelectedIndex();
if(index >= 0)
value = fAnswerList.getItemAtIndex(index).getId();
}
if (value == null || value.length() == 0)
{

View File

@ -268,6 +268,7 @@ public class CWindowToolbar extends FToolbar implements EventListener
btnActiveWorkflows.setDisabled(false); // Elaine 2008/07/17
btnRequests.setDisabled(false); // Elaine 2008/07/22
btnProductInfo.setDisabled(false); // Elaine 2008/07/22
btnArchive.setDisabled(false); // Elaine 2008/07/28
configureKeyMap();

View File

@ -40,13 +40,4 @@ public class Combobox extends org.zkoss.zul.Combobox
item.setParent(this);
return item;
}
// Elaine 2008/07/22
public ComboItem getSelectedItem()
{
Comboitem item = super.getSelectedItem();
if(item == null) return null;
return new ComboItem(item.getLabel(), (String) item.getValue());
}
//
}

View File

@ -21,9 +21,8 @@ import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Hbox;
public class Searchbox extends Hbox
public class Searchbox extends Panel//Hbox
{
private static final long serialVersionUID = 1L;
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
@ -49,11 +48,13 @@ public class Searchbox extends Hbox
private void initComponents()
{
txt = new Textbox();
txt.setWidth("100%");
// txt.setWidth("100%");
btn = new Button();
btn.setHeight("98%");
appendChild(txt);
appendChild(btn);
this.setStyle("display: inline-block");
}
public Textbox getTextBox()

View File

@ -0,0 +1,97 @@
/******************************************************************************
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. 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., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.component;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import org.zkoss.zk.ui.event.EventListener;
public class Searchbox2 extends Bandbox
{
private static final long serialVersionUID = 1L;
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
// private Textbox txt;
// private Button btn;
public Searchbox2()
{
initComponents();
}
public Searchbox2(String text)
{
initComponents();
setText(text);
}
public void setButtonImage(String imageSrc)
{
this.setImage(imageSrc);
}
private void initComponents()
{
// txt = new Textbox();
// txt.setWidth("100%");
// btn = new Button();
// btn.setHeight("98%");
// appendChild(txt);
// appendChild(btn);
}
// public void setText(String value)
// {
// txt.setText(value);
// }
// public String getText()
// {
// return txt.getText();
// }
public void setEnabled(boolean enabled)
{
setReadonly(!enabled);
// txt.setReadonly(!enabled);
// btn.setEnabled(enabled);
}
public boolean isEnabled()
{
return !isReadonly();
// return txt.isReadonly();
}
public boolean addEventListener(String evtnm, EventListener listener)
{
return super.addEventListener(evtnm, listener);
// if("onClick".equals(evtnm))
// {
// return btn.addEventListener(evtnm, listener);
// }
// else
// {
// return txt.addEventListener(evtnm, listener);
// }
}
public synchronized void addPropertyChangeListener(PropertyChangeListener l)
{
m_propertyChangeListeners.addPropertyChangeListener(l);
}
}

View File

@ -95,7 +95,9 @@ public class WDateEditor extends WEditor
@Override
public String getDisplay()
{
return null;
// Elaine 2008/07/29
return getComponent().getText();
//
}
@Override

View File

@ -125,7 +125,7 @@ public class WImageEditor extends WEditor
log.fine(m_mImage.toString());
getComponent().setLabel(m_mImage.getName());
if (m_mImage.getDescription() != null)
getComponent().setTooltip(m_mImage.getDescription());
getComponent().setTooltiptext(m_mImage.getDescription());
}
@Override

View File

@ -130,6 +130,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
popupMenu = new WEditorPopupMenu(true, true, true, true);
(getComponent().getTextBox()).setContext(popupMenu.getId());
// getComponent().setContext(popupMenu.getId());
if (columnName.equals("C_BPartner_ID"))
{
@ -200,7 +201,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
}
@Override
public void propertyChange(PropertyChangeEvent evt)
public void propertyChange(PropertyChangeEvent evt)
{
if ("FieldValue".equals(evt.getPropertyName()))
{
@ -514,7 +515,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
// Result
if (result != null)
{
log.config(gridField.getColumnName() + " - Result = " + result.toString() + " (" + result.getClass().getName() + ")");
// log.config(gridField.getColumnName() + " - Result = " + result.toString() + " (" + result.getClass().getName() + ")");
// make sure that value is in cache
lookup.getDirect(result, false, true);
actionCombo (result); // data binding

View File

@ -20,6 +20,7 @@ package org.adempiere.webui.panel;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.webui.WArchive;
import org.adempiere.webui.WRequest;
import org.adempiere.webui.WZoomAcross;
import org.adempiere.webui.apps.AEnv;
@ -473,11 +474,11 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
return true;
}
private void find()
{
MQuery mquery = new MQuery(curTab.getAD_Table_ID());
}
// private void find()
// {
// MQuery mquery = new MQuery(curTab.getAD_Table_ID());
//
// }
public void onEvent(Event event)
{
@ -1007,7 +1008,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
infoName, infoDisplay);
}
new WReport (curTab.getAD_Table_ID(), query, null, curWindowNo);
new WReport (curTab.getAD_Table_ID(), query, toolbar.getEvent().getTarget(), curWindowNo);
}
@ -1074,6 +1075,19 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
InfoPanel.showProduct(0);
}
//
// Elaine 2008/07/28
public void onArchive()
{
if (toolbar.getEvent() != null)
{
if (curTab.getRecord_ID() <= 0)
return;
new WArchive(toolbar.getEvent().getTarget(), curTab.getAD_Table_ID(), curTab.getRecord_ID());
}
}
//
/**************************************************************************
* Start Button Process

View File

@ -30,8 +30,10 @@ import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.regex.Pattern;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListCell;
import org.adempiere.webui.component.ListHead;
@ -45,6 +47,7 @@ import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.editor.WStringEditor;
import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.editor.WebEditorFactory;
@ -55,6 +58,7 @@ import org.compiere.model.GridField;
import org.compiere.model.MProduct;
import org.compiere.model.MQuery;
import org.compiere.model.MRole;
import org.compiere.model.MUserQuery;
import org.compiere.model.X_AD_Column;
import org.compiere.util.AdempiereSystemError;
import org.compiere.util.CLogger;
@ -67,6 +71,7 @@ import org.zkoss.zk.ui.Component;
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.Comboitem;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Vbox;
@ -97,6 +102,8 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
private Textbox fieldName;
private Textbox fieldValue;
//
private Combobox fQueryName;
//
private Listbox advancedPanel;
/** container of Simple Window contents */
private Vbox contentSimple;
@ -125,7 +132,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
private boolean hasName = false;
private boolean hasDescription = false;
/** Line in Simple Content */
private int sLine = 6;
// private int sLine = 6;
/** Value 2(to) */
private boolean m_valueToColumn;
/** Between selected */
@ -140,7 +147,22 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
public static final int TABNO = 99;
/** Length of Fields on first tab */
public static final int FIELDLENGTH = 20;
private int m_AD_Tab_ID = 1;
private MUserQuery[] userQueries;
/** Index ColumnName = 0 */
public static final int INDEX_COLUMNNAME = 0;
/** Index Operator = 1 */
public static final int INDEX_OPERATOR = 1;
/** Index Value = 2 */
public static final int INDEX_VALUE = 2;
/** Index Value2 = 3 */
public static final int INDEX_VALUE2 = 3;
private static final String FIELD_SEPARATOR = "<^>";
private static final String SEGMENT_SEPARATOR = "<~>";
/**
* FindPanel Constructor
* @param targetWindowNo targetWindowNo
@ -171,15 +193,18 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
initPanel();
initFind();
initFindAdvanced();
if (m_total < minRecords)
{
return;
}
this.setBorder("normal");
this.setWidth("550px");
this.setWidth("700px");
this.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title);
this.setAttribute("mode", "modal");
this.setAttribute("modal", Boolean.TRUE);
// this.setAttribute("mode", "modal");
this.setClosable(true);
this.setSizable(true);
}
/**
* initialise lookup record tab
@ -300,6 +325,23 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
btnDelete.setSrc("/images/Delete24.gif");
btnDelete.addEventListener(Events.ON_CLICK, this);
ToolBarButton btnSave = new ToolBarButton();
btnSave.setAttribute("name","btnSaveAdv");
btnSave.setSrc("/images/Save24.gif");
btnSave.addEventListener(Events.ON_CLICK, this);
fQueryName = new Combobox();
fQueryName.setTooltiptext(Msg.getMsg(Env.getCtx(),"QueryName"));
fQueryName.setReadonly(false);
//user query
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
for (int i = 0; i < userQueries.length; i++)
fQueryName.appendItem(userQueries[i].getName());
fQueryName.setValue("");
fQueryName.addEventListener(Events.ON_SELECT, this);
Button btnOk = new Button();
btnOk.setName("btnOkAdv");
btnOk.setSrc("/images/Ok24.gif");
@ -318,6 +360,8 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
ToolBar toolBar = new ToolBar();
toolBar.appendChild(btnNew);
toolBar.appendChild(btnDelete);
toolBar.appendChild(fQueryName);
toolBar.appendChild(btnSave);
toolBar.setWidth("100%");
Hbox confirmPanel = new Hbox();
@ -329,19 +373,23 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
listhead.setSizable(true);
ListHeader lstHColumn = new ListHeader();
<<<<<<< .mine
lstHColumn.setLabel("Column");
=======
lstHColumn.setLabel(Msg.translate(Env.getCtx(), "AD_Column_ID"));
lstHColumn.setWidth("100px");
>>>>>>> .r5927
ListHeader lstHOperator = new ListHeader();
lstHOperator.setLabel(Msg.getMsg(Env.getCtx(), "Operator"));
ListHeader lstHQueryValue = new ListHeader();
lstHQueryValue.setLabel(Msg.getMsg(Env.getCtx(), "QueryValue"));
lstHQueryValue.setWidth("200px");
lstHQueryValue.setWidth("210px");
ListHeader lstHQueryTo = new ListHeader();
lstHQueryTo.setLabel(Msg.getMsg(Env.getCtx(), "QueryValue2"));
lstHQueryTo.setWidth("200px");
lstHQueryTo.setWidth("210px");
listhead.appendChild(lstHColumn);
listhead.appendChild(lstHOperator);
@ -446,12 +494,12 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
private void createFields()
{
ListItem listItem = new ListItem();
listItem.setWidth("100%");
Listbox listColumn = new Listbox();
listColumn.setId("listColumn"+listItem.getId());
listColumn.setName("listColumn");
listColumn.setMold("select");
listColumn.setWidth("150px");
listColumn.setRows(0);
listColumn.addEventListener(Events.ON_SELECT,this);
@ -459,12 +507,11 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
listOperator.setId("listOperator"+listItem.getId());
listOperator.setName("listOperator");
listOperator.setMold("select");
listOperator.setWidth("50px");
listOperator.setRows(0);
listOperator.addEventListener(Events.ON_SELECT,this);
setValues(listColumn, listOperator);
ListCell cellColumn = new ListCell();
cellColumn.appendChild(listColumn);
cellColumn.setId("cellColumn"+listItem.getId());
@ -483,10 +530,9 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
listItem.appendChild(cellOperator);
listItem.appendChild(cellQueryFrom);
listItem.appendChild(cellQueryTo);
advancedPanel.appendChild(listItem);
advancedPanel.setSelectedItem(listItem);
advancedPanel.setSelectedItem(listItem);
} // createFields
/**
* sets the list of values of column and operator listboxes
@ -494,6 +540,11 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
* @param listOperator operator
**/
private void setValues(Listbox listColumn, Listbox listOperator)
{
setValues(listColumn, listOperator, null);
}
private void setValues(Listbox listColumn, Listbox listOperator, String[] fields)
{
// 0 = Columns
ArrayList<ValueNamePair> items = new ArrayList<ValueNamePair>();
@ -518,20 +569,51 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
items.toArray(cols);
Arrays.sort(cols); // sort alpha
listColumn.appendItem("","" );
for (ValueNamePair item: cols)
{
listColumn.appendItem(item.getName(), item.getValue());
}
listColumn.setSelectedIndex(0);
ValueNamePair[] op = MQuery.OPERATORS;
for (ValueNamePair item: op)
if(fields == null)
{
listOperator.appendItem(item.getName(), item.getValue());
listColumn.appendItem("","" );
for (ValueNamePair item: cols)
listColumn.appendItem(item.getName(), item.getValue());
listColumn.setSelectedIndex(0);
for (ValueNamePair item: op)
listOperator.appendItem(item.getName(), item.getValue());
listOperator.setSelectedIndex(0);
}
else
{
String columnName = fields.length > INDEX_COLUMNNAME ? fields[INDEX_COLUMNNAME] : "";
String operator = fields.length > INDEX_OPERATOR ? fields[INDEX_OPERATOR] : "";
boolean selected = false;
listColumn.appendItem("","");
for (int i = 0; i < cols.length; i++)
{
ValueNamePair item = cols[i];
ListItem li = listColumn.appendItem(item.getName(), item.getValue());
if(item.getValue().equals(columnName))
{
listColumn.setSelectedItem(li);
selected = true;
}
}
if(!selected) listColumn.setSelectedIndex(0);
selected = false;
for (int i = 0; i < op.length; i++)
{
ValueNamePair item = op[i];
ListItem li = listOperator.appendItem(item.getName(), item.getValue());
if(item.getValue().equals(operator))
{
listOperator.setSelectedItem(li);
selected = true;
}
}
if(!selected) listOperator.setSelectedIndex(0);
}
listOperator.setSelectedIndex(0);
} // setValues
/**
@ -604,6 +686,12 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
addRowEditor(componentFrom, (ListCell)row.getFellow("cellQueryFrom"+row.getId()));
addRowEditor(componentTo,(ListCell)row.getFellow("cellQueryTo"+row.getId()));
}
else if (event.getTarget() == fQueryName)
{
int index = fQueryName.getSelectedIndex();
if(index < 0) return;
parseUserQuery(userQueries[index]);
}
} //
else if ("onClick".equals(event.getName()))
{
@ -619,11 +707,15 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
else if ("btnDeleteAdv".equals(button.getAttribute("name").toString()))
{
int index = advancedPanel.getSelectedIndex();
advancedPanel.getSelectedItem().detach();
advancedPanel.setSelectedIndex(--index);
}
else if ("btnSaveAdv".equals(button.getAttribute("name").toString()))
{
cmd_save(true);
}
}
// Confirm panel actions
else if(event.getTarget() instanceof Button)
@ -686,6 +778,298 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
} // onEvent
private void parseUserQuery(MUserQuery userQuery)
{
String code = userQuery.getCode();
String[] segments = code.split(Pattern.quote(SEGMENT_SEPARATOR));
List rowList = advancedPanel.getChildren();
for (int rowIndex = rowList.size() - 1; rowIndex >= 1; rowIndex--)
rowList.remove(rowIndex);
for (int i = 0; i < segments.length; i++)
{
String[] fields = segments[i].split(Pattern.quote(FIELD_SEPARATOR));
ListItem listItem = new ListItem();
listItem.setWidth("100%");
Listbox listColumn = new Listbox();
listColumn.setId("listColumn"+listItem.getId());
listColumn.setName("listColumn");
listColumn.setMold("select");
listColumn.setRows(0);
listColumn.addEventListener(Events.ON_SELECT,this);
Listbox listOperator = new Listbox();
listOperator.setId("listOperator"+listItem.getId());
listOperator.setName("listOperator");
listOperator.setMold("select");
listOperator.setRows(0);
listOperator.addEventListener(Events.ON_SELECT,this);
setValues(listColumn, listOperator, fields);
ListCell cellColumn = new ListCell();
cellColumn.appendChild(listColumn);
cellColumn.setId("cellColumn"+listItem.getId());
ListCell cellOperator = new ListCell();
cellOperator.appendChild(listOperator);
cellOperator.setId("cellOperator"+listItem.getId());
ListCell cellQueryFrom = new ListCell();
cellQueryFrom.setId("cellQueryFrom"+listItem.getId());
ListCell cellQueryTo = new ListCell();
cellQueryTo.setId("cellQueryTo"+listItem.getId());
listItem.appendChild(cellColumn);
listItem.appendChild(cellOperator);
listItem.appendChild(cellQueryFrom);
listItem.appendChild(cellQueryTo);
String columnName = listColumn.getSelectedItem().getValue().toString();
String value = fields.length > INDEX_VALUE ? fields[INDEX_VALUE] : "";
if(value.length() > 0)
{
cellQueryFrom.appendChild(parseString(getTargetMField(columnName), value));
}
String value2 = fields.length > INDEX_VALUE2 ? fields[INDEX_VALUE2] : "";
if(value2.length() > 0)
{
cellQueryTo.appendChild(parseString(getTargetMField(columnName), value2));
}
advancedPanel.appendChild(listItem);
// advancedPanel.setSelectedItem(listItem);
}
advancedPanel.invalidate();
}
/**
* Parse String
* @param field column
* @param in value
* @return data type corected value
*/
private Label parseString(GridField field, String in)
{
if (in == null)
return null;
int dt = field.getDisplayType();
try
{
if (field.isKey())
m_editor = new WNumberEditor(field);
else
m_editor = WebEditorFactory.getEditor(field, true);
if (m_editor == null)
m_editor = new WStringEditor(field);
// Return Integer
if (dt == DisplayType.Integer
|| (DisplayType.isID(dt) && field.getColumnName().endsWith("_ID")))
{
int i = Integer.parseInt(in);
m_editor.setValue(new Integer(i));
}
// Return BigDecimal
else if (DisplayType.isNumeric(dt))
{
m_editor.setValue(DisplayType.getNumberFormat(dt).parse(in));
}
// Return Timestamp
else if (DisplayType.isDate(dt))
{
long time = 0;
try
{
time = DisplayType.getDateFormat_JDBC().parse(in).getTime();
m_editor.setValue(new Timestamp(time));
}
catch (Exception e)
{
log.log(Level.SEVERE, in + "(" + in.getClass() + ")" + e);
time = DisplayType.getDateFormat(dt).parse(in).getTime();
}
m_editor.setValue(new Timestamp(time));
}
else if (dt == DisplayType.YesNo)
m_editor.setValue(Boolean.valueOf(in));
else
m_editor.setValue(in);
Label label = new Label();
if(m_editor instanceof WSearchEditor)
{
WSearchEditor se = (WSearchEditor) m_editor;
String display = se.getGridField().getLookup().getDisplay(m_editor.getValue().toString());
label.setValue(display);
}
else
{
label.setValue(m_editor.getDisplay());
}
label.setAttribute("value", m_editor.getValue());
return label;
}
catch (Exception ex)
{
log.log(Level.SEVERE, "Object=" + in, ex);
return null;
}
} // parseValue
private void cmd_save(boolean saveQuery)
{
// advancedTable.stopEditor(true);
//
m_query = new MQuery(m_tableName);
StringBuffer code = new StringBuffer();
List rowList = advancedPanel.getChildren();
for (int rowIndex = 1; rowIndex < rowList.size() ; rowIndex++)
{
// Column
ListItem row = (ListItem)rowList.get(rowIndex);
Listbox column = (Listbox)row.getFellow("listColumn"+row.getId());
if (column == null)
continue;
String ColumnName = column.getSelectedItem().getValue().toString();
String infoName = column.toString();
//
GridField field = getTargetMField(ColumnName);
if(field == null) continue; // Elaine 2008/07/29
boolean isProductCategoryField = isProductCategoryField(field.getAD_Column_ID());
String ColumnSQL = field.getColumnSQL(false);
// Op
Listbox op = (Listbox)row.getFellow("listOperator"+row.getId());
if (op == null)
continue;
String Operator = op.getSelectedItem().getValue().toString();
// Value ******
ListCell cellQueryFrom = (ListCell)row.getFellow("cellQueryFrom"+row.getId());
// Elaine 2008/07/29
if(!(cellQueryFrom.getChildren().get(0) instanceof Label))
continue;
//
Label labelFrom = (Label)(cellQueryFrom.getChildren().get(0));
Object value = labelFrom.getAttribute("value");
if (value == null)
continue;
Object parsedValue = parseValue(field, value);
if (parsedValue == null)
continue;
String infoDisplay = value.toString();
if (field.isLookup())
infoDisplay = field.getLookup().getDisplay(value);
else if (field.getDisplayType() == DisplayType.YesNo)
infoDisplay = Msg.getMsg(Env.getCtx(), infoDisplay);
// Value2 ******
Object value2 = null;
if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].equals(op))
{
ListCell cellQueryTo = (ListCell)row.getFellow("cellQueryTo"+row.getId());
// Elaine 2008/07/29
if(!(cellQueryTo.getChildren().get(0) instanceof Label))
continue;
//
Label labelTo = (Label)(cellQueryTo.getChildren().get(0));
value2 = labelTo.getAttribute("value");
if (value2 == null)
continue;
Object parsedValue2 = parseValue(field, value2);
String infoDisplay_to = value2.toString();
if (parsedValue2 == null)
continue;
m_query.addRangeRestriction(ColumnSQL, parsedValue, parsedValue2,
infoName, infoDisplay, infoDisplay_to);
}
else if (isProductCategoryField && MQuery.OPERATORS[MQuery.EQUAL_INDEX].equals(op)) {
if (!(parsedValue instanceof Integer)) {
continue;
}
m_query
.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
}
else
m_query.addRestriction(ColumnSQL, Operator, parsedValue,
infoName, infoDisplay);
if (code.length() > 0)
code.append(SEGMENT_SEPARATOR);
code.append(ColumnName)
.append(FIELD_SEPARATOR)
.append(Operator)
.append(FIELD_SEPARATOR)
.append(value.toString())
.append(FIELD_SEPARATOR)
.append(value2 != null ? value2.toString() : "");
}
String selected = fQueryName.getValue();
if (selected != null && saveQuery) {
String name = selected;
MUserQuery uq = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID, name);
if (uq == null && code.length() > 0)
{
uq = new MUserQuery (Env.getCtx(), 0, null);
uq.setName (name);
uq.setAD_Tab_ID(m_AD_Tab_ID); //red1 UserQuery [ 1798539 ] taking in new field from Compiere
uq.setAD_User_ID(Env.getAD_User_ID(Env.getCtx())); //red1 - [ 1798539 ] missing in Compiere delayed source :-)
}
else if (uq != null && code.length() == 0)
{
if (uq.delete(true))
{
FDialog.info (m_targetWindowNo, this, "Deleted", name);
refreshUserQueries();
}
else
FDialog.warn (m_targetWindowNo, this, "DeleteError", name);
return;
}
else
return;
uq.setCode (code.toString());
uq.setAD_Table_ID (m_AD_Table_ID);
//
if (uq.save())
{
FDialog.info (m_targetWindowNo, this, "Saved", name);
refreshUserQueries();
}
else
FDialog.warn (m_targetWindowNo, this, "SaveError", name);
}
} // cmd_save
private void refreshUserQueries()
{
String value = fQueryName.getValue();
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
fQueryName.getItems().clear();
boolean selected = false;
for (int i = 0; i < userQueries.length; i++)
{
Comboitem ci = fQueryName.appendItem(userQueries[i].getName());
if(value.equals(userQueries[i].getName()))
{
fQueryName.setSelectedItem(ci);
selected = true;
}
}
if(!selected) fQueryName.setValue("");
}
/**
* retrieve the columnName of the Column item selected
* @param label label
@ -734,7 +1118,6 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
listcell.setLabel("");
listcell.getChildren().clear();
listcell.appendChild(component);
} // addComponent
/**
@ -797,12 +1180,15 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
// Create Editor
GridField field = getTargetMField(columnName);
// log.fine( "Field=" + field.toStringX());
if(field == null) return new Label("");
if (field.isKey())
m_editor = new WNumberEditor(field);
else
m_editor = WebEditorFactory.getEditor(field, true);
if (m_editor == null)
m_editor = new WStringEditor(field);
field.addPropertyChangeListener(m_editor);
m_editor.addValueChangeListner(this);
m_editor.setValue(null);
@ -966,6 +1352,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
String infoName = column.toString();
//
GridField field = getTargetMField(ColumnName);
if(field == null) continue; // Elaine 2008/07/29
boolean isProductCategoryField = isProductCategoryField(field.getAD_Column_ID());
String ColumnSQL = field.getColumnSQL(false);
// Op
@ -976,6 +1363,10 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
// Value ******
ListCell cellQueryFrom = (ListCell)row.getFellow("cellQueryFrom"+row.getId());
// Elaine 2008/07/29
if(!(cellQueryFrom.getChildren().get(0) instanceof Label))
continue;
//
Label labelFrom = (Label)(cellQueryFrom.getChildren().get(0));
Object value = labelFrom.getAttribute("value");
if (value == null)
@ -992,6 +1383,10 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].equals(op))
{
ListCell cellQueryTo = (ListCell)row.getFellow("cellQueryTo"+row.getId());
// Elaine 2008/07/29
if(!(cellQueryTo.getChildren().get(0) instanceof Label))
continue;
//
Label labelTo = (Label)(cellQueryTo.getChildren().get(0));
Object value2 = labelTo.getAttribute("value");
if (value2 == null)
@ -1286,10 +1681,22 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
WEditor editor = (WEditor)evt.getSource();
// Editor component
Component component = editor.getComponent();
ListCell listcell = (ListCell)component.getParent();
Label label = new Label(evt.getNewValue().toString());
// Elaine 2008/07/29
Label label = new Label();
if(evt.getSource() instanceof WSearchEditor)
{
WSearchEditor se = (WSearchEditor) evt.getSource();
String display = se.getGridField().getLookup().getDisplay(evt.getNewValue().toString());
label.setValue(display);
}
else
{
label.setValue(editor.getDisplay());
}
label.setAttribute("value", evt.getNewValue());
//
listcell.appendChild(label);
listcell.removeChild(component);

View File

@ -170,13 +170,13 @@ public final class WAccountDialog extends Window
toolBar.setStyle("border: none; margin: 5px");
bSave.setImage("images/Save24.gif");
bSave.setTooltip(Msg.getMsg(Env.getCtx(),"AccountNewUpdate"));
bSave.setTooltiptext(Msg.getMsg(Env.getCtx(),"AccountNewUpdate"));
bSave.addEventListener(Events.ON_CLICK, this);
bRefresh.setImage("images/Refresh24.gif");
bRefresh.setTooltip(Msg.getMsg(Env.getCtx(),"Refresh"));
bRefresh.setTooltiptext(Msg.getMsg(Env.getCtx(),"Refresh"));
bRefresh.addEventListener(Events.ON_CLICK, this);
bIgnore.setImage("images/Ignore24.gif");
bIgnore.setTooltip(Msg.getMsg(Env.getCtx(),"Ignore"));
bIgnore.setTooltiptext(Msg.getMsg(Env.getCtx(),"Ignore"));
bIgnore.addEventListener(Events.ON_CLICK, this);
//
toolBar.appendChild(bRefresh);

View File

@ -0,0 +1,533 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. 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., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
* Contributor(s): *
*****************************************************************************/
package org.adempiere.webui.window;
import java.beans.PropertyVetoException;
import java.io.File;
import java.util.StringTokenizer;
import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.WConfirmPanel;
import org.adempiere.webui.component.WStatusBar;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.compiere.model.Lookup;
import org.compiere.model.MClient;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MUser;
import org.compiere.model.MUserMail;
import org.compiere.util.CLogger;
import org.compiere.util.DisplayType;
import org.compiere.util.EMail;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.South;
import org.zkoss.zul.Div;
import org.zkoss.zul.Separator;
/**
* EMail Dialog
*
* @author Jorg Janke
* @version $Id: EMailDialog.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
*
* globalqss: integrate phib fixing bug reported here
* http://sourceforge.net/tracker/index.php?func=detail&aid=1568765&group_id=176962&atid=879332
*
* phib - fixing bug [ 1568765 ] Close email dialog button broken
*
* globalqss - Carlos Ruiz - implement CC - FR [ 1754879 ] Enhancements on sending e-mail
*
*/
public class WEMailDialog extends Window implements EventListener, ValueChangeListener
{
private static final long serialVersionUID = 1L;
/**
* EMail Dialog
* @param owner calling window
* @param title title
* @param from from
* @param to to
* @param subject subject
* @param message message
* @param attachment optional attachment
*/
public WEMailDialog (Window owner, String title, MUser from, String to,
String subject, String message, File attachment)
{
super();
this.setTitle(title);
this.setWidth("500px");
this.setHeight("500px");
this.setClosable(true);
this.setBorder("normal");
this.setStyle("position:absolute");
commonInit(from, to, subject, message, attachment);
} // EmailDialog
/**
* Common Init
* @param from from
* @param to to
* @param subject subject
* @param message message
* @param attachment optional attachment
*/
private void commonInit (MUser from, String to,
String subject, String message, File attachment)
{
m_client = MClient.get(Env.getCtx());
try
{
int WindowNo = 0;
int AD_Column_ID = 0;
Lookup lookup = MLookupFactory.get (Env.getCtx(), WindowNo,
AD_Column_ID, DisplayType.Search,
Env.getLanguage(Env.getCtx()), "AD_User_ID", 0, false,
"EMail IS NOT NULL");
fUser = new WSearchEditor(lookup, "AD_User_ID", "", false, false, true);
fUser.addValueChangeListner(this);
fCcUser = new WSearchEditor(lookup, "AD_User_ID", "", false, false, true);
fCcUser.addValueChangeListner(this);
jbInit();
}
catch(Exception ex)
{
log.log(Level.SEVERE, "EMailDialog", ex);
}
set(from, to, subject, message);
setAttachment(attachment);
AEnv.showCenterScreen(this);
} // commonInit
/** Client */
private MClient m_client = null;
/** Sender */
private MUser m_from = null;
/** Primary Recipient */
private MUser m_user = null;
/** Cc Recipient */
private MUser m_ccuser = null;
//
private String m_to;
private String m_cc;
private String m_subject;
private String m_message;
/** File to be optionally attached */
private File m_attachFile;
/** Logger */
private static CLogger log = CLogger.getCLogger(WEMailDialog.class);
// private CPanel mainPanel = new CPanel();
// private BorderLayout mainLayout = new BorderLayout();
// private CPanel headerPanel = new CPanel();
// private GridBagLayout headerLayout = new GridBagLayout();
private Textbox fFrom = new Textbox();//20);
private Textbox fTo = new Textbox();//20);
private Textbox fCc = new Textbox();//20);
private WSearchEditor fUser = null;
private WSearchEditor fCcUser = null;
private Textbox fSubject = new Textbox();//40);
private Label lFrom = new Label();
private Label lTo = new Label();
private Label lCc = new Label();
private Label lSubject = new Label();
private Label lAttachment = new Label();
private Textbox fAttachment = new Textbox();//40);
private Textbox fMessage = new Textbox();
private WConfirmPanel confirmPanel = new WConfirmPanel(true);
private WStatusBar statusBar = new WStatusBar();
/**
* Static Init
*/
void jbInit() throws Exception
{
lFrom.setValue(Msg.getMsg(Env.getCtx(), "From") + ":");
lTo.setValue(Msg.getMsg(Env.getCtx(), "To") + ":");
lCc.setValue(Msg.getMsg(Env.getCtx(), "Cc") + ":");
lSubject.setValue(Msg.getMsg(Env.getCtx(), "Subject") + ":");
lAttachment.setValue(Msg.getMsg(Env.getCtx(), "Attachment") + ":");
fFrom.setReadonly(true);
statusBar.setStatusDB(null);
//
Grid grid = new Grid();
grid.setWidth("480px");
grid.setStyle("margin:0; padding:0; position: absolute; align: center; valign: center;");
grid.setSclass("grid-no-striped");
grid.setOddRowSclass("even");
Rows rows = new Rows();
grid.appendChild(rows);
Row row = new Row();
rows.appendChild(row);
Div div = new Div();
div.setAlign("right");
div.appendChild(lFrom);
row.appendChild(div);
row.appendChild(fFrom);
fFrom.setWidth("100%");
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lTo);
row.appendChild(div);
row.appendChild(fUser.getComponent());
fUser.getComponent().setWidth("100%");
row = new Row();
rows.appendChild(row);
row.appendChild(new Label(""));
row.appendChild(fTo);
fTo.setWidth("100%");
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lCc);
row.appendChild(div);
row.appendChild(fCcUser.getComponent());
fCcUser.getComponent().setWidth("100%");
row = new Row();
rows.appendChild(row);
row.appendChild(new Label(""));
row.appendChild(fCc);
fCc.setWidth("100%");
row = new Row();
rows.appendChild(row);
row.setSpans("2");
row.appendChild(new Separator());
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lSubject);
row.appendChild(div);
row.appendChild(fSubject);
fSubject.setWidth("100%");
row = new Row();
rows.appendChild(row);
row.setSpans("2");
row.appendChild(new Separator());
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lAttachment);
row.appendChild(div);
row.appendChild(fAttachment);
fAttachment.setWidth("100%");
row = new Row();
rows.appendChild(row);
row.setSpans("2");
row.appendChild(fMessage);
fMessage.setWidth("100%");
fMessage.setRows(10);
row = new Row();
rows.appendChild(row);
row.setSpans("2");
row.appendChild(confirmPanel);
confirmPanel.addEventListener(this);
Borderlayout layout = new Borderlayout();
layout.setWidth("490px");
layout.setHeight("470px");
layout.setStyle("background-color: white; position: absolute;");
Center center = new Center();
center.appendChild(grid);
layout.appendChild(center);
center.setStyle("background-color: white");
South south = new South();
south.appendChild(statusBar);
statusBar.setWidth("100%");
layout.appendChild(south);
south.setStyle("background-color: white");
this.appendChild(layout);
} // jbInit
/**
* Set all properties
*/
public void set (MUser from, String to, String subject, String message)
{
// Content
setFrom(from);
setTo(to);
setSubject(subject);
setMessage(message);
//
statusBar.setStatusLine(m_client.getSMTPHost());
} // set
/**
* Set Address
*/
public void setTo(String newTo)
{
m_to = newTo;
fTo.setText(m_to);
} // setTo
/**
* Set CC Address
*/
public void setCc(String newCc)
{
m_cc = newCc;
fCc.setText(m_cc);
} // setCc
/**
* Get Address
*/
public String getTo()
{
m_to = fTo.getText();
return m_to;
} // getTo
/**
* Get CC Address
*/
public String getCc()
{
m_cc = fCc.getText();
return m_cc;
} // getCc
/**
* Set Sender
*/
public void setFrom(MUser newFrom)
{
m_from = newFrom;
if (newFrom == null
|| !newFrom.isEMailValid()
|| !newFrom.isCanSendEMail())
{
// confirmPanel.getOKButton().setEnabled(false);
fFrom.setText("**Invalid**");
}
else
fFrom.setText(m_from.getEMail());
} // setFrom
/**
* Get Sender
*/
public MUser getFrom()
{
return m_from;
} // getFrom
/**
* Set Subject
*/
public void setSubject(String newSubject)
{
m_subject = newSubject;
fSubject.setText(m_subject);
} // setSubject
/**
* Get Subject
*/
public String getSubject()
{
m_subject = fSubject.getText();
return m_subject;
} // getSubject
/**
* Set Message
*/
public void setMessage(String newMessage)
{
m_message = newMessage;
fMessage.setText(m_message);
// fMessage.setCaretPosition(0);
} // setMessage
/**
* Get Message
*/
public String getMessage()
{
m_message = fMessage.getText();
return m_message;
} // getMessage
/**
* Set Attachment
*/
public void setAttachment (File attachment)
{
m_attachFile = attachment;
if (attachment == null)
{
lAttachment.setVisible(false);
fAttachment.setVisible(false);
}
else
{
lAttachment.setVisible(true);
fAttachment.setVisible(true);
fAttachment.setText(attachment.getName());
fAttachment.setReadonly(true);
}
} // setAttachment
/**
* Get Attachment
*/
public File getAttachment()
{
return m_attachFile;
} // getAttachment
/**************************************************************************
* Action Listener - Send email
*/
public void onEvent(Event event) throws Exception {
if (event.getName().equals(WConfirmPanel.A_CANCEL))
onClose();
if (getTo() == null || getTo().length() == 0)
{
return;
}
// Send
if (event.getName().equals(WConfirmPanel.A_OK))
{
// setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// confirmPanel.getOKButton().setEnabled(false);
StringTokenizer st = new StringTokenizer(getTo(), " ,;", false);
String to = st.nextToken();
EMail email = m_client.createEMail(getFrom(), to, getSubject(), getMessage());
String status = "Check Setup";
if (email != null)
{
while (st.hasMoreTokens())
email.addTo(st.nextToken());
// cc
StringTokenizer stcc = new StringTokenizer(getCc(), " ,;", false);
while (stcc.hasMoreTokens())
{
String cc = stcc.nextToken();
if (cc != null && cc.length() > 0)
email.addCc(cc);
}
// Attachment
if (m_attachFile != null && m_attachFile.exists())
email.addAttachment(m_attachFile);
status = email.send();
//
if (m_user != null)
new MUserMail(m_user, m_user.getAD_User_ID(), email).save();
if (email.isSentOK())
{
FDialog.info(0, this, "MessageSent");
onClose();
}
else
FDialog.error(0, this, "MessageNotSent", status);
}
else
FDialog.error(0, this, "MessageNotSent", status);
//
// confirmPanel.getOKButton().setEnabled(false);
// setCursor(Cursor.getDefaultCursor());
}
else if (event.getName().equals(WConfirmPanel.A_CANCEL))
onClose();
}
/**
* Vetoable Change - User selected
* @param evt
* @throws PropertyVetoException
*/
public void valueChange(ValueChangeEvent evt) {
WSearchEditor source = (WSearchEditor) evt.getSource();
Object value = evt.getNewValue();
log.info("Value=" + value);
if (value == null)
{
return;
}
if (source.equals(fUser)) {
// fUser
if (value == null)
fTo.setText("");
if (value instanceof Integer)
{
int AD_User_ID = ((Integer)value).intValue();
m_user = MUser.get(Env.getCtx(), AD_User_ID);
fTo.setValue(m_user.getEMail());
}
} else {
// fCcUser
if (value == null)
fCc.setText("");
if (value instanceof Integer)
{
int AD_User_ID = ((Integer)value).intValue();
m_ccuser = MUser.get(Env.getCtx(), AD_User_ID);
fCc.setValue(m_ccuser.getEMail());
}
}
return;
}
} // VEMailDialog

View File

@ -430,7 +430,7 @@ public class WPAttributeDialog extends Window implements EventListener
label.setStyle("font-weight: bold");
if (attribute.getDescription() != null)
label.setTooltip(attribute.getDescription());
label.setTooltiptext(attribute.getDescription());
Row row = new Row();
row.setParent(rows);

View File

@ -33,7 +33,7 @@ public class ZkJRViewer extends Window {
toolbar.setHeight("26px");
Toolbarbutton button = new Toolbarbutton();
button.setImage("/images/Print24.gif");
button.setTooltip("Print");
button.setTooltiptext("Print");
toolbar.appendChild(button);
row.appendChild(toolbar);
rows.appendChild(row);

View File

@ -16,8 +16,8 @@
*****************************************************************************/
package org.adempiere.webui.window;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.session.SessionManager;
import org.compiere.print.ReportEngine;
import org.compiere.print.ReportViewerProvider;
@ -33,6 +33,8 @@ public class ZkReportViewerProvider implements ReportViewerProvider {
viewer.setAttribute("mode", "overlapped");
viewer.setClosable(true);
viewer.setWidth("95%");
AEnv.showWindow(viewer);
SessionManager.getAppDesktop().showWindowInTabPanel(viewer);
// AEnv.showWindow(viewer);
}
}