本文整理汇总了Java中com.smartgwt.client.widgets.form.fields.FormItem类的典型用法代码示例。如果您正苦于以下问题:Java FormItem类的具体用法?Java FormItem怎么用?Java FormItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FormItem类属于com.smartgwt.client.widgets.form.fields包,在下文中一共展示了FormItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: focusInputField
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
void focusInputField(final FormItem focusItem) {
Scheduler.get().scheduleDeferred( new Scheduler.ScheduledCommand() {
@Override
public void execute() {
// Reset the search field for next time
focusItem.focusInItem();
}
});
// DeferredCommand.addCommand(new Command() {
// public void execute() {
// // Reset the search field for next time
// focusItem.focusInItem();
// }
// });
}
示例2: focusInputField
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
void focusInputField(final FormItem focusItem) {
Scheduler.get().scheduleDeferred( new Scheduler.ScheduledCommand() {
@Override
public void execute() {
// Reset the search field for next time
focusItem.focusInItem();
}
});
// DeferredCommand.addCommand(new Command() {
// public void execute() {
// // Reset the search field for next time
// focusItem.focusInItem();
// }
// });
}
示例3: createItem
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
public FormItem createItem(final Field f, final String lang) {
ItemType itemType = getType(f);
FormItem formItem = null;
switch (itemType) {
case PLAIN:
formItem = getFormItem(f, lang);
break;
case ARRAY:
// XXX replace StringFormFactory with a generic type solution
formItem = new RepeatableFormItem(f,
new StringFormFactory(f.getName(), f.getTitle(lang), false));
break;
case FORM:
formItem = createNestedFormItem(f, lang);
break;
case CUSTOM_FORM:
formItem = createNestedCustomFormItem(f, lang);
break;
}
return customizeFormItem(formItem, f);
}
示例4: setOptionDataSource
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
private void setOptionDataSource(FormItem item, Field f, String lang) {
Field optionField = f.getOptionDataSource();
DataSource ds = ValueMapDataSource.getInstance().getOptionDataSource(optionField.getName());
item.setValueField(f.getOptionValueField()[0]);
item.setOptionDataSource(ds);
setPickListValueMapping(item, f);
Integer pickListWidth = getWidthAsInteger(optionField.getWidth());
if (item instanceof SelectItem) {
SelectItem selectItem = (SelectItem) item;
selectItem.setPickListFields(getPickListFields(optionField, lang));
if (pickListWidth != null) {
selectItem.setPickListWidth(pickListWidth);
}
} else if (item instanceof ComboBoxItem) {
ComboBoxItem cbi = (ComboBoxItem) item;
cbi.setPickListFields(getPickListFields(optionField, lang));
if (pickListWidth != null) {
cbi.setPickListWidth(pickListWidth);
}
}
}
示例5: customizeFormItem
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
/**
* Adds common properties to simple {@link #getFormItem items}.
*/
public FormItem customizeFormItem(FormItem item, Field f) {
if (item.getTitle() == null) {
item.setShowTitle(false);
}
item.setRequired(f.getRequired());
item.setPrompt(f.getHint(activeLocale));
item.setHoverWidth(defaultHoverWidth);
if (f.getHidden() != null && f.getHidden()) {
item.setVisible(false);
}
String width = f.getWidth();
if (width != null) {
item.setWidth(width);
}
if (f.getHeight() != null) {
item.setHeight(f.getHeight());
}
if (f.getReadOnly() != null && f.getReadOnly()) {
item.setCanEdit(!f.getReadOnly());
}
return item;
}
示例6: getFormItem
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
public FormItem getFormItem(Field f, String lang) {
FormItem formItem;
String type = f.getType();
if (Field.TEXT.equals(type)) {
formItem = getTextFormItem(f, lang);
} else if (Field.TEXTAREA.equals(type)) {
formItem = getTextAreaFormItem(f, lang);
} else if (Field.G_YEAR.equals(type)) {
formItem = getDateYearFormItem(f, lang);
} else if (Field.DATE.equals(type)) {
formItem = getDateFormItem(f, lang);
} else if (Field.COMBO.equals(type)) {
formItem = getComboBoxItem(f, lang);
} else if (Field.SELECT.equals(type)) {
formItem = getSelectItem(f, lang);
} else if (Field.RADIOGROUP.equals(type)) {
formItem = getRadioGroupItem(f, lang);
} else { // fallback
formItem = getTextFormItem(f, lang);
}
return formItem;
}
示例7: formatValue
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
@Override
public String formatValue(Object value, Record record, DynamicForm form, FormItem item) {
// ClientUtils.severe(LOG, "format: class: %s, value: %s", ClientUtils.safeGetClass(value), value);
if (value == null) {
return null;
}
try {
Date date = value instanceof Date
? (Date) value : ISO_FORMAT.parse((String) value);
return displayFormat.format(date);
} catch (IllegalArgumentException ex) {
String toString = String.valueOf(value);
LOG.log(Level.WARNING, toString, ex);
return toString;
}
}
示例8: parseValue
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
@Override
public Object parseValue(String value, DynamicForm form, FormItem item) {
// ClientUtils.severe(LOG, "parse: value: %s", value);
Object result = null;
if (value != null && !value.isEmpty()) {
try {
Date date = displayFormat.parse(value);
result = ISO_FORMAT.format(date);
} catch (IllegalArgumentException ex) {
String toString = String.valueOf(value);
LOG.log(Level.WARNING, toString, ex);
result = null;
}
}
return result;
}
示例9: createFullForm
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
private DynamicForm createFullForm() {
DynamicForm f = new DynamicForm();
f.setWidth100();
f.setNumCols(2);
f.setBrowserSpellCheck(false);
f.setWrapItemTitles(false);
f.setTitleOrientation(TitleOrientation.TOP);
ArrayList<FormItem> items = new ArrayList<FormItem>();
addElement(items, DcConstants.CONTRIBUTOR, null, true);
addElement(items, DcConstants.COVERAGE, null, true);
addElement(items, DcConstants.CREATOR, null, true);
addElement(items, DcConstants.DATE, null, true);
addElement(items, DcConstants.DESCRIPTION, null, true);
addElement(items, DcConstants.FORMAT, null, true);
addElement(items, DcConstants.IDENTIFIER, null, true);
addElement(items, DcConstants.LANGUAGE, null, true);
addElement(items, DcConstants.PUBLISHER, null, true);
addElement(items, DcConstants.RELATION, null, true);
addElement(items, DcConstants.RIGHTS, null, true);
addElement(items, DcConstants.SOURCE, null, true);
addElement(items, DcConstants.SUBJECT, null, true);
addElement(items, DcConstants.TITLE, null, true);
addElement(items, DcConstants.TYPE, null, true);
f.setFields(items.toArray(new FormItem[items.size()]));
return f;
}
示例10: creatFormItems
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
private LinkedHashMap<String, FormItem> creatFormItems() {
return new FormItemBuilder().addItem(DcConstants.TITLE, i18n.DCEditor_Titles_Title())
.addItem(DcConstants.IDENTIFIER, i18n.DCEditor_Identifiers_Title())
.addItem(DcConstants.CREATOR, i18n.DCEditor_Creators_Title())
.addItem(DcConstants.CONTRIBUTOR, i18n.DCEditor_Contributors_Title())
.addItem(DcConstants.COVERAGE, i18n.DCEditor_Coverage_Title())
.addItem(DcConstants.DATE, i18n.DCEditor_Dates_Title())
.addItem(DcConstants.FORMAT, i18n.DCEditor_Formats_Title())
.addItem(DcConstants.LANGUAGE, i18n.DCEditor_Language_Title())
.addItem(DcConstants.PUBLISHER, i18n.DCEditor_Publishers_Title())
.addItem(DcConstants.RELATION, i18n.DCEditor_Relations_Title())
.addItem(DcConstants.RIGHTS, i18n.DCEditor_Rights_Title())
.addItem(DcConstants.SOURCE, i18n.DCEditor_Sources_Title())
.addItem(DcConstants.SUBJECT, i18n.DCEditor_Subjects_Title())
.addItem(DcConstants.TYPE, i18n.DCEditor_Types_Title())
.addItem(DcConstants.DESCRIPTION, i18n.DCEditor_Descriptions_Title())
.getItems();
}
示例11: createFormItem
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
private FormItem createFormItem(Record editedRecord, ValueType valueType, DisplayType displayType) {
FormItem fi = createFormItem(displayType, editedRecord);
Boolean required = editedRecord.getAttributeAsBoolean(WorkflowModelConsts.PARAMETER_REQUIRED);
ArrayList<Validator> validators = new ArrayList<Validator>();
if (required != null && required) {
validators.add(new RequiredIfValidator(requiredFunc));
}
if (valueType == ValueType.NUMBER && displayType != DisplayType.CHECKBOX) {
validators.add(new IsFloatValidator());
}
if (!validators.isEmpty()) {
fi.setValidators(validators.toArray(new Validator[validators.size()]));
}
return fi;
}
示例12: resolveRecordValues
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
/**
* Replace string values of record attributes with types declared by item children.
* This is necessary as declarative forms do not use DataSource stuff.
* @param record record to scan for attributes
* @param item item with possible profile
* @return resolved record
*/
private static Record resolveRecordValues(Record record, FormItem item) {
Field f = getProfile(item);
if (f != null) {
for (Field field : f.getFields()) {
String fType = field.getType();
if ("date".equals(fType) || "datetime".equals(fType)) {
// parses ISO dateTime to Date; otherwise DateItem cannot recognize the value!
Object value = record.getAttributeAsObject(field.getName());
if (!(value instanceof String)) {
continue;
}
String sd = (String) value;
// ClientUtils.severe(LOG, "name: %s, is date, %s", field.getName(), sd);
// Date d = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse("1994-11-05T13:15:30Z");
try {
Date d = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse(sd);
record.setAttribute(field.getName(), d);
} catch (IllegalArgumentException ex) {
LOG.log(Level.WARNING, sd, ex);
}
}
}
}
return record;
}
示例13: getForm
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
protected DynamicForm getForm(String headerString, FormItem... fields) {
final DynamicForm form = new DynamicForm();
// form.setBorder("1px solid");
form.setWidth(280);
HeaderItem header = new HeaderItem();
header.setDefaultValue(headerString);
ArrayList<FormItem> list = new ArrayList<FormItem>(fields.length+1);
list.add(header);
for (FormItem field: fields) {
list.add(field);
}
form.setFields(list.toArray(new FormItem[]{}));
return form;
}
示例14: createOpenQuestionWithImage
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
private void createOpenQuestionWithImage() {
openQuestionWithImageCBItem = new CheckboxItem();
openQuestionWithImageCBItem.setName("openQuestionWithImage");
openQuestionWithImageCBItem.setTitle(constants.answerWithPicture());
openQuestionWithImageCBItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem item, Object value, DynamicForm form) {
if (form.getValue("isOpenQuestion") == null) return false;
return form.getValue("isOpenQuestion").equals(Boolean.TRUE);
}
});
// openQuestionWithImageCBItem.addChangedHandler(new ChangedHandler() {
//
// @Override
// public void onChanged(ChangedEvent event) {
// if ((Boolean)form.getValue("openQuestionWithImage")) form.setValue("openQuestionWithVideo", false);
// }
// });
openQuestionWithImageCBItem.setStartRow(true);
}
示例15: createOpenQuestionWithVideo
import com.smartgwt.client.widgets.form.fields.FormItem; //导入依赖的package包/类
private void createOpenQuestionWithVideo() {
openQuestionWithVideoCBItem = new CheckboxItem();
openQuestionWithVideoCBItem.setName("openQuestionWithVideo");
openQuestionWithVideoCBItem.setTitle(constants.answerWithVideo());
openQuestionWithVideoCBItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem item, Object value, DynamicForm form) {
if (form.getValue("isOpenQuestion") == null) return false;
return form.getValue("isOpenQuestion").equals(Boolean.TRUE);
}
});
// openQuestionWithVideoCBItem.addChangedHandler(new ChangedHandler() {
//
// @Override
// public void onChanged(ChangedEvent event) {
// if ((Boolean)form.getValue("openQuestionWithVideo")) form.setValue("openQuestionWithImage", false);
// }
// });
openQuestionWithVideoCBItem.setStartRow(true);
}