Search in sources :

Example 1 with SubjectComponent

use of org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.subjectcomponents.SubjectComponent in project ArchCNL by Mari-Wie.

the class RuleCreatorView method initializeLayout.

private void initializeLayout(Optional<String> ruleString) {
    subject = new SubjectComponent();
    subject.addListener(RelationListUpdateRequestedEvent.class, this::fireEvent);
    subject.addListener(ConceptListUpdateRequestedEvent.class, this::fireEvent);
    subject.addListener(DetermineStatementComponentEvent.class, event -> verb.determineVerbComponent(event.getSource().getFirstModifierValue()));
    verb = new StatementComponent();
    verb.addListener(RelationListUpdateRequestedEvent.class, this::fireEvent);
    verb.addListener(ConceptListUpdateRequestedEvent.class, this::fireEvent);
    buttonsLayout = new HorizontalLayout();
    saveButton = new Button("Save Rule", e -> saveRule());
    cancelButton = new Button("Cancel", click -> fireEvent(new RulesWidgetRequestedEvent(this, true)));
    expertmodeCheckbox = new Checkbox("Activate Expertmode");
    expertmodeCheckbox.addClickListener(e -> activateExpertMode(expertmodeCheckbox.getValue()));
    buttonsLayout.setVerticalComponentAlignment(Alignment.CENTER, expertmodeCheckbox);
    buttonsLayout.setPadding(true);
    buttonsLayout.add(saveButton, cancelButton, expertmodeCheckbox);
    archRuleTextArea = new TextArea("Create new architecture rule");
    archRuleTextArea.setWidthFull();
    add(subject, verb, buttonsLayout);
    ruleString.ifPresent(rule -> {
        archRuleTextArea.setValue(rule);
        expertmodeCheckbox.setValue(true);
        activateExpertMode(true);
    });
}
Also used : ComponentEventListener(com.vaadin.flow.component.ComponentEventListener) ConceptListUpdateRequestedEvent(org.archcnl.ui.common.andtriplets.triplet.events.ConceptListUpdateRequestedEvent) RulesWidgetRequestedEvent(org.archcnl.ui.inputview.rulesormappingeditorview.events.RulesWidgetRequestedEvent) TextArea(com.vaadin.flow.component.textfield.TextArea) Registration(com.vaadin.flow.shared.Registration) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) StatementComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.verbcomponents.StatementComponent) SubjectComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.subjectcomponents.SubjectComponent) ComponentEvent(com.vaadin.flow.component.ComponentEvent) RelationListUpdateRequestedEvent(org.archcnl.ui.common.andtriplets.triplet.events.RelationListUpdateRequestedEvent) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Button(com.vaadin.flow.component.button.Button) DetermineStatementComponentEvent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.events.DetermineStatementComponentEvent) SaveRuleButtonPressedEvent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.events.SaveRuleButtonPressedEvent) RulesOrMappingEditorView(org.archcnl.ui.inputview.rulesormappingeditorview.RulesOrMappingEditorView) Optional(java.util.Optional) Button(com.vaadin.flow.component.button.Button) TextArea(com.vaadin.flow.component.textfield.TextArea) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) SubjectComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.subjectcomponents.SubjectComponent) RulesWidgetRequestedEvent(org.archcnl.ui.inputview.rulesormappingeditorview.events.RulesWidgetRequestedEvent) StatementComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.verbcomponents.StatementComponent) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Aggregations

ComponentEvent (com.vaadin.flow.component.ComponentEvent)1 ComponentEventListener (com.vaadin.flow.component.ComponentEventListener)1 Button (com.vaadin.flow.component.button.Button)1 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1 TextArea (com.vaadin.flow.component.textfield.TextArea)1 Registration (com.vaadin.flow.shared.Registration)1 Optional (java.util.Optional)1 ConceptListUpdateRequestedEvent (org.archcnl.ui.common.andtriplets.triplet.events.ConceptListUpdateRequestedEvent)1 RelationListUpdateRequestedEvent (org.archcnl.ui.common.andtriplets.triplet.events.RelationListUpdateRequestedEvent)1 RulesOrMappingEditorView (org.archcnl.ui.inputview.rulesormappingeditorview.RulesOrMappingEditorView)1 SubjectComponent (org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.subjectcomponents.SubjectComponent)1 StatementComponent (org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.verbcomponents.StatementComponent)1 DetermineStatementComponentEvent (org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.events.DetermineStatementComponentEvent)1 SaveRuleButtonPressedEvent (org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.events.SaveRuleButtonPressedEvent)1 RulesWidgetRequestedEvent (org.archcnl.ui.inputview.rulesormappingeditorview.events.RulesWidgetRequestedEvent)1