Search in sources :

Example 31 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class GridController method dynamicDisplay.

//  propertyChange
/**
	 *  Dynamic Display.
	 *  - Single Row Screen layout and update of dynamic Lookups
	 *  <p>
	 *  Single Row layout:
	 *  the components's name is the ColumnName; if it matches, the
	 *  MField.isDisplayed(true) is used to determine if it is visible
	 *  if the component is a VEditor, setEnabled is set from the MField
	 *  <p>
	 *  Multi Row layout is not changed:
	 *  VCellRenderer calls JTable.isCellEditable -> checks MField.isEditable (Active, isDisplayed)
	 *  VCellEditor.isCellEditable calls MField.isEditable(true) <br>
	 *  If a column is not displayed, the width is set to 0 in dynInit
	 *  <p>
	 *  Dynamic update of data is handeled in VLookup.focusGained/Lost.
	 *  When focus is gained the model is temporarily updated with the
	 *  specific validated data, if lost, it is switched back to the
	 *  unvalidated data (i.e. everything). This allows that the display
	 *  methods have a lookup to display. <br>
	 *  Here: if the changed field has dependents and the dependent
	 *  is a Lookup and this lookup has a dynamic dependence of the changed field,
	 *  the value of that field is set to null (in MTab.processDependencies -
	 *  otherwise it would show an invalid value).
	 *  As Editors listen for value changed of their MField, the display is updated.
	 *  <p>
	 *  Called from GridController.valueChanged/dataStatusChanged, APane;.stateChanged/unlock/cmd_...
	 *  @param col selective column number or 0 if all
	 */
