use of com.vaadin.ui.HorizontalLayout in project Activiti by Activiti.
the class EditorProcessDefinitionDetailPanel method initHeader.
protected void initHeader() {
GridLayout details = new GridLayout(2, 2);
details.setWidth(100, UNITS_PERCENTAGE);
details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
details.setSpacing(true);
details.setMargin(false, false, true, false);
details.setColumnExpandRatio(1, 1.0f);
detailPanelLayout.addComponent(details);
// Image
Embedded image = new Embedded(null, Images.PROCESS_50);
details.addComponent(image, 0, 0, 0, 1);
// Name
Label nameLabel = new Label(modelData.getName());
nameLabel.addStyleName(Reindeer.LABEL_H2);
details.addComponent(nameLabel, 1, 0);
// Properties
HorizontalLayout propertiesLayout = new HorizontalLayout();
propertiesLayout.setSpacing(true);
details.addComponent(propertiesLayout);
// Version
String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, modelData.getVersion());
Label versionLabel = new Label(versionString);
versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
propertiesLayout.addComponent(versionLabel);
}
use of com.vaadin.ui.HorizontalLayout in project Activiti by Activiti.
the class NewModelPopupWindow method addButtons.
protected void addButtons() {
// Create
Button createButton = new Button(i18nManager.getMessage(Messages.PROCESS_NEW_POPUP_CREATE_BUTTON));
createButton.setWidth("200px");
createButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (StringUtils.isEmpty((String) nameTextField.getValue())) {
nameTextField.setComponentError(new UserError("The name field is required."));
return;
}
if (selectEditorComponent.isModelerPreferred()) {
try {
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
editorNode.put("stencilset", stencilSetNode);
Model modelData = repositoryService.newModel();
ObjectNode modelObjectNode = objectMapper.createObjectNode();
modelObjectNode.put(MODEL_NAME, (String) nameTextField.getValue());
modelObjectNode.put(MODEL_REVISION, 1);
String description = null;
if (StringUtils.isNotEmpty((String) descriptionTextArea.getValue())) {
description = (String) descriptionTextArea.getValue();
} else {
description = "";
}
modelObjectNode.put(MODEL_DESCRIPTION, description);
modelData.setMetaInfo(modelObjectNode.toString());
modelData.setName((String) nameTextField.getValue());
repositoryService.saveModel(modelData);
repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));
close();
ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(modelData.getId());
URL explorerURL = ExplorerApp.get().getURL();
URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") + "modeler.html?modelId=" + modelData.getId());
ExplorerApp.get().getMainWindow().open(new ExternalResource(url));
} catch (Exception e) {
notificationManager.showErrorNotification("error", e);
}
} else {
close();
ExplorerApp.get().getViewManager().showSimpleTableProcessEditor((String) nameTextField.getValue(), (String) descriptionTextArea.getValue());
}
}
});
// Alignment
HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.setSpacing(true);
buttonLayout.addComponent(createButton);
addComponent(buttonLayout);
windowLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);
}
use of com.vaadin.ui.HorizontalLayout in project Activiti by Activiti.
the class SelectEditorComponent method createModelerEditorChoice.
protected void createModelerEditorChoice() {
modelerLayout = new HorizontalLayout();
modelerLayout.setWidth("300px");
modelerLayout.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
addComponent(modelerLayout);
modelerButton = new Button();
modelerButton.setIcon(Images.PROCESS_EDITOR_BPMN);
modelerButton.setStyleName(Reindeer.BUTTON_LINK);
modelerLayout.addComponent(modelerButton);
modelerLayout.setComponentAlignment(modelerButton, Alignment.MIDDLE_LEFT);
VerticalLayout modelerTextLayout = new VerticalLayout();
modelerLayout.addComponent(modelerTextLayout);
modelerLayout.setExpandRatio(modelerTextLayout, 1.0f);
modelerLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_MODELER));
modelerLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
modelerTextLayout.addComponent(modelerLabel);
modelerDescriptionLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_MODELER_DESCRIPTION));
modelerDescriptionLabel.addStyleName(Reindeer.LABEL_SMALL);
modelerDescriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
modelerTextLayout.addComponent(modelerDescriptionLabel);
modelerLayout.addListener(new LayoutClickListener() {
public void layoutClick(LayoutClickEvent event) {
preferModeler();
}
});
modelerButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
preferModeler();
}
});
}
use of com.vaadin.ui.HorizontalLayout in project Activiti by Activiti.
the class SelectUsersPopupWindow method initUserSelection.
protected void initUserSelection() {
userSelectionLayout = new HorizontalLayout();
userSelectionLayout.setSpacing(true);
addComponent(userSelectionLayout);
initMatchingUsersTable();
// non-multi select: only one table
if (multiSelect) {
initSelectUserButton();
initSelectedUsersTable();
}
}
use of com.vaadin.ui.HorizontalLayout in project Activiti by Activiti.
the class ImageAttachmentRenderer method getDetailComponent.
@Override
public Component getDetailComponent(Attachment attachment) {
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setSizeUndefined();
verticalLayout.setSpacing(true);
verticalLayout.setMargin(true);
Label description = new Label(attachment.getDescription());
description.setSizeUndefined();
verticalLayout.addComponent(description);
// Image
TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
String mimeType = extractMineType(attachment.getType());
InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550);
Resource resource = new StreamResource(new InputStreamStreamSource(imageStream), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get());
Embedded image = new Embedded(null, resource);
verticalLayout.addComponent(image);
// Linke
HorizontalLayout LinkLayout = new HorizontalLayout();
LinkLayout.setSpacing(true);
verticalLayout.addComponent(LinkLayout);
verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER);
Label fullSizeLabel = new Label(ExplorerApp.get().getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE));
LinkLayout.addComponent(fullSizeLabel);
Link link = null;
if (attachment.getUrl() != null) {
link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
} else {
taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
Resource res = new StreamResource(new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get());
link = new Link(attachment.getName(), res);
}
link.setIcon(Images.RELATED_CONTENT_PICTURE);
link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK);
LinkLayout.addComponent(link);
return verticalLayout;
}
Aggregations