Search in sources :

Example 1 with JsonAdapterPropertyConfig

use of org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig in project scout.rt by eclipse.

the class JsonTable method initJsonProperties.

@Override
protected void initJsonProperties(T model) {
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTI_SELECT, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultiSelect();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTI_CHECK, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultiCheck();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTILINE_TEXT, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultilineText();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CHECKABLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isCheckable();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_ROW_ICON_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isRowIconVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_HEADER_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isHeaderVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_HEADER_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isHeaderEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_KEYBOARD_NAVIGATION, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().hasKeyboardNavigation();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_AUTO_RESIZE_COLUMNS, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isAutoResizeColumns();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_SCROLL_TO_SELECTION, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isScrollToSelection();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_TABLE_STATUS_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isTableStatusVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_TABLE_STATUS, model) {

        @Override
        protected IStatus modelValue() {
            return getModel().getTableStatus();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return JsonStatus.toJson((IStatus) value);
        }
    });
    putJsonProperty(new JsonAdapterProperty<ITable>(ITable.PROP_TABLE_CONTROLS, model, getUiSession()) {

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().filter(new DisplayableActionFilter<ITableControl>()).build();
        }

        @Override
        protected List<ITableControl> modelValue() {
            return getModel().getTableControls();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_DROP_TYPE, model) {

        @Override
        protected Integer modelValue() {
            return getModel().getDropType();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_DROP_MAXIMUM_SIZE, model) {

        @Override
        protected Long modelValue() {
            return getModel().getDropMaximumSize();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_SORT_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isSortEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_UI_SORT_POSSIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isUiSortPossible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_LOADING, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isLoading();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_GROUPING_STYLE, model) {

        @Override
        protected GroupingStyle modelValue() {
            return getModel().getGroupingStyle();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return ((GroupingStyle) value).name().toLowerCase();
        }
    });
    putJsonProperty(new JsonAdapterProperty<ITable>(ITable.PROP_KEY_STROKES, model, getUiSession()) {

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().filter(new DisplayableActionFilter<IAction>()).build();
        }

        @Override
        protected List<IKeyStroke> modelValue() {
            return getModel().getKeyStrokes();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CSS_CLASS, model) {

        @Override
        protected String modelValue() {
            return getModel().getCssClass();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CONTEXT_COLUMN, model) {

        @Override
        protected Object modelValue() {
            return getModel().getContextColumn();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            if (value == null) {
                return null;
            }
            return m_jsonColumns.get(value).getId();
        }
    });
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) JsonAdapterPropertyConfig(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig) IAction(org.eclipse.scout.rt.client.ui.action.IAction) ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl) JsonAdapterPropertyConfigBuilder(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfigBuilder) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) TextTransferObject(org.eclipse.scout.rt.client.ui.dnd.TextTransferObject) ResourceListTransferObject(org.eclipse.scout.rt.client.ui.dnd.ResourceListTransferObject) JSONObject(org.json.JSONObject) TransferObject(org.eclipse.scout.rt.client.ui.dnd.TransferObject) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) GroupingStyle(org.eclipse.scout.rt.client.ui.basic.table.GroupingStyle)

Example 2 with JsonAdapterPropertyConfig

use of org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig in project scout.rt by eclipse.

the class JsonTree method initJsonProperties.

@Override
protected void initJsonProperties(TREE model) {
    super.initJsonProperties(model);
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_TITLE, model) {

        @Override
        protected String modelValue() {
            return getModel().getTitle();
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_ICON_ID, model) {

        @Override
        protected String modelValue() {
            return getModel().getIconId();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return BinaryResourceUrlUtility.createIconUrl((String) value);
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_CSS_CLASS, model) {

        @Override
        protected String modelValue() {
            return getModel().getCssClass();
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_CHECKABLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isCheckable();
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_MULTI_CHECK, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultiCheck();
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isEnabled();
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_LAZY_EXPANDING_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isLazyExpandingEnabled();
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_AUTO_CHECK_CHILDREN, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isAutoCheckChildNodes();
        }
    });
    putJsonProperty(new JsonProperty<ITree>(ITree.PROP_SCROLL_TO_SELECTION, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isScrollToSelection();
        }
    });
    putJsonProperty(new JsonProperty<ITree>(ITree.PROP_DROP_TYPE, model) {

        @Override
        protected Integer modelValue() {
            return getModel().getDropType();
        }
    });
    putJsonProperty(new JsonProperty<ITree>(ITree.PROP_DROP_MAXIMUM_SIZE, model) {

        @Override
        protected Long modelValue() {
            return getModel().getDropMaximumSize();
        }
    });
    putJsonProperty(new JsonAdapterProperty<ITree>(ITree.PROP_KEY_STROKES, model, getUiSession()) {

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().filter(new DisplayableActionFilter<IAction>()).build();
        }

        @Override
        protected List<IKeyStroke> modelValue() {
            return getModel().getKeyStrokes();
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_DISPLAY_STYLE, model) {

        @Override
        protected String modelValue() {
            return getModel().getDisplayStyle();
        }
    });
    putJsonProperty(new JsonProperty<TREE>(ITree.PROP_TOGGLE_BREADCRUMB_STYLE_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isToggleBreadcrumbStyleEnabled();
        }
    });
}
Also used : JsonAdapterPropertyConfig(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig) IAction(org.eclipse.scout.rt.client.ui.action.IAction) ITree(org.eclipse.scout.rt.client.ui.basic.tree.ITree) JsonAdapterPropertyConfigBuilder(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfigBuilder) ResourceListTransferObject(org.eclipse.scout.rt.client.ui.dnd.ResourceListTransferObject) JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) List(java.util.List)

Example 3 with JsonAdapterPropertyConfig

use of org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig in project scout.rt by eclipse.

the class JsonTabBox method initJsonProperties.

@Override
protected void initJsonProperties(TAB_BOX model) {
    super.initJsonProperties(model);
    putJsonProperty(new JsonAdapterProperty<ITabBox>(ITabBox.PROP_SELECTED_TAB, model, getUiSession()) {

        @Override
        protected IGroupBox modelValue() {
            return getModel().getSelectedTab();
        }

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().disposeOnChange(false).build();
        }
    });
}
Also used : JsonAdapterPropertyConfigBuilder(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfigBuilder) JsonAdapterPropertyConfig(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig) IGroupBox(org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox) ITabBox(org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox)

Example 4 with JsonAdapterPropertyConfig

use of org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig in project scout.rt by eclipse.

the class JsonCalendar method initJsonProperties.

