java - What is the mapping between the property types and their editors in a SettingsPane? -


settingspane can automatically select editor properties. in doecs says

the settingspane control designed make easy developers present end users list of options can modified, using proper built-in editors according type of options.

i have 2 questions in regard:

  1. which component chosen each property type? saw booleans have right-left toggle, numbers have text field, objectproperty<color> has color chooser (which on desktop pops out - don't know happen on mobile?). rest of mappings?

  2. when try have enum property: objectproperty<enumtype> error no renderer. think combobox default choosing known number of enum constants, shouldn't it? know can make happen editor factory myself wanted ask anyway, maybe suggestion if didn't make mistake.

edit

i'm looking again @ settingpane example custom editor: http://docs.gluonhq.com/charm/javadoc/4.3.7/com/gluonhq/charm/glisten/control/settingspane.html , i'm noticing 2 problems:

  1. in example code of checkbox editor see comments:

    public class checkboxeditor implements optioneditor<boolean> {     private final checkbox checkbox;     public checkboxeditor(option<boolean> option) {        this.checkbox = new checkbox();        valueproperty().bindbidirectional(option.valueproperty());     }} // 1 }     @override public node geteditor() { return checkbox; }     @override public final property<boolean> valueproperty() { return checkbox.selectedproperty(); }     @override public boolean getvalue() { return checkbox.isselected(); }     @override public void setvalue(boolean value) { checkbox.setselected(value); } // missing } 
  2. in usage example:

    final option<booleanproperty> dateoption = new defaultoption(materialdesignicon.date_range.graphic(),        "show date", "show date", "category", settings.showdateproperty(), true,        option -> new checkboxeditor((option<boolean>) option)); 

the lambda gives me compilation error:

type mismatch: cannot convert checkboxeditor optioneditor<booleanproperty> 

and option of type option<booleanproperty> , cast option<boolean>. mistake?

the default editors settingspane control are:

  • string: textfield.
  • numbers (byte , byte, short , short, int , integer, long , long, float , float, double , double, biginteger, bigdecimal): textfield textformatter applied.
  • boolean: togglebutton.
  • localdate: datepicker.
  • color/paint: colorpicker.
  • enums: combobox.

you can override this, setting own factory settingspane::setoptioneditorfactory, have provide required editors.

also can override particular editor, or can add own editor given type.

this sample of enum option:

enum os { windows, mac, linux, other }  objectproperty<os> os = new simpleobjectproperty<>(os.mac);  option<os> osoption = new defaultoption(materialdesignicon.laptop.graphic(), "operative system",              "set preferred os", "operative system", os, true); 

regarding javadoc, yes, typos need fixing. i've filed , issue on it.

about running sample, works me is. see above pic, wifi option:

final booleanproperty wifi = new simplebooleanproperty(); final option<booleanproperty> wifioption = new defaultoption(materialdesignicon.wifi.graphic(),              "wifi", "set wifi or wire", "devices", wifi, true,              option -> new checkboxeditor((option<boolean>) option)); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -