Annotation Interface GuiIncluded


@Retention(RUNTIME) @Target({METHOD,FIELD,TYPE}) public @interface GuiIncluded
the annotation for marking a member as a GUI element
    //example
    @GuiIncluded
    class C {
        @GuiIncluded(index=1)
        public int fld;

        @GuiIncluded(index=2, description="read-only value")
        public String getReadOnlyProp() { ... }

        @GuiIncluded(index=3, description="property by setter and getter")
        public String getValue() { ... }
        public void setValue(String v) { ... }

        @GuiIncluded(index=4, description="action")
        public void action() { ... }

        @GuiIncluded(index=5, name="customizedName")
        public float v;

        @GuiIncluded(index=6, description="table by list of string")
        public List<String> strTable = ...;

        @GuiIncluded(index=7, description="table by list of E")
        public List<E> eTable = ...;

        @GuiIncluded
        public void actionForSelectedItems(List<E> items) {...}

        @GuiIncluded
        public void actionForSelectedRows(List<Integer> rows, String tableName) {...}

        @GuiIncluded(editor=true)
        public E editorAction() {...}

        @GuiIncluded
        public void completeEditorAction(E e) {...}

        @GuiIncluded
        public void completeEditorAction(E e, boolean ok) {...}

    }

    @GuiIncluded //column class
    class E {
        @GuiIncluded
        public boolean flag;

        @GuiIncluded
        public EnumVal select;

        @GuiIncluded
        public void actionForSelectedRow() { ... }
    }
    public enum EnumVal { ... }

    @GuiIncluded //record support
    public record R(
              @GuiIncluded int f1, //field
              String f2) {
        //getter
        @GuiIncluded String f2() { return f2; }

        //action
        @GuiIncluded(action=true) String a() { ... }

        //getter
        @GuiIncluded(action=false) String g() { ... }
    }
  • Element Details

    • value

      boolean value
      Returns:
      true if the attached member is part of the GUI
      Default:
      true
    • name

      String name
      Returns:
      custom name instead of the auto-generated name based on the member name
      Default:
      ""
    • index

      int index
      Returns:
      ordinal index for sorting members. the default value is the max value of short. for properties, minimum value is used from field, getter or setter.
      Default:
      32767
    • description

      String description
      Returns:
      short description for the target, typically presented as a tool-tip. for properties, combines field, getter and setter.
      Default:
      ""
    • keyStroke

      String keyStroke
      Returns:
      accelerator keystroke. For example,
           @GuiIncluded(keyStroke="K") public String prop;
       
      then, users can focus to the field "prop" by typing Cmd or Ctrl +K. For an action method, users can invoke the method by typing the specified key.

      The string will be passed to KeyStroke.getStroke(String), "none" or "".

             "none" | control* key
      
             control ::= "shift" | "alt"        //lower cases ("meta" or "control" is automatically appended)
             key  ::= "0" | "1" | ... | "9" | "A" | "B" | ... | "Z"  //upper cases
         
      examples:
             "shift K"
             "shift alt F"
         
      for properties, selects one of field(high-precedence), getter or setter. if the stroke is empty (default), then the first character of the name will be used. if the stroke is "none", then key-binding will be skipped for the target.

      Some keys are reserved with combination of Meta(Command) or Ctrl.

      • reserved keys: Q (Quit), W (Window close), shift R (Refresh), A (Select all), shift A (un-select), Z (Undo), shift Z (Redo), O (Open), S (Save), X (Cut), C (Copy), V (Paste), alt O (JSON Open), alt S (JSON Save), alt X (JSON Cut), alt C (JSON Copy), alt V (JSON Paste), ',' (settings)
      • conditionally used keys by some components: shift B (open-in-browser for texts), shift I (increment for numbers or zoom-in for images), shift D (decrement for numbers or zoom-out for images), shift ',' (settings for numbers or documents)
      Default:
      ""
    • history

      boolean history
      Returns:
      if true, enables history-saving for the target property
      Since:
      1.2
      Default:
      true
    • action

      boolean action
      Returns:
      if true and the target returns non-void type, the target is handled as an action, not an accessor
      Since:
      1.2
      Default:
      false
    • editor

      boolean editor
      Returns:
      if true and the target returns an object type, the target is handled as an editor-action, not an accessor. Note: editor=true means the target is a special kind of action even if action=false.
      Since:
      1.9
      Default:
      false