use of net.sf.ecl.datepicker.DatePicker in project mdw-designer by CenturyLinkCloud.
the class PropertyEditor method createDatePicker.
private DatePicker createDatePicker(Composite parent) {
createLabel(parent);
int lStyle = SWT.BORDER | this.style;
if (isReadOnly())
lStyle = lStyle | SWT.READ_ONLY;
final DatePicker datePicker = new DatePicker(parent, lStyle);
datePicker.setEnabled(!isReadOnly());
GridData gd = new GridData(SWT.LEFT);
gd.widthHint = getWidth();
gd.heightHint = getHeight();
gd.horizontalSpan = COLUMNS - 1;
gd.horizontalIndent = indent;
datePicker.setLayoutData(gd);
if (getValue() != null)
updateWidget(getValue());
datePicker.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
String oldValue = value;
String newValue = "";
if (datePicker.getSelection() != null)
newValue = dateFormat.format(datePicker.getSelection().getTime());
value = newValue;
if (oldValue != null) {
boolean changed = !oldValue.equals(newValue);
if (changed)
fireValueChanged(newValue);
}
}
});
return datePicker;
}
use of net.sf.ecl.datepicker.DatePicker in project mdw-designer by CenturyLinkCloud.
the class PropertyEditor method updateWidget.
public void updateWidget(String value) {
String newValue = value == null ? "" : value;
if (type.equals(TYPE_TEXT))
((Text) widget).setText(newValue);
else if (type.equals(TYPE_COMBO))
((Combo) widget).setText(newValue);
else if (type.equals(TYPE_IMAGE_COMBO))
((ImageCombo) widget).setText(newValue);
else if (type.equals(TYPE_INFO))
((Label) widget).setText(newValue);
else if (type.equals(TYPE_PICKLIST))
((ListComposer) widget).setInput(newValue);
else if (type.equals(TYPE_RADIO))
updateRadioButtons(newValue);
else if (type.equals(TYPE_TIMER))
updateTimerInterval(newValue);
else if (type.equals(TYPE_SPINNER))
((Spinner) widget).setSelection(newValue.length() == 0 ? 0 : Integer.parseInt(newValue));
else if (type.equals(TYPE_CHECKBOX))
((Button) widget).setSelection(Boolean.parseBoolean(newValue));
else if (type.equals(TYPE_SWITCH))
((SwitchButton) widget).setSelection(Boolean.parseBoolean(newValue));
else if (type.equals(TYPE_DATE_PICKER)) {
try {
Calendar calendar = Calendar.getInstance();
if (newValue.length() == 0) {
((DatePicker) widget).setSelection(null);
} else {
calendar.setTime(new SimpleDateFormat(DATE_FORMAT).parse(newValue));
((DatePicker) widget).setSelection(calendar);
}
} catch (ParseException ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
} else if (type.equals(TYPE_BAM_MESSAGE)) {
BamEventComposer bamComposer = (BamEventComposer) widget;
bamComposer.setElement(getElement());
bamComposer.setInput(valueConverter.toModelValue(newValue));
} else if (type.equals(TYPE_PARAMETERIZED_COMBO)) {
((ParameterizedCombo) widget).setInput(valueConverter.toModelValue(newValue));
} else if (type.equals(TYPE_WEB)) {
Composite c = (Composite) widget;
Browser browser = (Browser) c.getChildren()[0];
if (newValue.startsWith("http://") || newValue.startsWith("https://"))
browser.setUrl(newValue);
else
browser.setText(newValue);
}
}
use of net.sf.ecl.datepicker.DatePicker in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceFilterDialog method createProcessTabItem.
private TabItem createProcessTabItem(TabFolder tabFolder) {
TabItem processTabItem = new TabItem(tabFolder, SWT.NULL);
processTabItem.setText("Process");
Composite composite = new Composite(tabFolder, SWT.NONE);
GridLayout gl = new GridLayout();
gl.numColumns = 5;
composite.setLayout(gl);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
// process label
new Label(composite, SWT.NONE).setText("Process:");
Label processLabel = new Label(composite, SWT.NONE);
if (process != null)
processLabel.setText(process.getName());
GridData gd = new GridData(SWT.BEGINNING);
gd.horizontalSpan = 2;
processLabel.setLayoutData(gd);
// process version
new Label(composite, SWT.NONE).setText("Version:");
versionCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
versionCombo.removeAll();
versionCombo.add("");
for (WorkflowProcess pv : process.getAllProcessVersions()) versionCombo.add(pv.getVersionString());
if (process.getId() == 0)
versionCombo.setText("");
else
versionCombo.setText(process.getVersionString());
versionCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
filter.setProcess(versionCombo.getText().trim());
}
});
Label vSpacer = new Label(composite, SWT.NONE);
gd = new GridData(SWT.BEGINNING);
gd.heightHint = 1;
gd.horizontalSpan = 5;
vSpacer.setLayoutData(gd);
// instance id
new Label(composite, SWT.NONE).setText("Instance ID:");
instanceIdText = new Text(composite, SWT.BORDER | SWT.SINGLE);
gd = new GridData(SWT.BEGINNING);
gd.widthHint = 100;
instanceIdText.setLayoutData(gd);
if (filter.getProcessInstanceId() != null)
instanceIdText.setText(filter.getProcessInstanceId().toString());
instanceIdText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
try {
if (instanceIdText.getText().trim().length() == 0)
filter.setProcessInstanceId(null);
else
filter.setProcessInstanceId(Long.parseLong(instanceIdText.getText().trim()));
} catch (NumberFormatException ex) {
if (filter.getProcessInstanceId() == null)
instanceIdText.setText("");
else
instanceIdText.setText(filter.getProcessInstanceId().toString());
}
}
});
new Label(composite, SWT.NONE).setText("");
// master request id
new Label(composite, SWT.NONE).setText("Master Request ID:");
masterRequestIdText = new Text(composite, SWT.BORDER | SWT.SINGLE);
gd = new GridData(SWT.BEGINNING);
gd.widthHint = 100;
masterRequestIdText.setLayoutData(gd);
if (filter.getMasterRequestId() != null)
masterRequestIdText.setText(filter.getMasterRequestId());
masterRequestIdText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (masterRequestIdText.getText().trim().length() == 0)
filter.setMasterRequestId(null);
else
filter.setMasterRequestId(masterRequestIdText.getText().trim());
}
});
// owner
new Label(composite, SWT.NONE).setText("Owner Type:");
ownerCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
ownerCombo.removeAll();
ownerCombo.add("");
for (String ownerType : ownerTypes.keySet()) ownerCombo.add(ownerType);
if (filter.getOwner() != null)
ownerCombo.setText(getOwnerType(filter.getOwner()));
ownerCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (ownerCombo.getText().trim().length() == 0)
filter.setOwner(null);
else
filter.setOwner(ownerTypes.get(ownerCombo.getText().trim()));
}
});
Label spacer = new Label(composite, SWT.NONE);
gd = new GridData(SWT.BEGINNING);
gd.widthHint = 20;
spacer.setLayoutData(gd);
// owner id
new Label(composite, SWT.NONE).setText("Owner ID:");
ownerIdText = new Text(composite, SWT.BORDER | SWT.SINGLE);
gd = new GridData(SWT.BEGINNING);
gd.widthHint = 100;
ownerIdText.setLayoutData(gd);
if (filter.getOwnerId() != null)
ownerIdText.setText(filter.getOwnerId().toString());
ownerIdText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
try {
if (ownerIdText.getText().trim().length() == 0)
filter.setOwnerId(null);
else
filter.setOwnerId(Long.parseLong(ownerIdText.getText().trim()));
} catch (NumberFormatException ex) {
if (filter.getOwnerId() == null)
ownerIdText.setText("");
else
ownerIdText.setText(filter.getOwnerId().toString());
}
}
});
// status
new Label(composite, SWT.NONE).setText("Status:");
statusCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
statusCombo.removeAll();
statusCombo.add("");
for (String status : statuses.keySet()) statusCombo.add(status);
gd = new GridData(SWT.BEGINNING);
gd.horizontalSpan = 4;
statusCombo.setLayoutData(gd);
if (filter.getStatusCode() != null)
statusCombo.setText(getStatus(filter.getStatusCode()));
statusCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (statusCombo.getText().trim().length() == 0)
filter.setStatusCode(null);
else
filter.setStatusCode(statuses.get(statusCombo.getText().trim()));
}
});
// start date range
new Label(composite, SWT.NONE).setText("Start Date:");
Group startDateGroup = new Group(composite, SWT.NONE);
gl = new GridLayout();
gl.numColumns = 7;
startDateGroup.setLayout(gl);
gd = new GridData(SWT.BEGINNING);
gd.horizontalSpan = 4;
startDateGroup.setLayoutData(gd);
// start date from
new Label(startDateGroup, SWT.NONE).setText("From:");
startFromDatePicker = new DatePicker(startDateGroup, SWT.BORDER);
Calendar startFrom = null;
if (filter.getStartDateFrom() != null) {
startFrom = Calendar.getInstance();
startFrom.setTime(filter.getStartDateFrom());
}
startFromDatePicker.setSelection(startFrom);
startFromDatePicker.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (startFromDatePicker.getSelection() == null)
filter.setStartDateFrom(null);
else
filter.setStartDateFrom(startFromDatePicker.getSelection().getTime());
}
});
spacer = new Label(startDateGroup, SWT.NONE);
gd = new GridData(SWT.BEGINNING);
gd.widthHint = 10;
spacer.setLayoutData(gd);
// start date to
new Label(startDateGroup, SWT.NONE).setText("To:");
startToDatePicker = new DatePicker(startDateGroup, SWT.BORDER);
Calendar startTo = null;
if (filter.getStartDateTo() != null) {
startTo = Calendar.getInstance();
startTo.setTime(filter.getStartDateTo());
}
startToDatePicker.setSelection(startTo);
startToDatePicker.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (startToDatePicker.getSelection() == null)
filter.setStartDateTo(null);
else
filter.setStartDateTo(startToDatePicker.getSelection().getTime());
}
});
spacer = new Label(startDateGroup, SWT.NONE);
gd = new GridData(SWT.BEGINNING);
gd.widthHint = 10;
spacer.setLayoutData(gd);
// start date clear
Button startDateClearButton = new Button(startDateGroup, SWT.PUSH);
startDateClearButton.setImage(MdwPlugin.getImageDescriptor("icons/clear.gif").createImage());
startDateClearButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
startToDatePicker.setSelection(null);
startFromDatePicker.setSelection(null);
}
});
// end date range
new Label(composite, SWT.NONE).setText("End Date:");
Group endDateGroup = new Group(composite, SWT.NONE);
gl = new GridLayout();
gl.numColumns = 7;
endDateGroup.setLayout(gl);
gd = new GridData(SWT.BEGINNING);
gd.horizontalSpan = 4;
endDateGroup.setLayoutData(gd);
// end date from
new Label(endDateGroup, SWT.NONE).setText("From:");
endFromDatePicker = new DatePicker(endDateGroup, SWT.BORDER);
Calendar endFrom = null;
if (filter.getEndDateFrom() != null) {
endFrom = Calendar.getInstance();
endFrom.setTime(filter.getEndDateFrom());
}
endFromDatePicker.setSelection(endFrom);
endFromDatePicker.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (endFromDatePicker.getSelection() == null)
filter.setEndDateFrom(null);
else
filter.setEndDateFrom(endFromDatePicker.getSelection().getTime());
if (filter.getEndDateFrom() != null && endToDatePicker.getSelection() == null) {
Calendar endTo = endFromDatePicker.getSelection();
endTo.add(Calendar.DATE, 7);
endToDatePicker.setSelection(endTo);
}
}
});
spacer = new Label(endDateGroup, SWT.NONE);
gd = new GridData(SWT.BEGINNING);
gd.widthHint = 10;
spacer.setLayoutData(gd);
// end date to
new Label(endDateGroup, SWT.NONE).setText("To:");
endToDatePicker = new DatePicker(endDateGroup, SWT.BORDER);
Calendar endTo = null;
if (filter.getEndDateTo() != null) {
endTo = Calendar.getInstance();
endTo.setTime(filter.getEndDateTo());
}
endToDatePicker.setSelection(endTo);
endToDatePicker.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (endToDatePicker.getSelection() == null)
filter.setEndDateTo(null);
else
filter.setEndDateTo(endToDatePicker.getSelection().getTime());
}
});
spacer = new Label(endDateGroup, SWT.NONE);
gd = new GridData(SWT.BEGINNING);
gd.widthHint = 10;
spacer.setLayoutData(gd);
// end date clear
Button endDateClearButton = new Button(endDateGroup, SWT.PUSH);
endDateClearButton.setImage(MdwPlugin.getImageDescriptor("icons/clear.gif").createImage());
endDateClearButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
endToDatePicker.setSelection(null);
endFromDatePicker.setSelection(null);
}
});
vSpacer = new Label(composite, SWT.NONE);
gd = new GridData(SWT.BEGINNING);
gd.heightHint = 1;
gd.horizontalSpan = 5;
vSpacer.setLayoutData(gd);
// max rows
new Label(composite, SWT.NONE).setText("Page Size:");
pageSizeSpinner = new Spinner(composite, SWT.BORDER);
pageSizeSpinner.setMinimum(10);
pageSizeSpinner.setMaximum(100);
pageSizeSpinner.setIncrement(10);
if (filter.getPageSize() != null)
pageSizeSpinner.setSelection(filter.getPageSize().intValue());
pageSizeSpinner.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
filter.setPageSize(pageSizeSpinner.getSelection());
}
});
processTabItem.setControl(composite);
return processTabItem;
}
Aggregations