Java Code Examples for com.smartgwt.client.widgets.form.fields.CheckboxItem#setWidth()

The following examples show how to use com.smartgwt.client.widgets.form.fields.CheckboxItem#setWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorkflowTaskFormView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private FormItem createFormItem(DisplayType displayType, Record profile) {
    String name = profile.getAttribute(WorkflowParameterDataSource.FIELD_NAME);
    switch (displayType) {
        case SELECT:
            SelectItem si = new SelectItem();
            setOptions(si, profile);
            si.setWidth("*");
            return si;
        case COMBOBOX:
            ComboBoxItem cbi = new ComboBoxItem();
            setOptions(cbi, profile);
            cbi.setLength(2000);
            cbi.setWidth("*");
            return cbi;
        case CHECKBOX:
            CheckboxItem ci = new CheckboxItem();
            // the width must be set otherwise it overflows the form
            ci.setWidth(150);
            ci.setAllowEmptyValue(true);
            return ci;
        case TEXTAREA:
            TextAreaItem tai = new TextAreaItem();
            tai.setStartRow(true);
            tai.setEndRow(true);
            tai.setLength(2000);
            tai.setColSpan("*");
            tai.setWidth("*");
            tai.setHeight(30);
            return tai;
        case DATETIME:
            DateTimeItem di = new DateTimeItem();
            return di;
        case TEXT:
        default:
            TextItem ti = new TextItem(name);
            ti.setLength(2000);
            ti.setWidth("*");
            return ti;
    }
}
 
Example 2
Source File: TaskNotificationPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onDraw() {
	VLayout notificationsPane = new VLayout();
	setMembers(notificationsPane);

	final DynamicForm notificationsForm = new DynamicForm();
	notificationsForm.setColWidths(1, "*");
	notificationsForm.setMargin(3);

	List<FormItem> items = new ArrayList<FormItem>();

	// Enable/Disable notifications
	CheckboxItem sendReport = new CheckboxItem();
	sendReport.setName("sendReport");
	sendReport.setTitle(I18N.message("sendactivityreport"));
	sendReport.setRedrawOnChange(true);
	sendReport.setWidth(50);
	sendReport.setValue(task.isSendActivityReport());
	sendReport.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			task.setSendActivityReport("true".equals(notificationsForm.getValue("sendReport").toString()));

			// Notify the external handler
			changedHandler.onChanged(event);
		}
	});

	items.add(sendReport);

	Long[] ids = new Long[task.getReportRecipients().length];
	for (int i = 0; i < ids.length; i++)
		ids[i] = task.getReportRecipients()[i].getId();

	recipients = ItemFactory.newMultiComboBoxItem("recipients", "recipients", new UsersDS(null, false), ids);
	recipients.setValueField("id");
	recipients.setDisplayField("username");
	recipients.addChangedHandler(changedHandler);
	items.add(recipients);

	notificationsForm.setItems(items.toArray(new FormItem[0]));
	notificationsPane.setMembers(notificationsForm);
}