use of org.adempiere.webui.window.WAssignmentDialog in project adempiere by adempiere.
the class WAssignmentEditor method onEvent.
public void onEvent(Event event) throws Exception {
//
if (Events.ON_CLICK.equalsIgnoreCase(event.getName())) {
Integer oldValue = (Integer) getValue();
int S_ResourceAssignment_ID = oldValue == null ? 0 : oldValue.intValue();
MResourceAssignment ma = new MResourceAssignment(Env.getCtx(), S_ResourceAssignment_ID, null);
if (S_ResourceAssignment_ID == 0) {
if (gridField != null && gridField.getGridTab() != null) {
// assign the resource of the document if any
Object org = gridField.getGridTab().getValue("AD_Org_ID");
if (org != null && org instanceof Integer)
ma.setAD_Org_ID((Integer) org);
}
}
// Start VAssignment Dialog
if (S_ResourceAssignment_ID != 0) {
WAssignmentDialog vad = new WAssignmentDialog(ma, true, true);
ma = vad.getMResourceAssignment();
} else // Start InfoSchedule directly
{
InfoSchedule is = new InfoSchedule(ma, true);
ma = is.getMResourceAssignment();
}
// Set Value
if (ma != null && ma.getS_ResourceAssignment_ID() != 0) {
setValue(new Integer(ma.getS_ResourceAssignment_ID()));
ValueChangeEvent vce = new ValueChangeEvent(this, gridField.getColumnName(), oldValue, getValue());
fireValueChange(vce);
}
}
}
use of org.adempiere.webui.window.WAssignmentDialog in project adempiere by adempiere.
the class WSchedule method onEvent.
public void onEvent(Event event) throws Exception {
if (event instanceof MouseEvent) {
MouseEvent me = (MouseEvent) event;
if (me.getX() > 0) {
MResourceAssignment assignment = new MResourceAssignment(Env.getCtx(), me.getX(), null);
WAssignmentDialog wad = new WAssignmentDialog(assignment, false, infoSchedule.isCreateNew());
if (!wad.isCancelled()) {
_assignmentDialogResult = wad.getMResourceAssignment();
Events.echoEvent("onAssignmentCallback", this, null);
}
}
} else if (event instanceof BandScrollEvent) {
BandScrollEvent e = (BandScrollEvent) event;
Date end = e.getMax();
Date start = e.getMin();
Date mid = e.getCenter();
if (mid != null) {
m_center = mid;
infoSchedule.dateCallback(mid);
}
}
}
Aggregations