public void dynamicDisplay(int col) {
    //	Don't update if multi-row
    if (!isSingleRow() || m_onlyMultiRow)
        return;
    if (!m_mTab.isOpen())
        return;
    //  Selective
    if (col > 0) {
        GridField changedField = m_mTab.getField(col);
        String columnName = changedField.getColumnName();
        ArrayList<GridField> dependants = m_mTab.getDependantFields(columnName);
        log.config("(" + m_mTab.toString() + ") " + columnName + " - Dependents=" + dependants.size());
        //	No Dependents and no Callout - Set just Background
        if (dependants.size() == 0 && changedField.getCallout().length() == 0) {
            Component[] comp = vPanel.getComponentsRecursive();
            for (int i = 0; i < comp.length; i++) {
                if (columnName.equals(comp[i].getName()) && comp[i] instanceof VEditor) {
                    VEditor ve = (VEditor) comp[i];
                    boolean manMissing = false;
                    boolean noValue = changedField.getValue() == null || changedField.getValue().toString().length() == 0;
                    if (//  check context
                    noValue && changedField.isEditable(true) && changedField.isMandatory(true))
                        manMissing = true;
                    ve.setBackground(manMissing || changedField.isError());
                    break;
                }
            }
            return;
        }
    }
    //  selective
    //  complete single row re-display
    boolean noData = m_mTab.getRowCount() == 0;
    log.config(m_mTab.toString() + " - Rows=" + m_mTab.getRowCount());
    //  All Components in vPanel (Single Row)
    Set<String> hiddens = new HashSet<String>();
    Component[] comps = vPanel.getComponentsRecursive();
    for (int i = 0; i < comps.length; i++) {
        Component comp = comps[i];
        String columnName = comp.getName();
        if (comp instanceof VChart && isSingleRow()) {
            ((VChart) comp).createChart();
        }
        if (columnName != null && columnName.length() > 0) {
            GridField mField = m_mTab.getField(columnName);
            if (mField != null) {
                if (//  check context
                mField.isDisplayed(true)) {
                    if (!comp.isVisible())
                        //  visibility
                        comp.setVisible(true);
                    /**
						 * Feature Request [1707462]
						 * Enable runtime change of VFormat
						 * @author fer_luck
						 */
                    if (comp instanceof VString) {
                        VString vs = (VString) comp;
                        if ((vs.getVFormat() != null && vs.getVFormat().length() > 0 && mField.getVFormat() == null) || (vs.getVFormat() == null && mField.getVFormat() != null && mField.getVFormat().length() > 0) || (vs.getVFormat() != null && mField.getVFormat() != null && !vs.getVFormat().equals(mField.getVFormat()))) {
                            vs.setVFormat(mField.getVFormat());
                        }
                    }
                    //End Feature Request [1707462]
                    if (comp instanceof VEditor) {
                        VEditor ve = (VEditor) comp;
                        if (noData)
                            ve.setReadWrite(false);
                        else {
                            //  r/w - check Context
                            boolean rw = mField.isEditable(true);
                            ve.setReadWrite(rw);
                            //	log.log(Level.FINEST, "RW=" + rw + " " + mField);
                            boolean manMissing = false;
                            //  least expensive operations first        //  missing mandatory
                            if (rw && (mField.getValue() == null || mField.getValue().toString().isEmpty()) && //  check context. Some fields can return "" instead of null
                            mField.isMandatory(true))
                                manMissing = true;
                            ve.setBackground(manMissing || mField.isError());
                        }
                    }
                } else {
                    if (comp.isVisible())
                        comp.setVisible(false);
                    hiddens.add(columnName);
                }
            }
        }
    }
    // hide empty field group based on the environment
    for (int i = 0; i < comps.length; i++) {
        Component comp = comps[i];
        if (comp instanceof CollapsiblePanel) {
            if (comp.getName() == null || comp.getName().startsWith("IncludedTab#"))
                continue;
            else {
                boolean hasVisible = false;
                Component[] childs = ((CollapsiblePanel) comp).getCollapsiblePane().getContentPane().getComponents();
                for (int j = 0; j < childs.length; j++) {
                    if (childs[j].isVisible()) {
                        String columnName = childs[j].getName();
                        if (columnName != null && columnName.length() > 0) {
                            GridField mField = m_mTab.getField(columnName);
                            if (mField != null) {
                                hasVisible = true;
                                break;
                            }
                        }
                    }
                }
                if (comp.isVisible() != hasVisible)
                    comp.setVisible(hasVisible);
            }
        }
    }
    //
    log.config(m_mTab.toString() + " - fini - " + (col <= 0 ? "complete" : "seletive"));
}
Also used : VChart(org.compiere.grid.ed.VChart) GridField(org.compiere.model.GridField) VString(org.compiere.grid.ed.VString) VEditor(org.compiere.grid.ed.VEditor) CollapsiblePanel(org.compiere.swing.CollapsiblePanel) VString(org.compiere.grid.ed.VString) Component(java.awt.Component) HashSet(java.util.HashSet)

Example 32 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class GridController method dataStatusChanged.

/**
	 *  Data Status Listener - for MTab events.
	 *  <p>
	 *  Callouts are processed here for GUI changes
	 *  - same as in MTab.setValue for batch changes
	 *  <p>
	 *  calls dynamicDisplay
	 *  @param e event
	 */
public void dataStatusChanged(DataStatusEvent e) {
    //	if (e.getChangedColumn() == 0)
    //		return;
    int col = e.getChangedColumn();
    log.config("(" + m_mTab + ") Col=" + col + ": " + e.toString());
    //  Process Callout
    GridField mField = m_mTab.getField(col);
    if (mField != null && (mField.getCallout().length() > 0 || m_mTab.hasDependants(mField.getColumnName()))) {
        //  Dependencies & Callout
        String msg = m_mTab.processFieldChange(mField);
        if (msg.length() > 0)
            ADialog.error(m_WindowNo, this, msg);
    }
    if (mField != null && mField.isLookup()) {
        Lookup lookup = (Lookup) mField.getLookup();
        if (lookup != null && lookup instanceof MLookup) {
            MLookup mlookup = (MLookup) lookup;
            Object value = mField.getValue();
            if (mlookup.isAlert() && value != null && value instanceof Integer) {
                String alert = MMemo.getAlerts(Env.getCtx(), mlookup.getTableName(), (Integer) value);
                if (!Util.isEmpty(alert)) {
                    VAlert memo = new VAlert(Env.getWindow(m_WindowNo));
                    memo.setAlwaysOnTop(true);
                    memo.setText(alert);
                    AEnv.showCenterScreen(memo);
                    memo = null;
                }
            }
        }
    }
    //if (col >= 0)
    dynamicDisplay(col);
}
Also used : MLookup(org.compiere.model.MLookup) Lookup(org.compiere.model.Lookup) MLookup(org.compiere.model.MLookup) GridField(org.compiere.model.GridField) VString(org.compiere.grid.ed.VString)

