Search in sources :

Example 26 with AbstractOrderedLayout

use of com.vaadin.ui.AbstractOrderedLayout in project catma by forTEXT.

the class CommentDialog method addContent.

@Override
protected void addContent(ComponentContainer content) {
    this.textInput = new TextArea();
    this.textInput.setSizeFull();
    if (this.initialBody != null) {
        this.textInput.setValue(this.initialBody);
    }
    this.textInput.focus();
    content.addComponent(textInput);
    if (content instanceof AbstractOrderedLayout) {
        ((AbstractOrderedLayout) content).setExpandRatio(this.textInput, 1.0f);
    }
    this.textInput.addFocusListener(event -> abortClosing());
    this.textInput.addBlurListener(event -> startClosing());
    getBtOk().addFocusListener(event -> abortClosing());
    getBtOk().addBlurListener(event -> startClosing());
    getBtCancel().addFocusListener(event -> abortClosing());
    getBtCancel().addBlurListener(event -> startClosing());
    addFocusListener(event -> abortClosing());
    addBlurListener(event -> startClosing());
    addCloseListener(event -> abortClosing());
}
Also used : TextArea(com.vaadin.ui.TextArea) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout)

Example 27 with AbstractOrderedLayout

use of com.vaadin.ui.AbstractOrderedLayout in project catma by forTEXT.

the class TagsetImportDialog method addContent.

@Override
protected void addContent(ComponentContainer content) {
    Label intro = new Label(String.format("We found %1$d Tagset(s) in the uploaded Library:", tagsetDefinitionImportStatusList.size()));
    content.addComponent(intro);
    VerticalLayout tagsetPanel = new VerticalLayout();
    Panel tagsetScrollPanel = new Panel(tagsetPanel);
    tagsetScrollPanel.setSizeFull();
    content.addComponent(tagsetScrollPanel);
    ((AbstractOrderedLayout) content).setExpandRatio(tagsetScrollPanel, 0.9f);
    for (TagsetDefinitionImportStatus tagsetDefinitionImportStatus : this.tagsetDefinitionImportStatusList) {
        HorizontalLayout row = new HorizontalLayout();
        row.setSpacing(true);
        tagsetPanel.addComponent(row);
        Label rowLabel = new Label("", ContentMode.HTML);
        CheckBox cbImport = new CheckBox(null, true);
        if (!tagsetDefinitionImportStatus.isInProjectHistory()) {
            String doImportText = String.format("<b>%1$s</b> will be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            String doNotImportText = String.format("<b>%1$s</b> will <b>NOT</b> be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            rowLabel.setValue(doImportText);
            cbImport.addValueChangeListener(event -> {
                if (event.getValue()) {
                    rowLabel.setValue(doImportText);
                } else {
                    rowLabel.setValue(doNotImportText);
                }
            });
        } else if (!tagsetDefinitionImportStatus.isCurrent()) {
            String doImportText = String.format("<b>%1$s</b> was part of this Project, but had been removed!<br />" + "Importing it will re-add the removed Tagset and create a new version of it with the imported content.<br />" + "%1$s will be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            String doNotImportText = String.format("<b>%1$s</b> was part of this Project, but had been removed!<br />" + "Importing it will re-add the removed Tagset and create a new version of it with the imported content.<br />" + "%1$s will <b>NOT</b> be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            rowLabel.setValue(doImportText);
            cbImport.addValueChangeListener(event -> {
                if (event.getValue()) {
                    rowLabel.setValue(doImportText);
                } else {
                    rowLabel.setValue(doNotImportText);
                }
            });
        } else {
            String doImportText = String.format("<b>%1$s</b> is already part of this Project!<br />" + "Importing it will merge new Tags, Properties and Values from the imported Tagset into the existing Tagset.<br />" + "Please tick off the check box to import this Tagset!<br />" + "%1$s will be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            String doNotImportText = String.format("<b>%1$s</b> is already part of this Project!<br />" + "Importing it will merge new Tags, Properties and Values from the imported Tagset into the existing Tagset.<br />" + "Please tick off the check box to import this Tagset!<br />" + "%1$s will <b>NOT</b> be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            rowLabel.setValue(doNotImportText);
            cbImport.setValue(false);
            tagsetDefinitionImportStatus.setDoImport(false);
            cbImport.addValueChangeListener(event -> {
                if (event.getValue()) {
                    rowLabel.setValue(doImportText);
                } else {
                    rowLabel.setValue(doNotImportText);
                }
            });
        }
        row.addComponent(rowLabel);
        row.addComponent(cbImport);
        row.setComponentAlignment(cbImport, Alignment.MIDDLE_RIGHT);
        row.setExpandRatio(rowLabel, 1.0f);
        cbImport.addValueChangeListener(event -> tagsetDefinitionImportStatus.setDoImport(event.getValue()));
    }
}
Also used : Panel(com.vaadin.ui.Panel) ContentMode(com.vaadin.shared.ui.ContentMode) AbstractOkCancelDialog(de.catma.ui.dialog.AbstractOkCancelDialog) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) ComponentContainer(com.vaadin.ui.ComponentContainer) TagsetDefinitionImportStatus(de.catma.serialization.TagsetDefinitionImportStatus) List(java.util.List) CheckBox(com.vaadin.ui.CheckBox) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Label(com.vaadin.ui.Label) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout) Panel(com.vaadin.ui.Panel) CheckBox(com.vaadin.ui.CheckBox) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) TagsetDefinitionImportStatus(de.catma.serialization.TagsetDefinitionImportStatus) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 28 with AbstractOrderedLayout

