Search in sources :

Example 6 with MWFNode

use of org.compiere.wf.MWFNode in project adempiere by adempiere.

the class WFActivity method display.

//	loadActivities
/**
	 * 	Display.
	 * 	@param index index of table
	 * 	Fill Editors
	 */
public void display(IDColumn id) {
    log.fine("ID=" + id);
    m_activity = resetDisplay(id);
    //
    if (m_menu != null) {
        m_menu.updateActivities(selTable.getModel().getRowCount());
    }
    if (m_activity == null)
        return;
    //	Display Activity
    fNode.setText(m_activity.getNodeName());
    fDescription.setText(m_activity.getNodeDescription());
    fHelp.setText(m_activity.getNodeHelp());
    //
    fHistory.setText(m_activity.getHistoryHTML());
    //	User Actions
    MWFNode node = m_activity.getNode();
    if (MWFNode.ACTION_UserChoice.equals(node.getAction())) {
        if (m_column == null)
            m_column = node.getColumn();
        if (m_column != null && m_column.get_ID() != 0) {
            int dt = m_column.getAD_Reference_ID();
            if (dt == DisplayType.YesNo) {
                //	_YesNo
                ValueNamePair[] values = MRefList.getList(Env.getCtx(), 319, false);
                fAnswerList.setModel(new DefaultComboBoxModel(values));
                fAnswerList.setVisible(true);
            } else if (dt == DisplayType.List) {
                ValueNamePair[] values = MRefList.getList(Env.getCtx(), m_column.getAD_Reference_Value_ID(), false);
                fAnswerList.setModel(new DefaultComboBoxModel(values));
                fAnswerList.setVisible(true);
            } else //	other display types come here
            {
                fAnswerText.setText("");
                fAnswerText.setVisible(true);
            }
        }
    } else //	--
    if (MWFNode.ACTION_UserWindow.equals(node.getAction()) || MWFNode.ACTION_UserForm.equals(node.getAction())) {
        fAnswerButton.setText(node.getName());
        fAnswerButton.setToolTipText(node.getDescription());
        fAnswerButton.setVisible(true);
    } else
        /*
		else if (MWFNode.ACTION_UserWorkbench.equals(node.getAction()))
			log.log(Level.SEVERE, "Workflow Action not implemented yet"); */
        log.log(Level.SEVERE, "Unknown Node Action: " + node.getAction());
    statusBar.setStatusDB(String.valueOf(selTable.getSelectedRow() + 1) + "/" + selTable.getRowCount());
    statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFActivities"));
}
Also used : MWFNode(org.compiere.wf.MWFNode) ValueNamePair(org.compiere.util.ValueNamePair) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Example 7 with MWFNode

use of org.compiere.wf.MWFNode in project adempiere by adempiere.

the class WFActivity method cmd_button.

//	cmd_zoom
/**
	 * 	Answer Button
	 */
private void cmd_button() {
    log.config("Activity=" + m_activity);
    if (m_activity == null)
        return;
    //
    MWFNode node = m_activity.getNode();
    if (MWFNode.ACTION_UserWindow.equals(node.getAction())) {
        // Explicit Window
        int AD_Window_ID = node.getAD_Window_ID();
        String ColumnName = m_activity.getPO().get_TableName() + "_ID";
        int Record_ID = m_activity.getRecord_ID();
        MQuery query = MQuery.getEqualQuery(ColumnName, Record_ID);
        boolean IsSOTrx = m_activity.isSOTrx();
        //
        log.info("Zoom to AD_Window_ID=" + AD_Window_ID + " - " + query + " (IsSOTrx=" + IsSOTrx + ")");
        AWindow frame = new AWindow();
        if (!frame.initWindow(AD_Window_ID, query))
            return;
        AEnv.addToWindowManager(frame);
        AEnv.showCenterScreen(frame);
        frame = null;
    } else if (MWFNode.ACTION_UserForm.equals(node.getAction())) {
        int AD_Form_ID = node.getAD_Form_ID();
        FormFrame ff = new FormFrame();
        ff.openForm(AD_Form_ID);
        ff.pack();
        AEnv.addToWindowManager(ff);
        AEnv.showCenterScreen(ff);
    } else if (MWFNode.ACTION_SmartBrowse.equals(node.getAction())) {
        CFrame ff = VBrowser.openBrowse(0, node.getAD_Browse_ID(), "", m_activity.isSOTrx());
        ff.pack();
        AEnv.addToWindowManager(ff);
        AEnv.showCenterScreen(ff);
    } else
        /*
		else if (MWFNode.ACTION_UserWorkbench.equals(node.getAction()))
		{
			
		}*/
        log.log(Level.SEVERE, "No User Action:" + node.getAction());
}
Also used : AWindow(org.compiere.apps.AWindow) FormFrame(org.compiere.apps.form.FormFrame) MWFNode(org.compiere.wf.MWFNode) MQuery(org.compiere.model.MQuery) CFrame(org.compiere.swing.CFrame)

Example 8 with MWFNode

