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());
}
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()));
}
}
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);
}
}
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);
}
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);
}
Aggregations