use of com.vaadin.ui.AbstractOrderedLayout in project catma by forTEXT.

the class CollectionImportDialog method addContent.

@Override
protected void addContent(ComponentContainer content) {
    Label intro = new Label(String.format("We found %1$d Tagset(s) in the uploaded Collection.<br />" + "Importing the Collection will also import or update the following Tagsets:", tagsetDefinitionImportStatusList.size()), ContentMode.HTML);
    content.addComponent(intro);
    VerticalLayout tagsetPanel = new VerticalLayout();
    Panel tagsetScrollPanel = new Panel(tagsetPanel);
    tagsetScrollPanel.setSizeFull();
    content.addComponent(tagsetScrollPanel);
    ((AbstractOrderedLayout) content).setExpandRatio(tagsetScrollPanel, 0.9f);
    for (TagsetDefinitionImportStatus tagsetDefinitionImportStatus : this.tagsetDefinitionImportStatusList) {
        HorizontalLayout row = new HorizontalLayout();
        row.setSpacing(true);
        tagsetPanel.addComponent(row);
        Label rowLabel = new Label("", ContentMode.HTML);
        if (!tagsetDefinitionImportStatus.isInProjectHistory()) {
            String doImportText = String.format("<b>%1$s</b> is new to this Project and will be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            rowLabel.setValue(doImportText);
        } else if (!tagsetDefinitionImportStatus.isCurrent()) {
            String doImportText = String.format("<b>%1$s</b> was part of this Project, but had been removed!<br />" + "Importing the Collection will re-add the removed Tagset and create a new version of it with the imported content.<br />" + "%1$s will be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            rowLabel.setValue(doImportText);
        } else {
            String doImportText = String.format("<b>%1$s</b> is already part of this Project!<br />" + "Importing the Collection will merge not yet included Tags, Properties " + "and Values<br />from the Tagset of the imported Collection into the existing Tagset.<br />" + "%1$s will be imported!", tagsetDefinitionImportStatus.getTagset().getName());
            rowLabel.setValue(doImportText);
        }
        row.addComponent(rowLabel);
        row.setExpandRatio(rowLabel, 1.0f);
    }
}
Also used : Panel(com.vaadin.ui.Panel) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) TagsetDefinitionImportStatus(de.catma.serialization.TagsetDefinitionImportStatus) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 29 with AbstractOrderedLayout

use of com.vaadin.ui.AbstractOrderedLayout in project jmix by jmix-framework.

the class GroupBoxImpl method add.

@Override
public void add(Component childComponent, int index) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }
    AbstractOrderedLayout newContent = null;
    if (orientation == Orientation.VERTICAL && !(component.getContent() instanceof JmixVerticalActionsLayout)) {
        newContent = new JmixVerticalActionsLayout();
    } else if (orientation == Orientation.HORIZONTAL && !(component.getContent() instanceof JmixHorizontalActionsLayout)) {
        newContent = new JmixHorizontalActionsLayout();
    }
    if (newContent != null) {
        newContent.setStyleName("jmix-groupbox-inner");
        component.setContent(newContent);
        JmixOrderedActionsLayout currentContent = (JmixOrderedActionsLayout) component.getContent();
        newContent.setMargin(currentContent.getMargin());
        newContent.setSpacing(currentContent.isSpacing());
    }
    if (ownComponents.contains(childComponent)) {
        int existingIndex = getComponentContent().getComponentIndex(ComponentsHelper.getComposition(childComponent));
        if (index > existingIndex) {
            index--;
        }
        remove(childComponent);
    }
    com.vaadin.ui.Component vComponent = ComponentsHelper.getComposition(childComponent);
    getComponentContent().addComponent(vComponent, index);
    getComponentContent().setComponentAlignment(vComponent, WrapperUtils.toVaadinAlignment(childComponent.getAlignment()));
    if (frame != null) {
        if (childComponent instanceof BelongToFrame && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            ((FrameImplementation) frame).registerComponent(childComponent);
        }
    }
    if (index == ownComponents.size()) {
        ownComponents.add(childComponent);
    } else {
        ownComponents.add(index, childComponent);
    }
    childComponent.setParent(this);
}
Also used : JmixOrderedActionsLayout(io.jmix.ui.widget.JmixOrderedActionsLayout) JmixVerticalActionsLayout(io.jmix.ui.widget.JmixVerticalActionsLayout) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout) JmixHorizontalActionsLayout(io.jmix.ui.widget.JmixHorizontalActionsLayout)