Example 33 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class APanel method initPanel.

/**************************************************************************
	 *	Dynamic Panel Initialization - either single window or workbench.
	 *  <pre>
	 *  either
	 *  - Workbench tabPanel    (VTabbedPane)
	 *      - Tab               (GridController)
	 *  or
	 *  - Workbench tabPanel    (VTabbedPane)
	 *      - Window            (VTabbedPane)
	 *          - Tab           (GridController)
	 *  </pre>
	 *  tabPanel
	 *  @param AD_Workbench_ID  if > 0 this is a workbench, AD_Window_ID ignored
	 *  @param AD_Window_ID     if not a workbench, Window ID
	 *  @param query			if not a Workbench, Zoom Query - additional SQL where clause
	 *  @return true if Panel is initialized successfully
	 */
public boolean initPanel(int AD_Workbench_ID, int AD_Window_ID, MQuery query) {
    log.info("WB=" + AD_Workbench_ID + ", Win=" + AD_Window_ID + ", Query=" + query);
    this.setName("APanel" + AD_Window_ID);
    //  Single Window
    if (AD_Workbench_ID == 0)
        m_mWorkbench = new GridWorkbench(m_ctx, AD_Window_ID);
    else //  Workbench
    {
        //	m_mWorkbench = new MWorkbench(m_ctx);
        //	if (!m_mWorkbench.initWorkbench (AD_Workbench_ID))
        //	{
        //		log.log(Level.SEVERE, "APanel.initWindow - No Workbench Model");
        //		return false;
        //	}
        //	tabPanel.setWorkbench(true);
        //	tabPanel.addChangeListener(this);
        log.warning("Workbench Not implemented yet [" + this + "]");
        loadError = "Workbench Not implemented yet";
        return false;
    }
    Dimension windowSize = m_mWorkbench.getWindowSize();
    MQuery detailQuery = null;
    /**
		 *  WorkBench Loop
		 */
    for (int wb = 0; wb < m_mWorkbench.getWindowCount(); wb++) {
        //  Get/set WindowNo
        //  Timing: ca. 1.5 sec
        m_curWindowNo = Env.createWindowNo(this);
        m_mWorkbench.setWindowNo(wb, m_curWindowNo);
        //  Set AutoCommit for this Window
        Env.setAutoCommit(m_ctx, m_curWindowNo, Env.isAutoCommit(m_ctx));
        boolean autoNew = Env.isAutoNew(m_ctx);
        Env.setAutoNew(m_ctx, m_curWindowNo, autoNew);
        //  Workbench Window
        VTabbedPane window = null;
        //  just one window
        if (m_mWorkbench.getWindowCount() == 1) {
            window = tabPanel;
            window.setWorkbench(false);
        } else {
            VTabbedPane tp = new VTabbedPane(false);
            window = tp;
        }
        //  Window Init
        window.addChangeListener(this);
        /**
			 *  Init Model
			 */
        int wbType = m_mWorkbench.getWindowType(wb);
        /**
			 *  Window
			 */
        if (wbType == GridWorkbench.TYPE_WINDOW) {
            includedMap = new HashMap<Integer, GridController>(4);
            //
            GridWindowVO wVO = AEnv.getMWindowVO(m_curWindowNo, m_mWorkbench.getWindowID(wb), 0);
            if (wVO == null) {
                log.warning("AccessTableNoView for [" + this + "]");
                loadError = "AccessTableNoView";
                return false;
            }
            //  Timing: ca. 0.3-1 sec
            GridWindow mWindow = new GridWindow(wVO, true);
            //	Set SO/AutoNew for Window
            Env.setContext(m_ctx, m_curWindowNo, "IsSOTrx", mWindow.isSOTrx());
            if (!autoNew && mWindow.isTransaction())
                Env.setAutoNew(m_ctx, m_curWindowNo, true);
            m_mWorkbench.setMWindow(wb, mWindow);
            if (wb == 0)
                //	default = only current
                m_onlyCurrentRows = mWindow.isTransaction();
            if (windowSize == null)
                windowSize = mWindow.getWindowSize();
            /**
				 *  Window Tabs
				 */
            int tabSize = mWindow.getTabCount();
            //	Zoom Query
            boolean goSingleRow = query != null;
            for (int tab = 0; tab < tabSize; tab++) {
                boolean included = false;
                //  MTab
                if (tab == 0)
                    mWindow.initTab(0);
                GridTab gTab = mWindow.getTab(tab);
                Env.setContext(m_ctx, m_curWindowNo, tab, GridTab.CTX_TabLevel, Integer.toString(gTab.getTabLevel()));
                //  Query first tab
                if (tab == 0) {
                    //  initial user query for single workbench tab
                    if (m_mWorkbench.getWindowCount() == 1) {
                        if (query != null && query.getZoomTableName() != null && query.getZoomColumnName() != null && query.getZoomValue() instanceof Integer && (Integer) query.getZoomValue() > 0) {
                            if (!query.getZoomTableName().equalsIgnoreCase(gTab.getTableName())) {
                                detailQuery = query;
                                query = new MQuery();
                                query.addRestriction("1=2");
                            }
                        }
                        //Goodwill
                        isCancel = false;
                        query = initialQuery(query, gTab);
                        if (isCancel)
                            //Cancel opening window
                            return false;
                        if (query != null && query.getRecordCount() <= 1)
                            goSingleRow = true;
                    } else if (wb != 0) //  workbench dynamic query for dependent windows
                    {
                        query = m_mWorkbench.getQuery();
                    }
                    //	Set initial Query on first tab
                    if (query != null) {
                        //  Query might involve history
                        m_onlyCurrentRows = false;
                        gTab.setQuery(query);
                    }
                    if (wb == 0)
                        m_curTab = gTab;
                }
                //	query on first tab
                Component tabElement = null;
                //  GridController
                if (gTab.isSortTab()) {
                    VSortTab st = new VSortTab(m_curWindowNo, gTab.getAD_Table_ID(), gTab.getAD_ColumnSortOrder_ID(), gTab.getAD_ColumnSortYesNo_ID());
                    st.setTabLevel(gTab.getTabLevel());
                    tabElement = st;
                } else //	normal tab
                {
                    //  Timing: ca. .1 sec
                    GridController gc = new GridController();
                    CompiereColor cc = mWindow.getColor();
                    if (cc != null)
                        //  set color on Window level
                        gc.setBackgroundColor(cc);
                    //  will set color on Tab level
                    gc.initGrid(gTab, false, m_curWindowNo, this, mWindow, (tab != 0));
                    //  Timing: ca. 6-7 sec for first .2 for next
                    gc.addDataStatusListener(this);
                    //  register Escape Key
                    gc.registerESCAction(aIgnore);
                    //	Set First Tab
                    if (wb == 0 && tab == 0) {
                        m_curGC = gc;
                        //  Screen Sizing
                        Dimension size = gc.getPreferredSize();
                        size.width += 4;
                        size.height += 4;
                        gc.setPreferredSize(size);
                    }
                    tabElement = gc;
                    //	If we have a zoom query, switch to single row
                    if (tab == 0 && goSingleRow)
                        gc.switchSingleRow();
                    // FR [ 1757088 ]
                    GridField[] fields = gc.getMTab().getFields();
                    int m_tab_id = 0;
                    for (int f = 0; f < fields.length; f++) {
                        m_tab_id = fields[f].getIncluded_Tab_ID();
                        if (m_tab_id != 0) {
                            includedMap.put(m_tab_id, gc);
                        }
                    }
                    //	Is this tab included?
                    if (includedMap.size() > 0) {
                        GridController parent = (GridController) includedMap.get(new Integer(gTab.getAD_Tab_ID()));
                        if (parent != null) {
                            // FR [ 1757088 ]
                            gc.removeDataStatusListener(this);
                            GridSynchronizer synchronizer = new GridSynchronizer(mWindow, parent, gc);
                            if (parent == m_curGC)
                                synchronizer.activateChild();
                            included = parent.includeTab(gc, this, synchronizer);
                        }
                    }
                    initSwitchLineAction();
                }
                if (//  Add to TabbedPane
                !included) {
                    StringBuffer tabName = new StringBuffer();
                    tabName.append("<html>");
                    if (gTab.isReadOnly())
                        tabName.append("<i>");
                    int pos = gTab.getName().indexOf(" ");
                    if (pos == -1)
                        tabName.append(gTab.getName()).append("<br>&nbsp;");
                    else {
                        tabName.append(gTab.getName().substring(0, pos)).append("<br>").append(gTab.getName().substring(pos + 1));
                    }
                    if (gTab.isReadOnly())
                        tabName.append("</i>");
                    tabName.append("</html>");
                    //	Add Tab - sets ALT-<number> and Shift-ALT-<x>
                    window.addTab(tabName.toString(), gTab, tabElement);
                }
            }
        //  Tab Loop
        //  Tab background
        //	window.setBackgroundColor(new AdempiereColor(Color.magenta, Color.green));
        }
        //  Single Workbench Window Tab
        if (m_mWorkbench.getWindowCount() == 1) {
            window.setToolTipText(m_mWorkbench.getDescription(wb));
        } else //  Add Workbench Window Tab
        {
            tabPanel.addTab(m_mWorkbench.getName(wb), m_mWorkbench.getIcon(wb), window, m_mWorkbench.getDescription(wb));
        }
        //  Used for Env.getHeader
        Env.setContext(m_ctx, m_curWindowNo, "WindowName", m_mWorkbench.getName(wb));
    }
    //  Workbench Loop
    //  stateChanged (<->) triggered
    toolBar.setName(getTitle());
    m_curTab.getTableModel().setChanged(false);
    //	Set Detail Button
    aDetail.setEnabled(0 != m_curWinTab.getTabCount() - 1);
    //	Enable/Disable Tabs dynamically
    if (m_curWinTab instanceof VTabbedPane)
        ((VTabbedPane) m_curWinTab).evaluate(null);
    //	Size
    if (windowSize != null)
        setPreferredSize(windowSize);
    else
        revalidate();
    if (detailQuery != null && zoomToDetailTab(detailQuery)) {
        return true;
    }
    Dimension size = getPreferredSize();
    log.info("fini - " + size);
    m_curWinTab.requestFocusInWindow();
    return true;
}
Also used : GridWindow(org.compiere.model.GridWindow) MQuery(org.compiere.model.MQuery) Dimension(java.awt.Dimension) GridField(org.compiere.model.GridField) Point(java.awt.Point) VSortTab(org.compiere.grid.VSortTab) GridTab(org.compiere.model.GridTab) GridSynchronizer(org.compiere.grid.GridSynchronizer) GridWindowVO(org.compiere.model.GridWindowVO) CompiereColor(org.compiere.plaf.CompiereColor) VTabbedPane(org.compiere.grid.VTabbedPane) GridWorkbench(org.compiere.model.GridWorkbench) GridController(org.compiere.grid.GridController) Component(java.awt.Component)

