Search in sources :

Example 1 with RuntimeListMenuItem

use of com.thecoderscorner.menu.domain.RuntimeListMenuItem in project tcMenu by davetcc.

the class ListEditorComponent method createComponent.

public Node createComponent() {
    if (item instanceof RuntimeListMenuItem) {
        listView = new ListView<>();
        ConditionalColoring condColor = getDrawingSettings().getColors();
        var bgPaint = asFxColor(condColor.backgroundFor(RenderingStatus.NORMAL, ConditionalColoring.ColorComponentType.BUTTON));
        listView.setBackground(new Background(new BackgroundFill(bgPaint, new CornerRadii(0), new Insets(0))));
        listView.setItems(actualData);
        if (!item.isReadOnly()) {
            listView.setOnMouseClicked((MouseEvent evt) -> {
                var selIdx = listView.getSelectionModel().getSelectedIndex();
                if (selIdx >= 0 && selIdx < actualData.size()) {
                    var selMode = evt.getClickCount() == 2 ? INVOKE_ITEM : SELECT_ITEM;
                    componentControl.editorUpdatedItem(item, new ListResponse(selIdx, selMode));
                }
            });
        }
        return listView;
    } else {
        return new Label("item not a list");
    }
}
Also used : Insets(javafx.geometry.Insets) MouseEvent(javafx.scene.input.MouseEvent) Background(javafx.scene.layout.Background) ListResponse(com.thecoderscorner.menu.domain.state.ListResponse) BackgroundFill(javafx.scene.layout.BackgroundFill) Label(javafx.scene.control.Label) ConditionalColoring(com.thecoderscorner.embedcontrol.core.controlmgr.color.ConditionalColoring) CornerRadii(javafx.scene.layout.CornerRadii) RuntimeListMenuItem(com.thecoderscorner.menu.domain.RuntimeListMenuItem)

Example 2 with RuntimeListMenuItem

use of com.thecoderscorner.menu.domain.RuntimeListMenuItem in project tcMenu by davetcc.

the class UIRuntimeListMenuItem method getChangedMenuItem.

@Override
protected Optional<RuntimeListMenuItem> getChangedMenuItem() {
    RuntimeListMenuItemBuilder builder = RuntimeListMenuItemBuilder.aRuntimeListMenuItemBuilder().withExisting(getMenuItem());
    List<FieldError> errors = new ArrayList<>();
    getChangedDefaults(builder, errors);
    RuntimeListMenuItem item = builder.menuItem();
    functionNameTextField.setText(item.getFunctionName());
    return getItemOrReportError(item, errors);
}
Also used : RuntimeListMenuItemBuilder(com.thecoderscorner.menu.domain.RuntimeListMenuItemBuilder) ArrayList(java.util.ArrayList) RuntimeListMenuItem(com.thecoderscorner.menu.domain.RuntimeListMenuItem)

Aggregations

RuntimeListMenuItem (com.thecoderscorner.menu.domain.RuntimeListMenuItem)2 ConditionalColoring (com.thecoderscorner.embedcontrol.core.controlmgr.color.ConditionalColoring)1 RuntimeListMenuItemBuilder (com.thecoderscorner.menu.domain.RuntimeListMenuItemBuilder)1 ListResponse (com.thecoderscorner.menu.domain.state.ListResponse)1 ArrayList (java.util.ArrayList)1 Insets (javafx.geometry.Insets)1 Label (javafx.scene.control.Label)1 MouseEvent (javafx.scene.input.MouseEvent)1 Background (javafx.scene.layout.Background)1 BackgroundFill (javafx.scene.layout.BackgroundFill)1 CornerRadii (javafx.scene.layout.CornerRadii)1