List of usage examples for com.vaadin.ui Alignment BOTTOM_RIGHT
Alignment BOTTOM_RIGHT
To view the source code for com.vaadin.ui Alignment BOTTOM_RIGHT.
Click Source Link
From source file:edu.kit.dama.ui.admin.schedule.trigger.AddTriggerComponent.java
License:Apache License
/** * Build the main layout including the type selection combobox, the buttons * and the placeholder for the property configuration component. *///www . j ava2 s .c o m private void buildMainLayout() { triggerEditorLayout = new VerticalLayout(); triggerEditorLayout.setSizeFull(); triggerEditorLayout.setMargin(false); triggerEditorLayout.setSpacing(true); triggerEditorLayout.setWidth("400px"); triggerTypeSelectionBox = new ComboBox("TRIGGER TYPE"); triggerTypeSelectionBox.setWidth("100%"); triggerTypeSelectionBox.setNullSelectionAllowed(false); triggerTypeSelectionBox.addStyleName(CSSTokenContainer.BOLD_CAPTION); for (TRIGGER_TYPE type : TRIGGER_TYPE.values()) { triggerTypeSelectionBox.addItem(type.toString()); triggerTypeSelectionBox.setItemCaption(type.toString(), type.getName()); } triggerTypeSelectionBox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { updateTriggerSelection(TRIGGER_TYPE.valueOf((String) triggerTypeSelectionBox.getValue())); } }); final Button createButton = new Button("Create"); final Button cancelButton = new Button("Cancel"); Button.ClickListener listener = new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (cancelButton.equals(event.getButton()) || (createButton.equals(event.getButton()) && createTrigger())) { //hide window if cration was canceled or if createTrigger succeeded (and 'create' was pressed) parent.hideAddTriggerWindow(); } //otherwise, createTrigger failed } }; createButton.addClickListener(listener); cancelButton.addClickListener(listener); HorizontalLayout buttonLayout = new HorizontalLayout(cancelButton, createButton); buttonLayout.setSpacing(true); mainLayout = new VerticalLayout(triggerTypeSelectionBox, triggerEditorLayout, buttonLayout); mainLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT); mainLayout.setExpandRatio(triggerTypeSelectionBox, .1f); mainLayout.setExpandRatio(triggerEditorLayout, .9f); mainLayout.setExpandRatio(buttonLayout, .1f); mainLayout.setSpacing(true); triggerTypeSelectionBox.setValue(TRIGGER_TYPE.NOW_TRIGGER.toString()); }
From source file:edu.kit.dama.ui.admin.ServiceAccessTokenDialog.java
License:Apache License
private void buildMainLayout() { authenticatorSelection = new ComboBox("Credential Type"); authenticatorSelection.setWidth("100%"); authenticatorSelection.setNullSelectionAllowed(false); authenticatorSelection.addStyleName("myboldcaption"); //load all authenticators authenticators.add(new MainLoginAuthenticator()); authenticatorSelection.addItem(authenticators.get(0).getAuthenticatorId()); //fill authenticator list and selection box AuthenticatorFactory.getInstance().getAuthenticators().forEach((auth) -> { authenticators.add(auth);/*from w w w . ja v a 2 s . c o m*/ authenticatorSelection.addItem(auth.getAuthenticatorId()); }); //selection handler authenticatorSelection.addValueChangeListener((event) -> { String value = (String) authenticatorSelection.getValue(); authenticators.forEach((auth) -> { if (auth.getAuthenticatorId().equals(value)) { updateAuthenticatorAttributeLayout(auth); } }); }); //generate secret handling generateButton.addClickListener((event) -> { String newSecret = RandomStringUtils.randomAlphanumeric(16); if (secretField != null) { //check this just to get sure secretField.setValue(newSecret); nosecretField.setValue(newSecret); UIComponentTools.showInformation("New random secret has been generated."); } }); //show secret handling showSecret.addValueChangeListener((event2) -> { if (secretField != null) { //check this just to get sure if (showSecret.getValue()) { nosecretField.setValue(secretField.getValue()); authenticatorConfigurationLayout.replaceComponent(secretField, nosecretField); } else { secretField.setValue(nosecretField.getValue()); authenticatorConfigurationLayout.replaceComponent(nosecretField, secretField); } } }); ClickListener listener = (Button.ClickEvent event) -> { boolean update = false; boolean created = false; if (okButton.equals(event.getSource()) && selectedId > 0) { //update of existing credential update = true; IMetaDataManager mdm = MetaDataManagement.getMetaDataManagement().getMetaDataManager(); mdm.setAuthorizationContext(UIHelper.getSessionContext()); try { ServiceAccessToken existingToken = mdm.find(ServiceAccessToken.class, selectedId); //transfer information from existing token to new one and persist ServiceAccessToken newToken = getToken(existingToken.getUserId()); newToken.setId(selectedId); newToken.setServiceId(existingToken.getServiceId()); mdm.save(newToken); } catch (UnauthorizedAccessAttemptException | SecretEncryptionException ex) { UIComponentTools.showWarning("Unable to store credential."); return; } finally { mdm.close(); } } else if (okButton.equals(event.getSource()) && selectedId <= 0) { //creation of new token String typeSelection = (String) authenticatorSelection.getValue(); IMetaDataManager mdm = MetaDataManagement.getMetaDataManagement().getMetaDataManager(); mdm.setAuthorizationContext(UIHelper.getSessionContext()); String userId = UIHelper.getSessionUser().getDistinguishedName(); try { try { List<ServiceAccessToken> token = mdm.findResultList( "SELECT t FROM ServiceAccessToken t WHERE t.serviceId=?1 AND t.userId=?2", new Object[] { typeSelection, userId }, ServiceAccessToken.class); if (!token.isEmpty()) { UIComponentTools.showWarning("There exists already a credential of type '" + typeSelection + "' for your userId."); return; } } catch (UnauthorizedAccessAttemptException ex) { UIComponentTools.showWarning("Unable to check for existing credential."); return; } ServiceAccessToken newToken = getToken(userId); String uid = newToken.getUserId(); newToken.setUserId(null); if (!mdm.find(newToken, newToken).isEmpty()) { throw new UnauthorizedAccessAttemptException("Duplicate credential detected."); } newToken.setUserId(uid); mdm.save(newToken); created = true; } catch (UnauthorizedAccessAttemptException | SecretEncryptionException ex) { UIComponentTools .showWarning("Failed to create new credential. (Message: " + ex.getMessage() + ")"); return; } finally { mdm.close(); } } //close window if (currentWin != null) { UI.getCurrent().removeWindow(currentWin); if (update) { UIComponentTools.showInformation("Credential successfully updated."); } else if (created) { UIComponentTools.showInformation("Credential successfully created."); } } }; okButton.addClickListener(listener); cancelButton.addClickListener(listener); //fill dummy config layout authenticatorConfigurationLayout = new GridLayout(1, 1); authenticatorConfigurationLayout.addComponent(new Label("Please select an authenticator.")); authenticatorConfigurationLayout.setSpacing(true); authenticatorConfigurationLayout.setWidth("400px"); HorizontalLayout buttonLayout = new HorizontalLayout(cancelButton, okButton); buttonLayout.setSpacing(true); mainLayout = new VerticalLayout(authenticatorSelection, authenticatorConfigurationLayout, buttonLayout); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.setExpandRatio(authenticatorConfigurationLayout, 1.0f); mainLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT); }
From source file:edu.kit.dama.ui.admin.ServiceAccessTokenDialog.java
License:Apache License
private void updateAuthenticatorAttributeLayout(AbstractAuthenticator authenticator) { UIUtils7.GridLayoutBuilder builder;/*from w w w .j a v a 2s. c o m*/ String[] attributes = authenticator.getCredentialAttributeNames(); switch (attributes.length) { case 0: { tokenField = null; secretField = null; nosecretField = null; builder = new UIUtils7.GridLayoutBuilder(1, 1); break; } case 1: { tokenField = new TextField(attributes[0]); tokenField.addStyleName("myboldcaption"); secretField = null; nosecretField = null; builder = new UIUtils7.GridLayoutBuilder(1, 1); break; } default: { tokenField = new TextField(attributes[0]); tokenField.addStyleName("myboldcaption"); secretField = new PasswordField(attributes[1]); secretField.addStyleName("myboldcaption"); nosecretField = new TextField(attributes[1]); nosecretField.addStyleName("myboldcaption"); builder = new UIUtils7.GridLayoutBuilder(2, 3); } } if (tokenField != null) { builder.fillRow(tokenField, 0, 0, 1); } else { builder.fillRow(new Label("No configuration needed."), 0, 0, 1); } if (secretField != null) { builder.addComponent(secretField, 0, 1); builder.addComponent(generateButton, Alignment.BOTTOM_RIGHT, 1, 1, 1, 1); builder.fillRow(showSecret, 0, 2, 1); } GridLayout newLayout = builder.getLayout(); newLayout.setSpacing(true); newLayout.setWidth("400px"); mainLayout.replaceComponent(authenticatorConfigurationLayout, newLayout); authenticatorConfigurationLayout = newLayout; }
From source file:edu.kit.dama.ui.admin.staging.accesspoints.AccessPointBasePropertiesLayout.java
License:Apache License
/** * Default constructor./*from w ww. java 2s . co m*/ */ public AccessPointBasePropertiesLayout() { LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setSizeFull(); setMargin(true); setSpacing(true); setColumns(4); setRows(4); getCheckBoxesLayout().addComponent(getTransientBox()); addComponent(getNameField(), 0, 0, 1, 0); addComponent(getGroupBox(), 3, 0); addComponent(getRemoteBaseUrlField(), 0, 1, 1, 1); addComponent(getLocalBasePathField(), 0, 2); addComponent(getPathSelectorButton(), 1, 2); addComponent(getCheckBoxesLayout(), 3, 1, 3, 2); addComponent(getDescriptionArea(), 0, 3, 3, 3); setComponentAlignment(getPathSelectorButton(), Alignment.BOTTOM_RIGHT); setColumnExpandRatio(0, .88f); setColumnExpandRatio(1, 0.01f); setColumnExpandRatio(2, 0.01f); setColumnExpandRatio(3, 0.1f); setRowExpandRatio(3, 1f); }
From source file:edu.kit.dama.ui.admin.staging.accesspoints.StagingAccessPointConfigurationTab.java
License:Apache License
@Override public GridLayout buildMainLayout() { String id = "mainLayout"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); UIUtils7.GridLayoutBuilder mainLayoutBuilder = new UIUtils7.GridLayoutBuilder(3, 3); // Add components to mainLayout mainLayoutBuilder.fillColumn(getElementList(), 0, 0, 1); mainLayoutBuilder.addComponent(getImplementationClassField(), 1, 0, 1, 1) .addComponent(getLoadImplementationClassButton(), Alignment.BOTTOM_RIGHT, 2, 0, 1, 1); mainLayoutBuilder.fillRow(getPropertiesPanel(), 1, 1, 1); mainLayoutBuilder.addComponent(getNavigateButton(), Alignment.BOTTOM_LEFT, 1, 2, 1, 1) .addComponent(getCommitChangesButton(), Alignment.BOTTOM_RIGHT, 2, 2, 1, 1); mainLayout = mainLayoutBuilder.getLayout(); mainLayout.setId(DEBUG_ID_PREFIX + id); mainLayout.setSizeFull();/*from w w w . j a v a2 s. co m*/ mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.setColumnExpandRatio(1, 1f); mainLayout.setRowExpandRatio(1, 1f); return mainLayout; }
From source file:edu.kit.dama.ui.admin.staging.processors.StagingProcessorBasePropertiesLayout.java
License:Apache License
public StagingProcessorBasePropertiesLayout() { super();/*from ww w .j av a 2s.c o m*/ LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setSizeFull(); setMargin(true); setSpacing(true); setColumns(3); setRows(4); /////////check layout and relocate addComponent(getNameField(), 0, 0, 2, 0); addComponent(getGroupBox(), 0, 1, 1, 1); Label minus = new Label("-"); minus.addStyleName(CSSTokenContainer.BOLD_CAPTION); Label plus = new Label("+"); plus.addStyleName(CSSTokenContainer.BOLD_CAPTION); sliderLayout = new HorizontalLayout(minus, getPrioritySlider(), plus); sliderLayout.setComponentAlignment(minus, Alignment.BOTTOM_RIGHT); sliderLayout.setComponentAlignment(plus, Alignment.BOTTOM_LEFT); sliderLayout.setExpandRatio(getPrioritySlider(), .96f); sliderLayout.setExpandRatio(minus, .02f); sliderLayout.setExpandRatio(plus, .02f); sliderLayout.setWidth("100%"); addComponent(sliderLayout, 0, 2, 1, 2); getCheckBoxesLayout().addComponent(getIngestProcessingSupportedBox()); getCheckBoxesLayout().addComponent(getDownloadProcessingSupportedBox()); addComponent(getCheckBoxesLayout(), 2, 1, 2, 2); addComponent(getDescriptionArea(), 0, 3, 2, 3); setColumnExpandRatio(0, .79f); setColumnExpandRatio(1, 0.01f); setColumnExpandRatio(2, 0.2f); setRowExpandRatio(3, 1f); }
From source file:edu.kit.dama.ui.admin.staging.processors.StagingProcessorConfigurationTab.java
License:Apache License
/** * * @return//w ww .j av a 2s. c om */ @Override public GridLayout buildMainLayout() { String id = "mainLayout"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); UIUtils7.GridLayoutBuilder mainLayoutBuilder = new UIUtils7.GridLayoutBuilder(3, 3); // Add components to mainLayout mainLayoutBuilder.fillColumn(getElementList(), 0, 0, 1); mainLayoutBuilder.addComponent(getImplementationClassField(), 1, 0, 1, 1) .addComponent(getLoadImplementationClassButton(), Alignment.BOTTOM_RIGHT, 2, 0, 1, 1); mainLayoutBuilder.fillRow(getPropertiesPanel(), 1, 1, 1); mainLayoutBuilder.addComponent(getNavigateButton(), Alignment.BOTTOM_LEFT, 1, 2, 1, 1) .addComponent(getCommitChangesButton(), Alignment.BOTTOM_RIGHT, 2, 2, 1, 1); mainLayout = mainLayoutBuilder.getLayout(); mainLayout.setId(DEBUG_ID_PREFIX + id); mainLayout.setSizeFull(); mainLayout.setImmediate(true); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.setColumnExpandRatio(1, 1f); mainLayout.setRowExpandRatio(1, 1f); return mainLayout; }
From source file:edu.kit.dama.ui.admin.utils.PathSelector.java
License:Apache License
/** * */// w w w . j av a 2 s. com private void buildMainLayout() { String id = "mainLayout"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); mainLayout = new GridLayout(3, 3); mainLayout.setImmediate(true); mainLayout.setSizeFull(); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.addComponent(getRootBox(), 0, 0); mainLayout.addComponent(getTreeTable(), 0, 1, 2, 1); mainLayout.addComponent(getPathField(), 0, 2, 1, 2); mainLayout.addComponent(getSelectButton(), 2, 2); mainLayout.setComponentAlignment(getPathField(), Alignment.BOTTOM_LEFT); mainLayout.setComponentAlignment(getSelectButton(), Alignment.BOTTOM_RIGHT); mainLayout.setColumnExpandRatio(0, 0.4f); mainLayout.setColumnExpandRatio(1, 0.39f); mainLayout.setColumnExpandRatio(2, 0.01f); mainLayout.setRowExpandRatio(0, 0.01f); mainLayout.setRowExpandRatio(1, 0.9f); mainLayout.setRowExpandRatio(2, 0.01f); }
From source file:edu.kit.dama.ui.admin.wizard.FirstStartWizard.java
License:Apache License
private void buildMainLayout() { stepLayout = new VerticalLayout(); back.setEnabled(false);// www .ja va 2 s . c om stepLayout.addComponent(stepList[currentStep]); stepLayout.setComponentAlignment(stepList[currentStep], Alignment.TOP_RIGHT); stepLayout.setSpacing(false); stepLayout.setMargin(false); stepLayout.setWidth("100%"); stepLayout.setHeight("500px"); final VerticalLayout stepLabels = new VerticalLayout(); for (WizardStep step : stepList) { Label stepLabel = new Label(step.getStepName()); stepLabel.setWidth("250px"); stepLabels.addComponent(stepLabel); stepLabels.setComponentAlignment(stepLabel, Alignment.TOP_LEFT); } //make introduction label bold stepLabels.getComponent(0).addStyleName("myboldcaption"); Label spacer = new Label(); stepLabels.addComponent(spacer); stepLabels.setExpandRatio(spacer, 1.0f); stepLabels.setWidth("275px"); stepLabels.setHeight("550px"); stepLabels.setSpacing(true); UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 2); HorizontalLayout buttonLayout = new HorizontalLayout(back, next); buttonLayout.setSizeFull(); buttonLayout.setComponentAlignment(back, Alignment.BOTTOM_RIGHT); buttonLayout.setComponentAlignment(next, Alignment.BOTTOM_RIGHT); buttonLayout.setExpandRatio(back, 1.0f); next.addClickListener((event) -> { if ("Go To Login".equals(next.getCaption())) { Page.getCurrent().reload(); } else if ("Finish".equals(next.getCaption())) { //do finish WizardPersistHelper helper = new WizardPersistHelper(); if (helper.persist(properties)) { UIUtils7.showInformation("Success", "All information have been successfully stored into the database. For details, please refer to the log output above.\n" + "You may now dismiss this message and click 'Go To Login' in order to access the login page.\n" + "From there you can to login using your administrator account or create a personalized user account.", 3000); back.setVisible(false); next.setCaption("Go To Login"); } else { UIUtils7.showError("Failed to store collected information in database.\n" + "Please refer to the log output above."); } ((WizardSummary) stepList[currentStep]).setSummary(helper.getMessages()); } else { if (currentStep + 1 <= stepList.length - 1) { if (stepList[currentStep].validate()) { stepList[currentStep].collectProperties(properties); currentStep++; stepLayout.replaceComponent(stepList[currentStep - 1], stepList[currentStep]); Label currentLabel = (Label) stepLabels.getComponent(currentStep); Label prevLabel = (Label) stepLabels.getComponent(currentStep - 1); currentLabel.addStyleName("myboldcaption"); prevLabel.removeStyleName("myboldcaption"); if (stepList[currentStep] instanceof WizardSummary) { StringBuilder summary = new StringBuilder(); for (WizardStep step : stepList) { summary.append(step.getSummary()).append("\n"); } ((WizardSummary) stepList[currentStep]).setSummary(summary.toString()); } } } if (currentStep == stepList.length - 1) { //finish next.setCaption("Finish"); } else { next.setCaption("Next"); } back.setEnabled(true); } }); back.addClickListener((event) -> { if (currentStep - 1 >= 0) { stepList[currentStep].collectProperties(properties); currentStep--; stepLayout.replaceComponent(stepList[currentStep + 1], stepList[currentStep]); Label currentLabel = (Label) stepLabels.getComponent(currentStep); Label prevLabel = (Label) stepLabels.getComponent(currentStep + 1); currentLabel.addStyleName("myboldcaption"); prevLabel.removeStyleName("myboldcaption"); } next.setEnabled(true); back.setEnabled(currentStep > 0); next.setCaption("Next"); }); builder.addComponent(stepLabels, Alignment.TOP_LEFT, 0, 0, 1, 2); builder.addComponent(stepLayout, Alignment.TOP_LEFT, 1, 0, 1, 1); builder.addComponent(buttonLayout, Alignment.BOTTOM_LEFT, 1, 1, 1, 1); mainLayout = builder.getLayout(); mainLayout.setMargin(true); mainLayout.setSizeFull(); // mainLayout.setColumnExpandRatio(0, .3f); mainLayout.setColumnExpandRatio(1, 1f); mainLayout.setRowExpandRatio(0, .95f); mainLayout.setRowExpandRatio(1, .05f); }
From source file:edu.kit.dama.ui.admin.workflow.DataWorkflowBasePropertiesLayout.java
License:Apache License
public DataWorkflowBasePropertiesLayout() { LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setSizeFull();/*from w w w .j a v a2 s . co m*/ setMargin(true); setSpacing(true); setCaption("TASK CONFIGURATION"); setColumns(4); setRows(6); //first row addComponent(getNameField(), 0, 0); addComponent(getVersionField(), 1, 0); addComponent(getContactBox(), 2, 0); addComponent(getGroupBox(), 3, 0); //second row addComponent(getApplicationPackageUrlField(), 0, 1, 1, 1); addComponent(getApplicationArgumentsField(), 2, 1); //addComponent(getCheckBoxesLayout(), 3, 1, 3, 2); //add placeholder only addComponent(new VerticalLayout(), 3, 1, 3, 2); Label l = new Label("* Changing fields with a red border will update the version of the associated task."); l.addStyleName("red-text"); addComponent(l, 0, 2, 2, 2); l.setHeight("12px"); setComponentAlignment(l, Alignment.TOP_CENTER); // addComponent(getKeywordsField(), 0, 3, 2, 3); // addComponent(getDescriptionArea(), 0, 4, 2, 5); Button addPropertyButton = new Button(); addPropertyButton.setIcon(new ThemeResource(IconContainer.ADD)); addPropertyButton.addClickListener((Button.ClickEvent event) -> { addPropertyComponent.reset(); addPropertyComponent.showWindow(); }); HorizontalLayout layout = new HorizontalLayout(getEnvironmentPropertiesSelect(), addPropertyButton); layout.setComponentAlignment(getEnvironmentPropertiesSelect(), Alignment.TOP_LEFT); layout.setComponentAlignment(addPropertyButton, Alignment.BOTTOM_RIGHT); layout.setSizeFull(); layout.setExpandRatio(getEnvironmentPropertiesSelect(), .95f); layout.setExpandRatio(addPropertyButton, .05f); addComponent(layout, 3, 3, 3, 5); //add popup to layout addPropertyComponent = new AddEnvironmentPropertyComponent(this); //set dummy row height to 0 setColumnExpandRatio(0, 0.2f); setColumnExpandRatio(1, 0.15f); setColumnExpandRatio(2, 0.2f); setColumnExpandRatio(3, 0.25f); setRowExpandRatio(5, 1f); }