Example 30 with AbstractOrderedLayout

use of com.vaadin.ui.AbstractOrderedLayout in project jmix by jmix-framework.

the class GroupBoxImpl method setExpandRatio.

@Override
public void setExpandRatio(Component component, float ratio) {
    AbstractOrderedLayout layout = getComponentContent();
    layout.setExpandRatio(component.unwrapComposition(com.vaadin.ui.Component.class), ratio);
}
Also used : AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout)

Aggregations

AbstractOrderedLayout (com.vaadin.ui.AbstractOrderedLayout)34 List (java.util.List)9 VerticalDropLocation (com.vaadin.shared.ui.dd.VerticalDropLocation)8 HorizontalLayout (com.vaadin.ui.HorizontalLayout)8 Label (com.vaadin.ui.Label)7 Collectors (java.util.stream.Collectors)7 Component (com.vaadin.ui.Component)6 ComponentContainer (com.vaadin.ui.ComponentContainer)6 VerticalLayout (com.vaadin.ui.VerticalLayout)6 Map (java.util.Map)6 Entry (java.util.Map.Entry)6 DCharts (org.dussan.vaadin.dcharts.DCharts)6 XYseries (org.dussan.vaadin.dcharts.base.elements.XYseries)6 DataSeries (org.dussan.vaadin.dcharts.data.DataSeries)6 Series (org.dussan.vaadin.dcharts.options.Series)6 Service (org.springframework.stereotype.Service)6 DataContainer (com.hack23.cia.service.api.DataContainer)5 LayoutBoundTransferable (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable)5 SimpleDateFormat (java.text.SimpleDateFormat)4 Locale (java.util.Locale)4