Example 34 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class WLocation method doGet.

/**
	 * Process the HTTP Get request - initial Start
	 * Needs to have parameters FormName and ColumnName
	 *
	 * @param request request
	 * @param response response
	 * @throws ServletException
	 * @throws IOException
	 */
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    log.fine("");
    HttpSession sess = request.getSession();
    WWindowStatus ws = WWindowStatus.get(request);
    if (ws == null) {
        WebUtil.createTimeoutPage(request, response, this, null);
        return;
    }
    //  Get Mandatory Parameters
    String columnName = WebUtil.getParameter(request, "ColumnName");
    log.info("ColumnName=" + columnName + " - " + ws.toString());
    //
    GridField mField = ws.curTab.getField(columnName);
    log.config("ColumnName=" + columnName + ", MField=" + mField);
    if (mField == null || columnName == null || columnName.equals("")) {
        WebUtil.createErrorPage(request, response, this, Msg.getMsg(ws.ctx, "ParameterMissing"));
        return;
    }
    MLocation location = null;
    Object value = mField.getValue();
    if (value != null && value instanceof Integer)
        location = new MLocation(ws.ctx, ((Integer) value).intValue(), null);
    else
        location = new MLocation(ws.ctx, 0, null);
    //String targetBase = "parent.WWindow." + WWindow.FORM_NAME + "." + columnName;
    String targetBase = "opener.WWindow." + WWindow.FORM_NAME + "." + columnName;
    String action = request.getRequestURI();
    //  Create Document
    WebDoc doc = WebDoc.createPopup(mField.getHeader());
    doc.addPopupClose(ws.ctx);
    boolean hasDependents = ws.curTab.hasDependants(columnName);
    boolean hasCallout = mField.getCallout().length() > 0;
    //  Reset
    button reset = new button();
    //  translate
    reset.addElement("Reset");
    String script = targetBase + "D.value='';" + targetBase + "F.value='';closePopup();";
    if (hasDependents || hasCallout)
        script += "startUpdate(" + targetBase + "F);";
    reset.setOnClick(script);
    //
    doc.getTable().addElement(new tr().addElement(fillForm(ws, action, location, targetBase, hasDependents || hasCallout)).addElement(reset));
    //
    doc.addPopupClose(ws.ctx);
    //	log.trace(log.l6_Database, doc.toString());
    WebUtil.createResponse(request, response, this, null, doc, true);
}
Also used : org.apache.ecs.xhtml.button(org.apache.ecs.xhtml.button) HttpSession(javax.servlet.http.HttpSession) WebDoc(org.compiere.util.WebDoc) GridField(org.compiere.model.GridField) MLocation(org.compiere.model.MLocation) org.apache.ecs.xhtml.tr(org.apache.ecs.xhtml.tr)

