Search in sources :

Example 1 with InfoSchedule

use of org.compiere.apps.search.InfoSchedule in project adempiere by adempiere.

the class VAssignment method actionPerformed.

//  addActionListener
/**
	 * 	Action Listener - start dialog
	 * 	@param e Event
	 */
public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals(RecordInfo.CHANGE_LOG_COMMAND)) {
        RecordInfo.start(m_mField);
        return;
    }
    if (!m_button.isEnabled())
        return;
    m_button.setEnabled(false);
    //
    Integer oldValue = (Integer) getValue();
    int S_ResourceAssignment_ID = oldValue == null ? 0 : oldValue.intValue();
    MResourceAssignment ma = new MResourceAssignment(Env.getCtx(), S_ResourceAssignment_ID, null);
    //	Start VAssignment Dialog
    if (S_ResourceAssignment_ID != 0) {
        VAssignmentDialog vad = new VAssignmentDialog(Env.getFrame(this), ma, true, true);
        ma = vad.getMResourceAssignment();
    } else //	Start InfoSchedule directly
    {
        InfoSchedule is = new InfoSchedule(Env.getFrame(this), ma, true);
        ma = is.getMResourceAssignment();
    }
    //	Set Value
    if (ma != null && ma.getS_ResourceAssignment_ID() != 0) {
        setValue(new Integer(ma.getS_ResourceAssignment_ID()));
        try {
            fireVetoableChange(this.getName(), new Object(), getValue());
        } catch (PropertyVetoException pve) {
            log.log(Level.SEVERE, "", pve);
        }
    }
    m_button.setEnabled(true);
    requestFocus();
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) MResourceAssignment(org.compiere.model.MResourceAssignment) InfoSchedule(org.compiere.apps.search.InfoSchedule)

Example 2 with InfoSchedule

use of org.compiere.apps.search.InfoSchedule in project adempiere by adempiere.

the class VAssignmentDialog method actionPerformed.

//	dynInit
/**
	 * 	Action Listener
	 * 	@param e event
	 */
public void actionPerformed(ActionEvent e) {
    if (m_setting)
        return;
    //	Update Assignment
    KeyNamePair resource = (KeyNamePair) fResource.getSelectedItem();
    if (resource != null) {
        int S_Resource_ID = resource.getKey();
        m_mAssignment.setS_Resource_ID(S_Resource_ID);
    }
    Timestamp assignDateFrom = fDateFrom.getTimestamp();
    if (assignDateFrom != null)
        m_mAssignment.setAssignDateFrom(assignDateFrom);
    BigDecimal qty = (BigDecimal) fQty.getValue();
    if (qty != null)
        m_mAssignment.setQty(qty);
    m_mAssignment.setName((String) fName.getValue());
    m_mAssignment.setDescription((String) fDescription.getValue());
    //	Resource - Look up UOM
    if (e.getSource() == fResource) {
        Object o = m_lookup.get(fResource.getSelectedItem());
        if (o == null)
            lUOM.setText(" ? ");
        else
            lUOM.setText(o.toString());
    } else //	Zoom - InfoResource
    if (e.getActionCommand().equals(ConfirmPanel.A_ZOOM)) {
        InfoSchedule is = new InfoSchedule(m_frame, m_mAssignment, true);
        if (is.getMResourceAssignment() != null) {
            m_mAssignment = is.getMResourceAssignment();
            //	setDisplay();
            dispose();
        }
        is = null;
    } else //	cancel - return
    if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) {
        dispose();
    } else //	delete - delete and return
    if (e.getActionCommand().equals(ConfirmPanel.A_DELETE)) {
        if (m_mAssignment.delete(true)) {
            m_mAssignment = null;
            dispose();
        } else
            ADialog.error(0, this, "ResourceAssignmentNotDeleted");
    } else //	OK - Save
    if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
        if (cmd_save())
            dispose();
    }
}
Also used : InfoSchedule(org.compiere.apps.search.InfoSchedule) KeyNamePair(org.compiere.util.KeyNamePair) Timestamp(java.sql.Timestamp) BigDecimal(java.math.BigDecimal)

Aggregations

InfoSchedule (org.compiere.apps.search.InfoSchedule)2 PropertyVetoException (java.beans.PropertyVetoException)1 BigDecimal (java.math.BigDecimal)1 Timestamp (java.sql.Timestamp)1 MResourceAssignment (org.compiere.model.MResourceAssignment)1 KeyNamePair (org.compiere.util.KeyNamePair)1