use of org.compiere.wf.MWFNode in project adempiere by adempiere.

the class WFContentPanel method mouseClicked.

//	getComponentAt
/**************************************************************************
	 * 	Mouse Clicked.
	 * 	Pressed - Released - Clicked.
	 *	@param e event
	 */
public void mouseClicked(MouseEvent e) {
    if (m_readWrite && SwingUtilities.isRightMouseButton(e)) {
        int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
        if (e.getSource() == this && m_wf != null) {
            m_NewPopupMenu.show(this, e.getX(), e.getY());
        } else if (e.getSource() instanceof WFNode) {
            MWFNode node = ((WFNode) e.getSource()).getModel();
            m_LinePopupMenu = new JPopupMenu(node.getName());
            if (node.getAD_Client_ID() == AD_Client_ID) {
                String title = Msg.getMsg(Env.getCtx(), "DeleteNode") + ": " + node.getName();
                addMenuItem(m_LinePopupMenu, title, node, -1);
                m_LinePopupMenu.addSeparator();
            }
            MWFNode[] nodes = m_wf.getNodes(true, AD_Client_ID);
            MWFNodeNext[] lines = node.getTransitions(AD_Client_ID);
            //	Add New Line
            for (int n = 0; n < nodes.length; n++) {
                MWFNode nn = nodes[n];
                if (nn.getAD_WF_Node_ID() == node.getAD_WF_Node_ID())
                    //	same
                    continue;
                boolean found = false;
                for (int i = 0; i < lines.length; i++) {
                    MWFNodeNext line = lines[i];
                    if (nn.getAD_WF_Node_ID() == line.getAD_WF_Next_ID()) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    String title = Msg.getMsg(Env.getCtx(), "AddLine") + ": " + node.getName() + " -> " + nn.getName();
                    addMenuItem(m_LinePopupMenu, title, node, nn.getAD_WF_Node_ID());
                }
            }
            m_LinePopupMenu.addSeparator();
            //	Delete Lines
            for (int i = 0; i < lines.length; i++) {
                MWFNodeNext line = lines[i];
                if (line.getAD_Client_ID() != AD_Client_ID)
                    continue;
                MWFNode next = MWFNode.get(Env.getCtx(), line.getAD_WF_Next_ID());
                String title = Msg.getMsg(Env.getCtx(), "DeleteLine") + ": " + node.getName() + " -> " + next.getName();
                addMenuItem(m_LinePopupMenu, title, line);
            }
            m_LinePopupMenu.show(this, e.getX(), e.getY());
        }
    } else //	Selection
    if (e.getSource() instanceof WFNode) {
        WFNode selected = (WFNode) e.getSource();
        log.fine(selected.toString());
        for (int i = 0; i < m_nodes.size(); i++) {
            WFNode node = (WFNode) m_nodes.get(i);
            if (selected.getAD_WF_Node_ID() == node.getAD_WF_Node_ID())
                node.setSelected(true);
            else
                node.setSelected(false);
        }
    }
    m_dragged = false;
}
Also used : MWFNode(org.compiere.wf.MWFNode) MWFNode(org.compiere.wf.MWFNode) MWFNodeNext(org.compiere.wf.MWFNodeNext) Point(java.awt.Point) JPopupMenu(javax.swing.JPopupMenu)

Example 9 with MWFNode

use of org.compiere.wf.MWFNode in project adempiere by adempiere.

the class ImportWorkflow method getWorkflowNode.

/**
	 * Search custom AD_WF_Node, if it does not exist, create it
	 * 
	 * @param iWf
	 *            , wf
	 * @return custom AD_WF_Node
	 */