Example 35 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class WChat method CreateChatPage.

//	createTD
/**
	 * 	Create Left Top aligned TD
	 *	@param element element
	 *	@return td table data
	 */
private WebDoc CreateChatPage(WWindowStatus ws, WebSessionCtx wsc, WebDoc doc, int CM_Chat_ID) {
    doc = WebDoc.createPopup("Chat ");
    td center = doc.addWindowCenter(false);
    int record_ID = ws.curTab.getRecord_ID();
    log.info("Record_ID=" + record_ID);
    if (//	No Key
    record_ID == -1) {
        log.info("Record does not exist");
        return doc;
    }
    //	Find display
    String infoName = null;
    String infoDisplay = null;
    for (int i = 0; i < ws.curTab.getFieldCount(); i++) {
        GridField field = ws.curTab.getField(i);
        if (field.isKey())
            infoName = field.getHeader();
        if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo")) && field.getValue() != null)
            infoDisplay = field.getValue().toString();
        if (infoName != null && infoDisplay != null)
            break;
    }
    String description = infoName + ": " + infoDisplay;
    if (ws.curTab.getCM_ChatID() > 0)
        m_chat = new MChat(wsc.ctx, ws.curTab.getCM_ChatID(), null);
    else if (CM_Chat_ID > 0)
        m_chat = new MChat(wsc.ctx, CM_Chat_ID, null);
    else
        m_chat = new MChat(wsc.ctx, ws.curTab.getAD_Table_ID(), record_ID, description, null);
    String text = m_chat.getHistory(MChat.CONFIDENTIALTYPE_Internal).toString();
    form myForm = new form("WChat").setName("chat");
    myForm.setOnSubmit("this.Submit.disabled=true;return true;");
    if (CM_Chat_ID == 0)
        myForm.addElement(new input(input.TYPE_HIDDEN, "CM_ChatID", ws.curTab.getCM_ChatID()));
    else
        myForm.addElement(new input(input.TYPE_HIDDEN, "CM_ChatID", CM_Chat_ID));
    myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Table_ID", ws.curTab.getAD_Table_ID()));
    myForm.addElement(new input(input.TYPE_HIDDEN, "record_ID", record_ID));
    myForm.addElement(new input(input.TYPE_HIDDEN, "description", description));
    table myTable = new table("0", "0", "5", "100%", null);
    myTable.setID("WChatParameter");
    m_displayLength = 80;
    //history field
    myTable.addElement(new tr().addElement(new td("History")));
    m_readOnly = true;
    table HistoryTable = new table("1", "0", "5", "100%", null);
    HistoryTable.addElement(new tr().addElement(new td(text).setRowSpan(10).setAlign(AlignType.LEFT).setVAlign(AlignType.TOP).setColSpan(4)));
    myTable.addElement(HistoryTable);
    //input field
    myTable.addElement(new tr().addElement(new td("Input")));
    m_readOnly = false;
    m_columnName = "chatinput";
    myTable.addElement(new tr().addElement(getTextField("", 10)));
    //	 Reset
    String textbtn = "Reset";
    if (wsc.ctx != null)
        text = Msg.getMsg(wsc.ctx, "Reset");
    input restbtn = new input(input.TYPE_RESET, textbtn, "  " + text);
    restbtn.setID(text);
    restbtn.setClass("resetbtn");
    //	Submit
    textbtn = "Submit";
    if (wsc.ctx != null)
        text = Msg.getMsg(wsc.ctx, "Submit");
    input submitbtn = new input(input.TYPE_SUBMIT, textbtn, "  " + text);
    submitbtn.setID(text);
    submitbtn.setClass("submitbtn");
    //	Close
    textbtn = "Close";
    if (wsc.ctx != null)
        text = Msg.getMsg(wsc.ctx, "Close");
    input closebtn = new input(input.TYPE_SUBMIT, textbtn, "  " + text);
    closebtn.setID(text);
    closebtn.setClass("closebtn");
    closebtn.setOnClick("self.close();return false;");
    myTable.addElement(new tr().addElement(new td(null, AlignType.RIGHT, AlignType.MIDDLE, false, restbtn)).addElement(new td(null, AlignType.CENTER, AlignType.MIDDLE, false, submitbtn)).addElement(new td(null, AlignType.LEFT, AlignType.MIDDLE, false, closebtn)));
    myForm.addElement(myTable);
    center.addElement(myForm);
    return doc;
}
Also used : org.apache.ecs.xhtml.td(org.apache.ecs.xhtml.td) org.apache.ecs.xhtml.input(org.apache.ecs.xhtml.input) org.apache.ecs.xhtml.form(org.apache.ecs.xhtml.form) MChat(org.compiere.model.MChat) GridField(org.compiere.model.GridField) org.apache.ecs.xhtml.table(org.apache.ecs.xhtml.table) org.apache.ecs.xhtml.tr(org.apache.ecs.xhtml.tr)

Aggregations

GridField (org.compiere.model.GridField)114 MQuery (org.compiere.model.MQuery)15 WEditor (org.adempiere.webui.editor.WEditor)11 GridFieldVO (org.compiere.model.GridFieldVO)10 GridTab (org.compiere.model.GridTab)10 Lookup (org.compiere.model.Lookup)9 org.apache.ecs.xhtml.tr (org.apache.ecs.xhtml.tr)8 MLookup (org.compiere.model.MLookup)8 Component (java.awt.Component)7 AdempiereException (org.adempiere.exceptions.AdempiereException)7 org.apache.ecs.xhtml.form (org.apache.ecs.xhtml.form)7 org.apache.ecs.xhtml.input (org.apache.ecs.xhtml.input)7 ValueNamePair (org.compiere.util.ValueNamePair)7 SQLException (java.sql.SQLException)6 MBrowseField (org.adempiere.model.MBrowseField)6 org.apache.ecs.xhtml.td (org.apache.ecs.xhtml.td)6 VEditor (org.compiere.grid.ed.VEditor)6 Point (java.awt.Point)5 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)5 org.apache.ecs.xhtml.div (org.apache.ecs.xhtml.div)5