@Override
protected void initJsonProperties(CALENDAR model) {
    putJsonProperty(new JsonAdapterProperty<CALENDAR>(ICalendar.PROP_COMPONENTS, model, getUiSession()) {

        @Override
        protected Set<? extends CalendarComponent> modelValue() {
            return getModel().getComponents();
        }
    });
    putJsonProperty(new JsonAdapterProperty<CALENDAR>(ICalendar.PROP_SELECTED_COMPONENT, model, getUiSession()) {

        @Override
        protected CalendarComponent modelValue() {
            return getModel().getSelectedComponent();
        }

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().disposeOnChange(false).build();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_DISPLAY_MODE, model) {

        @Override
        protected Integer modelValue() {
            return getModel().getDisplayMode();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_DISPLAY_CONDENSED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isDisplayCondensed();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_TITLE, model) {

        @Override
        protected String modelValue() {
            return getModel().getTitle();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_VIEW_RANGE, model) {

        @Override
        protected Range<Date> modelValue() {
            return getModel().getViewRange();
        }

        @SuppressWarnings("unchecked")
        @Override
        public Object prepareValueForToJson(Object value) {
            if (value == null) {
                return null;
            }
            return new JsonDateRange((Range<Date>) value).toJson();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_SELECTED_DATE, model) {

        @Override
        protected Date modelValue() {
            return getModel().getSelectedDate();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return new JsonDate((Date) value).asJsonString();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_LOAD_IN_PROGRESS, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isLoadInProgress();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_START_HOUR, model) {

        @Override
        protected Integer modelValue() {
            return getModel().getStartHour();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_END_HOUR, model) {

        @Override
        protected Integer modelValue() {
            return getModel().getEndHour();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_USE_OVERFLOW_CELLS, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().getUseOverflowCells();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_SHOW_DISPLAY_MODE_SELECTION, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().getShowDisplayModeSelection();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_MARK_NOON_HOUR, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().getMarkNoonHour();
        }
    });
    putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_MARK_OUT_OF_MONTH_DAYS, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().getMarkOutOfMonthDays();
        }
    });
}
Also used : Set(java.util.Set) JsonAdapterPropertyConfig(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig) CalendarComponent(org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent) JsonDateRange(org.eclipse.scout.rt.ui.html.json.JsonDateRange) JsonDate(org.eclipse.scout.rt.ui.html.json.JsonDate) Range(org.eclipse.scout.rt.platform.util.Range) JsonDateRange(org.eclipse.scout.rt.ui.html.json.JsonDateRange) Date(java.util.Date) JsonDate(org.eclipse.scout.rt.ui.html.json.JsonDate) JsonAdapterPropertyConfigBuilder(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfigBuilder) JSONObject(org.json.JSONObject)

Example 5 with JsonAdapterPropertyConfig

use of org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig in project scout.rt by eclipse.

the class JsonAction method initJsonProperties.

@Override
protected void initJsonProperties(ACTION model) {
    super.initJsonProperties(model);
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_TEXT, model) {

        @Override
        protected String modelValue() {
            return getModel().getText();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_ICON_ID, model) {

        @Override
        protected String modelValue() {
            return getModel().getIconId();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return BinaryResourceUrlUtility.createIconUrl((String) value);
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_TOOLTIP_TEXT, model) {

        @Override
        protected String modelValue() {
            return getModel().getTooltipText();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>("toggleAction", model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isToggleAction();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_SELECTED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isSelected();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isVisible();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_KEY_STROKE, model) {

        @Override
        protected String modelValue() {
            return getModel().getKeyStroke();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_KEYSTROKE_FIRE_POLICY, model) {

        @Override
        protected Integer modelValue() {
            return getModel().getKeyStrokeFirePolicy();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_HORIZONTAL_ALIGNMENT, model) {

        @Override
        protected Integer modelValue() {
            return (int) getModel().getHorizontalAlignment();
        }
    });
    putJsonProperty(new JsonProperty<ACTION>(IAction.PROP_CSS_CLASS, model) {

        @Override
        protected String modelValue() {
            return getModel().getCssClass();
        }
    });
    putJsonProperty(new JsonAdapterProperty<ACTION>(IActionNode.PROP_CHILD_ACTIONS, model, getUiSession()) {

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().filter(new DisplayableActionFilter<IAction>()).build();
        }

        @Override
        protected Object modelValue() {
            if (getModel() instanceof IActionNode) {
                return ((IActionNode) getModel()).getChildActions();
            }
            return null;
        }
    });
}
Also used : JsonAdapterPropertyConfig(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig) IAction(org.eclipse.scout.rt.client.ui.action.IAction) IActionNode(org.eclipse.scout.rt.client.ui.action.tree.IActionNode) JsonAdapterPropertyConfigBuilder(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfigBuilder) JSONObject(org.json.JSONObject)

Aggregations

JsonAdapterPropertyConfig (org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig)5 JsonAdapterPropertyConfigBuilder (org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfigBuilder)5 JSONObject (org.json.JSONObject)4 IAction (org.eclipse.scout.rt.client.ui.action.IAction)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ResourceListTransferObject (org.eclipse.scout.rt.client.ui.dnd.ResourceListTransferObject)2 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1 IActionNode (org.eclipse.scout.rt.client.ui.action.tree.IActionNode)1 CalendarComponent (org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent)1 GroupingStyle (org.eclipse.scout.rt.client.ui.basic.table.GroupingStyle)1 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)1 ITableControl (org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl)1 ITree (org.eclipse.scout.rt.client.ui.basic.tree.ITree)1 TextTransferObject (org.eclipse.scout.rt.client.ui.dnd.TextTransferObject)1 TransferObject (org.eclipse.scout.rt.client.ui.dnd.TransferObject)1 IGroupBox (org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox)1 ITabBox (org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox)1