Class AbstractAttributeEditor<T>

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
cn.mapway.ui.client.widget.CommonEventComposite
cn.mapway.ui.client.mvc.attribute.editor.common.AbstractAttributeEditor<T>
All Implemented Interfaces:
IEventHandler, IAttributeEditor, HasAttributeStateChangeHandler, IAttributesProvider, IAttributeValuesUpdator, IAttributeInit, IPageTip, IEnabled, IErrorMessage, IProvideSize, ISelectable, Id, IData, HasCommonHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget
Direct Known Subclasses:
CheckBoxAttributeEditor, ColorBoxAttributeEditor, DateTimeAttributeEditor, DropdownAttributeEditor, EditorSelectAttributeEditor, IconAttributeEditor, ImageUploadAttributeEditor, LabelAttributeEditor, PaddingBoxAttributeEditor, SliderAttributeEditor, TextAreaAttributeEditor, TextboxAttributeEditor

public abstract class AbstractAttributeEditor<T> extends CommonEventComposite implements IAttributeEditor
抽象的属性编辑器基类 继承类实现 setValue getValue 提供 popupWidget 会提供一个 button进行选择 提供 DisplayWidget 会显示widget 没有 会使用缺省的 TextBox

如何自定义个一个属性编辑器 参考 TextBoxAttributeEditor 1.继承此类 2.提供一个属性编辑器的CODE 3.重载 setAttribute getDisplayWidget getPopupWidget

  • Constructor Details

    • AbstractAttributeEditor

      public AbstractAttributeEditor()
  • Method Details

    • getSize

      public Size getSize()
      返回编辑器弹出窗的缺省大小
      Specified by:
      getSize in interface IAttributeEditor
      Returns:
    • getAttribute

      public IAttribute getAttribute()
      Description copied from interface: IAttributeEditor
      获取编辑器对应的属性定义
      Specified by:
      getAttribute in interface IAttributeEditor
      Returns:
    • getRuntimeParameters

      public List<ParameterValue> getRuntimeParameters()
      获取编辑器选项 这个选项一定不为空 并且融合了 设计期和运行期 的所有编辑器参数选项
      Returns:
    • option

      public <T> T option(String name, T defaultValue)
      首先从运行时中寻找参数 然后从 设计时中寻找参数
      Parameters:
      name -
      defaultValue -
      Returns:
    • updateEditorOption

      public void updateEditorOption(String key, Object value)
      更新编辑器的某个选项
      Specified by:
      updateEditorOption in interface IAttributeEditor
      Parameters:
      key -
      value -
    • updateAllEditorOption

      public void updateAllEditorOption()
      更新所有的编辑器选项
      Specified by:
      updateAllEditorOption in interface IAttributeEditor
    • onEditorOptionChanged

      public void onEditorOptionChanged(String key)
      某个编辑属性改变了值
      Parameters:
      key - 如果key is null or empty 更新所有的属性编辑器组件的选项
    • setEditorNotifyHandler

      public void setEditorNotifyHandler(IAttributeEditorNotifyHandler notifyHandler)
      Specified by:
      setEditorNotifyHandler in interface IAttributeEditor
    • expandExtraWidget

      public void expandExtraWidget(com.google.gwt.user.client.ui.Widget widget, boolean appendOrRemove)
      扩展属性编辑器编辑框
      Parameters:
      widget -
      appendOrRemove -
    • editAttribute

      public void editAttribute(ParameterValues runtimeParameters, IAttribute attribute)
      设置组件编辑器的内容 通过组件工厂 AttributeEditorFactory 创建一个编辑器组件实例后 子组件必须首先调用此方法 处理一些基础数据 参见下拉框编辑器的设计 DropdownAttributeEditor
      Specified by:
      editAttribute in interface IAttributeEditor
      Parameters:
      runtimeParameters - 编辑器选项 是一个 KV Ma,继承的组件自己定义所需的参数
      attribute - 属性编辑器对应的属性内容
    • getData

      public Object getData()
      Specified by:
      getData in interface IData<T>
    • setData

      public void setData(Object obj)
      Specified by:
      setData in interface IData<T>
    • castToString

      public String castToString(Object obj)
    • castToValue

      public Object castToValue(String value)
      根据 DataType 将字符串转化为对象
      Parameters:
      value -
      Returns:
    • setValueChangedHandler

      public void setValueChangedHandler(IAttributeEditorValueChangedHandler handler)
      Description copied from interface: IAttributeEditor
      属性变化通知事件
      Specified by:
      setValueChangedHandler in interface IAttributeEditor
    • notifyValueChanged

      public void notifyValueChanged()
      通知监听器 属性发生了变化
    • readAttributeValue

      public Object readAttributeValue(ParameterValue attribute, Object defaultValue)
      读取attribute的值 如果为空 返回缺省值
      Parameters:
      attribute -
      defaultValue -
      Returns:
    • fromUI

      public abstract void fromUI()
      从UI获取数据到 对象实体中
      Specified by:
      fromUI in interface IAttributeEditor