/** * The DynamicForm picks a field renderer based on the type of the field (and sometimes other attributes of the * field). * * @return the type */ public String getType() { return getAttribute("type"); }
/** * Alignment of this item's title in its cell. <p> If null, dynamically set according to text direction. * * * @return Alignment */ public Alignment getTitleAlign() { return EnumUtil.getEnum(Alignment.values(), getAttribute("titleAlign")); }
/** * On which side of this item should the title be placed. {@link com.smartgwt.client.types.TitleOrientation} lists valid * options. <P> Note that titles on the left or right take up a cell in tabular {@link com.smartgwt.client.docs.FormLayout * form layouts}, but titles on top do not. * * * @return TitleOrientation * @see com.smartgwt.client.widgets.form.DynamicForm#getTitleOrientation */ public TitleOrientation getTitleOrientation() { return EnumUtil.getEnum(TitleOrientation.values(), getAttribute("titleOrientation")); }
/** * How should icons be aligned vertically for this form item. * * * @return VerticalAlignment */ public VerticalAlignment getIconVAlign() { return EnumUtil.getEnum(VerticalAlignment.values(), getAttribute("iconVAlign")); }
/** * Vertical text alignment for text displayed in this item's hover canvas, if shown. * * * @return VerticalAlignment * @see com.smartgwt.client.widgets.form.DynamicForm#getItemHoverVAlign */ public VerticalAlignment getHoverVAlign() { return EnumUtil.getEnum(VerticalAlignment.values(), getAttribute("hoverVAlign")); }
/** * Text alignment for text displayed in this item's hover canvas, if shown. * * * @return Alignment * @see com.smartgwt.client.widgets.form.DynamicForm#getItemHoverAlign */ public Alignment getHoverAlign() { return EnumUtil.getEnum(Alignment.values(), getAttribute("hoverAlign")); }
/** * Classname of the FormItem that should be the default for editing values of this type (eg "SelectItem"). <P> You * can create a simple custom FormItem by adding default {@link com.smartgwt.client.widgets.form.fields.FormItem#getIcons * icons} that launch custom value picking dialogs (an example is in the <i>QuickStart Guide</i>, Chapter 9, * <i>Extending Smart GWT</i>). By setting simpleType.editorType to the name of your custom FormItem, forms will * automatically use the custom FormItem, as will grids performing {@link com.smartgwt.client.widgets.grid.ListGrid#getCanEdit * canEdit}. * * @param editorType editorType Default value is null * @throws IllegalStateException this property cannot be changed after the underlying component has been created */ public void setEditorType(FormItem editorType) throws IllegalStateException { //only set the editorType attribute if the passed editorType is a concrete subclass of FormItem if(!editorType.getClass().getName().equals(FormItem.class.getName())) { String fiEditorType = editorType.getAttribute("editorType"); //fallback to type if editorType is not specified if(fiEditorType == null) fiEditorType = editorType.getType(); if (fiEditorType != null) setAttribute("editorType", fiEditorType, false); } }
/** * Alignment of the text / content within this form item. Note that {@link * com.smartgwt.client.widgets.form.fields.FormItem#getAlign align} may be used to control alignment of the entire form * item within its cell. May not apply to all form item types. * * * @return Alignment * @see com.smartgwt.client.docs.Appearance Appearance overview and related methods */ public Alignment getTextAlign() { return EnumUtil.getEnum(Alignment.values(), getAttribute("textAlign")); }
/** * Vertical alignment of this item's title in its cell. Only applies when {@link * com.smartgwt.client.widgets.form.fields.FormItem#getTitleOrientation titleOrientation} is <code>"left"</code> or * <code>"right"</code>. * * * @return VerticalAlignment */ public VerticalAlignment getTitleVAlign() { return EnumUtil.getEnum(VerticalAlignment.values(), getAttribute("titleVAlign")); }
/** * Alignment of this item in its cell. Note that the alignment of content within this item can be separately controlled via * {@link com.smartgwt.client.widgets.form.fields.FormItem#getTextAlign textAlign} (typically only applies to items showing * a "textBox", such as {@link com.smartgwt.client.widgets.form.fields.TextItem textItems} or {@link * com.smartgwt.client.widgets.form.fields.SelectItem selectItems}). * * * @return Alignment * @see com.smartgwt.client.docs.Appearance Appearance overview and related methods */ public Alignment getAlign() { return EnumUtil.getEnum(Alignment.values(), getAttribute("align")); }
/** * Time-format to apply to date type values within this formItem. If specified, any dates displayed in this item will be * formatted as times using the appropriate format.<br> Has no effect if {@link * com.smartgwt.client.widgets.form.fields.FormItem#getDateFormatter dateFormatter} is also set.<br> See also {@link * com.smartgwt.client.widgets.form.fields.FormItem#getDisplayFormat displayFormat} and {@link * com.smartgwt.client.widgets.form.fields.TimeItem#getDisplayFormat displayFormat} for formatting values displayed in * TimeItems. * * * @return TimeFormatter * @see com.smartgwt.client.docs.Appearance Appearance overview and related methods */ public TimeFormatter getTimeFormatter() { return EnumUtil.getEnum(TimeFormatter.values(), getAttribute("timeFormatter")); }
/** * Display format to use for date type values within this formItem. Default is to use the system-wide default short date * format, configured via Date.setShortDisplayFormat. Specify any valid {@link * com.smartgwt.client.types.DateDisplayFormat} to change the format used by this item.<br> Note: if both * <code>dateFormatter</code> and {@link com.smartgwt.client.widgets.form.fields.FormItem#getTimeFormatter timeFormatter} * are specified on an item, Date type values will be formatted as dates using <code>dateFormatter</code>.<br> See also * {@link com.smartgwt.client.widgets.form.fields.FormItem#getDisplayFormat displayFormat} and {@link * com.smartgwt.client.widgets.form.fields.DateItem#getDisplayFormat displayFormat} for formatting dates displayed in * DateItems. * * * @return DateDisplayFormat * @see com.smartgwt.client.docs.Appearance Appearance overview and related methods */ public DateDisplayFormat getDateFormatter() { return EnumUtil.getEnum(DateDisplayFormat.values(), getAttribute("dateFormatter")); }
/** * Sets the default FormItem to be used whenever this field is edited (whether in a grid, form, or other component). * <P> If unset, a FormItem will be automatically chosen based on the type of the field. * <p><br> * <b>Note</b> : When you supply a custom FormItem via setEditorType(), you're really providing properties which are then used * to create multiple FormItems (eg, in grids, forms and trees) and there's an underlying limitation here where event handlers * have to be written to dynamically receive the actual FormItem rather than relying on "this" (because there's more than one "this"). * * @param editorType editorType Default value is null */ public void setEditorType(FormItem editorType) { //only set the editorType attribute if the passed editorType is a concrete subclass of FormItem if(!editorType.getClass().getName().equals(FormItem.class.getName())) { String fiEditorType = editorType.getAttribute("editorType"); //fallback to type if editorType is not specified if(fiEditorType == null) fiEditorType = editorType.getType(); if (fiEditorType != null) setAttribute("editorType", fiEditorType); } JavaScriptObject editorConfig = editorType.getConfig(); setAttribute("editorProperties", editorConfig); }
/** * Name of the FormItem properties to use for editing. <P> The type of FormItem to use for * editing is normally derived automatically from {@link com.smartgwt.client.widgets.form.fields.FormItem#getType * type}, which is the data type of the field, by the rules explained {@link com.smartgwt.client.types.FormItemType here}. * <p><br> * <b>Note</b> : When you supply a custom FormItem via setEditorType(), you're really providing properties which are then used to create * multiple FormItems (eg, in grids, forms and trees) and there's an underlying limitation here where event handlers have to be written to * dynamically receive the actual FormItem rather than relying on "this" (because there's more than one "this"). * * @param editorType editorType Default value is null */ public void setEditorType(FormItem editorType) { //only set the editorType attribute if the passed editorType is a concrete subclass of FormItem if(!editorType.getClass().getName().equals(FormItem.class.getName())) { String fiEditorType = editorType.getAttribute("editorType"); //fallback to type if editorType is not specified if(fiEditorType == null) fiEditorType = editorType.getType(); if (fiEditorType != null) setAttribute("editorType", fiEditorType); } JavaScriptObject editorConfig = editorType.getConfig(); setAttribute("editorProperties", editorConfig); }
/** * Name of form item type to use for the form item created to edit this field. (Only used if this field is * editable). Note: If this is not specified, the edit-form item type may be derived from the editorType property, * typically inherited from datasource fields, or from the type of the field (showing the appropriate form item for * the data-type). See the Grid Editing overview for more on editing ListGrid fields. * * <p><br> * <b>Note>: When you supply a custom FormItem via setEditorType(), you're really providing properties which are then used to * create multiple FormItems (eg, in grids, forms and trees) and there's an underlying limitation here where event handlers have * to be written to dynamically receive the actual FormItem rather than relying on "this" (because there's more than one "this"). * * @param editorType the editor type */ public void setEditorType(FormItem editorType) { //only set the editorType attribute if the passed editorType is a concrete subclass of FormItem if(!editorType.getClass().getName().equals(FormItem.class.getName())) { String fiEditorType = editorType.getAttribute("editorType"); //fallback to type if editorType is not specified if(fiEditorType == null) fiEditorType = editorType.getType(); if (fiEditorType != null) setAttribute("editorType", fiEditorType); } JavaScriptObject editorConfig = editorType.getConfig(); setAttribute("editorProperties", editorConfig); }
/** * {@link com.smartgwt.client.types.OperatorId} to be used when {@link * com.smartgwt.client.widgets.form.DynamicForm#getValuesAsCriteria DynamicForm.getValuesAsCriteria} is called. <P> * <code>item.operator</code> can be used to create a form that offers search functions such as date range filtering, * without the more advanced user interface of the {@link com.smartgwt.client.widgets.form.FilterBuilder}. <P> When * <code>item.operator</code> is set for any FormItem in a form, <code>form.getValuesAsCriteria()</code> will return an * {@link com.smartgwt.client.data.AdvancedCriteria} object instead of a normal {@link com.smartgwt.client.data.Criteria} * object. Each FormItem will produce one {@link com.smartgwt.client.data.Criterion} affecting the DataSource field * specified by {@link com.smartgwt.client.widgets.form.fields.FormItem#getCriteriaField criteriaField}. The criteria * produced by the FormItems will be grouped under the logical operator provided by {@link * com.smartgwt.client.widgets.form.DynamicForm#getOperator operator}. <P> if <code>operator</code> is set for some fields * but not others, the default operator is "equals" for fields with a valueMap or an optionDataSource, and for fields of * type "enum" (or of a type that inherits from "enum"). The default operator for all other fields is "iContains" * (case-insensitive match) <P> <b>Note:</b> Advanced criteria will only be created for items in a Databound form. If this * item is part of a form with no {@link com.smartgwt.client.widgets.DataBoundComponent#getDataSource dataSource}, the * <code>operator</code> attribute will have no effect. * * * @return OperatorId * @see com.smartgwt.client.docs.CriteriaEditing CriteriaEditing overview and related methods */ public OperatorId getOperator() { return EnumUtil.getEnum(OperatorId.values(), getAttribute("operator")); }