private MWFNode getWorkflowNode(X_I_Workflow importWorkflow, MWorkflow workflow) {
    final String whereClause = MWFNode.COLUMNNAME_AD_Workflow_ID + "=? AND " + MWFNode.COLUMNNAME_Value + "=? AND " + MWFNode.COLUMNNAME_Name + "=?";
    MWFNode node = new Query(getCtx(), MWFNode.Table_Name, whereClause, get_TrxName()).setClient_ID().setParameters(workflow.get_ID(), importWorkflow.getNodeValue(), importWorkflow.getNodeName()).first();
    if (node == null) {
        node = new MWFNode(getCtx(), 0, get_TrxName());
        node.setValue(importWorkflow.getNodeValue());
        node.setName(importWorkflow.getNodeName());
    }
    node.setDescription(importWorkflow.getDescription());
    node.setIsCentrallyMaintained(importWorkflow.isCentrallyMaintained());
    node.setStartMode(importWorkflow.getStartMode());
    node.setFinishMode(importWorkflow.getFinishMode());
    node.setJoinElement(importWorkflow.getJoinElement());
    node.setSplitElement(importWorkflow.getSplitElement());
    node.setAction(importWorkflow.getAction());
    node.setAD_Image_ID(importWorkflow.getAD_Image_ID());
    node.setDocAction(importWorkflow.getDocAction());
    node.setDynPriorityUnit(importWorkflow.getDynPriorityUnit());
    node.setDynPriorityChange(importWorkflow.getDynPriorityChange());
    node.setAD_WF_Responsible_ID(importWorkflow.getAD_WF_Responsible_ID());
    node.setPriority(importWorkflow.getPriority());
    node.setLimit(importWorkflow.getLimit());
    node.setDuration(importWorkflow.getDuration());
    node.setCost(importWorkflow.getCost());
    node.setWorkingTime(importWorkflow.getWorkingTime());
    node.setWaitingTime(importWorkflow.getWaitingTime());
    node.setEntityType(importWorkflow.getEntityType());
    node.setAD_Column_ID(importWorkflow.getAD_Column_ID());
    node.setAttributeName(importWorkflow.getAttributeName());
    node.setAttributeValue(importWorkflow.getAttributeValue());
    node.setEMailRecipient(importWorkflow.getEMailRecipient());
    node.setEMail(importWorkflow.getEMail());
    node.setSubflowExecution(importWorkflow.getSubflowExecution());
    node.setAD_Process_ID(importWorkflow.getAD_Process_ID());
    node.setAD_Window_ID(importWorkflow.getAD_Window_ID());
    node.setAD_Form_ID(importWorkflow.getAD_Form_ID());
    node.setR_MailText_ID(importWorkflow.getR_MailText_ID());
    node.setAD_Task_ID(importWorkflow.getAD_Task_ID());
    node.setWaitTime(importWorkflow.getWaitTime());
    node.setAD_Workflow_ID(workflow.get_ID());
    // Manufacturing
    node.setIsMilestone(importWorkflow.isMilestone());
    node.setIsSubcontracting(importWorkflow.isSubcontracting());
    node.setMovingTime(importWorkflow.getMovingTime());
    node.setOverlapUnits(importWorkflow.getOverlapUnits());
    node.setQueuingTime(importWorkflow.getQueuingTime());
    node.setS_Resource_ID(importWorkflow.getS_Resource_ID());
    node.setSetupTime(importWorkflow.getSetupTime());
    node.setUnitsCycles(importWorkflow.getUnitsCycles());
    node.setValidFrom(importWorkflow.getValidFrom());
    node.setValidTo(importWorkflow.getValidTo());
    node.setYield(importWorkflow.getYield());
    node.saveEx();
    return node;
}
Also used : Query(org.compiere.model.Query) MWFNode(org.compiere.wf.MWFNode)

Example 10 with MWFNode

use of org.compiere.wf.MWFNode in project adempiere by adempiere.

the class WFPanel method start.

//	actionPerformed
/**************************************************************************
	 * 	Start Node
	 * 	@param node node
	 */
public void start(WFNode node) {
    log.fine("Node=" + node);
    MWFNode model = node.getModel();
    //	Info Text
    StringBuffer msg = new StringBuffer("<HTML>");
    msg.append("<H2>").append(model.getName(true)).append("</H2>");
    String s = model.getDescription(true);
    if (s != null && s.length() > 0)
        msg.append("<B>").append(s).append("</B>");
    s = model.getHelp(true);
    if (s != null && s.length() > 0)
        msg.append("<BR>").append(s);
    msg.append("</HTML>");
    infoTextPane.setText(msg.toString());
    infoTextPane.setCaretPosition(0);
    //	Load Window
    if (m_menu != null)
        //	async load
        (new AMenuStartItem(model.getAD_WF_Node_ID(), false, model.getName(true), m_menu)).start();
    //
    m_activeNode = node;
    //
    int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
    boolean first = m_wf.isFirst(m_activeNode.getAD_WF_Node_ID(), AD_Client_ID);
    boolean last = m_wf.isLast(m_activeNode.getAD_WF_Node_ID(), AD_Client_ID);
    wfStart.setEnabled(!first);
    wfBack.setEnabled(!first);
    wfNext.setEnabled(!last);
    wfEnd.setEnabled(!last);
}
Also used : AMenuStartItem(org.compiere.apps.AMenuStartItem) MWFNode(org.compiere.wf.MWFNode) Point(java.awt.Point)

Aggregations

MWFNode (org.compiere.wf.MWFNode)29 MWorkflow (org.compiere.wf.MWorkflow)17 MWFNodeNext (org.compiere.wf.MWFNodeNext)8 ArrayList (java.util.ArrayList)7 Point (java.awt.Point)4 HttpSession (javax.servlet.http.HttpSession)4 BufferedImage (java.awt.image.BufferedImage)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 Properties (java.util.Properties)3 WFLine (org.compiere.apps.wf.WFLine)3 Trx (org.compiere.util.Trx)3 ValueNamePair (org.compiere.util.ValueNamePair)3 Dimension (java.awt.Dimension)2 BigDecimal (java.math.BigDecimal)2 SQLException (java.sql.SQLException)2 MProduct (org.compiere.model.MProduct)2 Query (org.compiere.model.Query)2 WebDoc (org.compiere.util.WebDoc)2 WebSessionCtx (org.compiere.util.WebSessionCtx)2 AImage (org.zkoss.image.AImage)2