List of usage examples for com.vaadin.ui VerticalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:com.klwork.explorer.ui.custom.DetailPanel.java
License:Apache License
public DetailPanel() { setSizeFull();//from w w w .j a v a 2 s. co m addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL); setMargin(true); CssLayout cssLayout = new CssLayout(); // Needed for rounded corners, cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL); cssLayout.setSizeFull(); super.addComponent(cssLayout); mainPanel = new Panel(); mainPanel.addStyleName(Reindeer.PANEL_LIGHT); mainPanel.setSizeFull(); cssLayout.addComponent(mainPanel); // Use default layout VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setWidth(100, Unit.PERCENTAGE); verticalLayout.setMargin(true); mainPanel.setContent(verticalLayout); }
From source file:com.klwork.explorer.ui.main.views.AuthenticatedView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();//from w w w .j a va 2s . c om VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresAuthentication")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.GuestView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();//from w w w .j av a 2 s. c o m VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresGuest")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.RoleAdminView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();//from w ww .j a v a 2s. c o m VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresRoles(\"admin\")")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.RoleUserView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();/*w w w . j a va 2 s . c o m*/ VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresRoles(\"user\")")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.SampleMainView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();// www . j a v a 2 s. c o m VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); HorizontalLayout usernameLayout = new HorizontalLayout(); usernameLayout.setSpacing(true); usernameLayout.addComponent(new Label("Username:")); usernameLayout.addComponent(usernameLabel); //HorizontalLayout userRolesLayout = new HorizontalLayout(); //userRolesLayout.setSpacing(true); //userRolesLayout.addComponent(new Label("Roles:")); //userRolesLayout.addComponent(rolesLabel); layout.addComponent(usernameLayout); //addComponent(userRolesLayout); Link roleUserView = new Link("Role \"user\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleUserView.NAME)); Link roleAdminView = new Link("Role \"admin\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME)); Link authenticatedView = new Link("@RequiresAuthentication View (disabled, if user doesn't have access)", new ExternalResource("#!" + AuthenticatedView.NAME)); Link guestView = new Link("@RequiresGuest View (disabled, if user doesn't have access)", new ExternalResource("#!" + GuestView.NAME)); Link userView = new Link("@RequiresUser View (disabled, if user doesn't have access)", new ExternalResource("#!" + UserView.NAME)); roleUserView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleUserView.class)); roleAdminView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleAdminView.class)); authenticatedView.setEnabled(ShiroSecurityNavigator.hasAccess(AuthenticatedView.class)); guestView.setEnabled(ShiroSecurityNavigator.hasAccess(GuestView.class)); userView.setEnabled(ShiroSecurityNavigator.hasAccess(UserView.class)); layout.addComponent(roleUserView); layout.addComponent(roleAdminView); layout.addComponent(authenticatedView); layout.addComponent(guestView); layout.addComponent(userView); layout.addComponent(new Link("Role \"admin\" View (throw exception, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME))); layout.addComponent(new Link("Logout", new ExternalResource("/logout/"))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.UserView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();//from www . j ava 2 s.co m VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresUser")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.liferay.mail.vaadin.ConfirmDialog.java
License:Open Source License
public ConfirmDialog() { setModal(true);/*from w ww .ja va 2s .co m*/ VerticalLayout vl = new VerticalLayout(); vl.setMargin(true); vl.setSpacing(true); setContent(vl); setCaption(confirmWindowCaption); confirmButton.setCaption(Lang.get("ok")); confirmButton.setStyleName("primary"); cancelButton.setCaption(Lang.get("cancel")); cancelButton.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { closeDialog(); } }); vl.addComponent(message); vl.addComponent(extraLayout); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(confirmButton); buttons.addComponent(cancelButton); vl.addComponent(buttons); vl.setComponentAlignment(buttons, "right"); setWidth("300px"); setResizable(false); confirmButton.focus(); }
From source file:com.liferay.mail.vaadin.PasswordPrompt.java
License:Open Source License
public PasswordPrompt(Account account) { this.account = account; setCaption(Lang.get("please-enter-your-password-for-x", new String[] { account.getAddress() })); setWidth("400px"); setResizable(false);//from ww w. ja v a 2 s . c o m setModal(true); setClosable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); setContent(layout); password.setSecret(true); password.setWidth("100%"); addComponent(password); savePassword.setValue(account.isSavePassword()); addComponent(savePassword); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(loginBtn); buttons.setComponentAlignment(loginBtn, Alignment.MIDDLE_CENTER); buttons.addComponent(cancelBtn); buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_CENTER); addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); }
From source file:com.lizardtech.expresszip.vaadin.ExportOptionsViewComponent.java
License:Apache License
public ExportOptionsViewComponent(ExportProps exportProps) { this.exportProps = exportProps; listeners = new ArrayList<ExportOptionsViewListener>(); txtJobName = new TextField(JOB_NAME); txtEmail = new TextField(EMAIL_ADDRESS); txtUserNotation = new TextField(JOB_USER_NOTATION); numTilesLabel = new Label(); exportSizeEstimate = new Label(); outputFormatComboBox = new ComboBox(OUTPUT_FORMAT, OUTPUT_FORMATS); outputFormatComboBox.setTextInputAllowed(false); outputFormatComboBox.addListener(griddingValuesChangeListener); setSizeFull();/*from w w w . jav a 2 s .c o m*/ /** * Setup output resolution */ exportSizeComboBox = new ComboBox(null, exportSizes); exportSizeComboBox.setNullSelectionAllowed(false); exportSizeComboBox.setNewItemsAllowed(false); exportSizeComboBox.setTextInputAllowed(false); exportSizeComboBox.setImmediate(true); exportSizeComboBox.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Object choice = event.getProperty().getValue(); String value = ""; if (SMALL.equals(choice)) { gridCheckbox.setValue(Boolean.FALSE); gridCheckbox.setEnabled(false); value = "512"; } else if (MEDIUM.equals(choice)) { gridCheckbox.setValue(Boolean.FALSE); gridCheckbox.setEnabled(false); value = "1280"; } else if (LARGE.equals(choice)) { gridCheckbox.setValue(Boolean.FALSE); gridCheckbox.setEnabled(false); value = "5000"; } boolean custom = CUSTOM.equals(choice); if (!custom) { if (NATIVE.equals(choice)) { txtGroundResolution.setValue(Double.toString(maximumResolution)); } else { if (getExportProps().getAspectRatio() > 1.0d) { txtDimHeight.setValue(value); } else txtDimWidth.setValue(value); } } txtDimWidth.setEnabled(custom); txtDimHeight.setEnabled(custom); txtGroundResolution.setEnabled(custom); } }); // Add Output Resolution to view HorizontalLayout dimensionsLayout = new HorizontalLayout(); dimensionsLayout.addComponent(txtDimWidth); dimensionsLayout.addComponent(txtDimHeight); dimensionsLayout.setSpacing(true); dimensionsLayout.setWidth("100%"); // Format dimensions layout txtDimHeight.setMaxLength(10); txtDimHeight.setWidth("100%"); txtDimHeight.setImmediate(true); txtDimHeight.addListener(heightValChangeListener); txtDimHeight.setRequired(true); txtDimHeight.addValidator(new WidthHeightValidator()); txtDimWidth.setMaxLength(10); txtDimWidth.setWidth("100%"); txtDimWidth.setImmediate(true); txtDimWidth.addListener(widthValChangeListener); txtDimWidth.setRequired(true); txtDimWidth.addValidator(new WidthHeightValidator()); // Format Ground Resolution layout txtGroundResolution.setValue("0"); txtGroundResolution.setImmediate(true); txtGroundResolution.addListener(groundResValChangeListener); txtGroundResolution.setRequired(true); txtGroundResolution.addValidator(new GroundResolutionValidator()); vrtOutputResolution = new VerticalLayout(); vrtOutputResolution.setSpacing(true); vrtOutputResolution.addComponent(exportSizeComboBox); vrtOutputResolution.addComponent(dimensionsLayout); txtGroundResolution.setWidth("75%"); vrtOutputResolution.addComponent(txtGroundResolution); vrtOutputResolution.setComponentAlignment(txtGroundResolution, Alignment.BOTTOM_CENTER); /** * Setup Gridding options */ // Add Gridding option to view griddingLayout = new VerticalLayout(); griddingLayout.setSpacing(true); // Format GridCheckbox layout griddingLayout.addComponent(gridCheckbox); gridCheckbox.setImmediate(true); gridCheckbox.setValue(false); gridCheckbox.addListener(griddingModeChangeListener); xPixelsTextBox.setWidth("100%"); xPixelsTextBox.setImmediate(true); xPixelsTextBox.addValidator(new TileWidthValidator()); xPixelsTextBox.addListener(griddingValuesChangeListener); yPixelsTextBox.setWidth("100%"); yPixelsTextBox.setImmediate(true); yPixelsTextBox.addValidator(new TileHeightValidator()); yPixelsTextBox.addListener(griddingValuesChangeListener); xDistanceTextBox.setWidth("100%"); xDistanceTextBox.setImmediate(true); xDistanceTextBox.addValidator(new TileGeoXValidator()); xDistanceTextBox.addListener(griddingValuesChangeListener); yDistanceTextBox.setWidth("100%"); yDistanceTextBox.setImmediate(true); yDistanceTextBox.addValidator(new TileGeoYValidator()); yDistanceTextBox.addListener(griddingValuesChangeListener); // Format gridding options xTilesTextBox.setWidth("100%"); xTilesTextBox.setImmediate(true); xTilesTextBox.addValidator(new TileXDivisorValidator()); xTilesTextBox.addListener(griddingValuesChangeListener); yTilesTextBox.setWidth("100%"); yTilesTextBox.setImmediate(true); yTilesTextBox.addValidator(new TileYDivisorValidator()); yTilesTextBox.addListener(griddingValuesChangeListener); optGridOpt.setValue(GRID_TILE_DIMENSIONS); optGridOpt.setImmediate(true); optGridOpt.addListener(griddingModeChangeListener); HorizontalLayout hznGridOptions = new HorizontalLayout(); griddingLayout.addComponent(hznGridOptions); hznGridOptions.setWidth("100%"); hznGridOptions.setSpacing(true); hznGridOptions.addComponent(optGridOpt); VerticalLayout vrtGridComboFields = new VerticalLayout(); hznGridOptions.addComponent(vrtGridComboFields); vrtGridComboFields.setWidth("100%"); hznGridOptions.setExpandRatio(vrtGridComboFields, 1.0f); HorizontalLayout hznTileDim = new HorizontalLayout(); hznTileDim.setWidth("100%"); vrtGridComboFields.addComponent(hznTileDim); hznTileDim.addComponent(xPixelsTextBox); hznTileDim.addComponent(yPixelsTextBox); HorizontalLayout hznDistanceDim = new HorizontalLayout(); hznDistanceDim.setWidth("100%"); vrtGridComboFields.addComponent(hznDistanceDim); hznDistanceDim.addComponent(xDistanceTextBox); hznDistanceDim.addComponent(yDistanceTextBox); HorizontalLayout hznDivideGrid = new HorizontalLayout(); hznDivideGrid.setWidth("100%"); vrtGridComboFields.addComponent(hznDivideGrid); hznDivideGrid.addComponent(xTilesTextBox); hznDivideGrid.addComponent(yTilesTextBox); hznDivideGrid.setSpacing(true); hznTileDim.setSpacing(true); hznDistanceDim.setSpacing(true); /** * Format options panel */ // Add Format options to view formatOptionsLayout = new VerticalLayout(); formatOptionsLayout.setWidth("100%"); formatOptionsLayout.setSpacing(true); formatOptionsLayout.setMargin(true); // Format outputformat formatOptionsLayout.addComponent(outputFormatComboBox); outputFormatComboBox.setNullSelectionAllowed(false); formatOptionsLayout.addComponent(packageComboBox); packageComboBox.addItem(ExportProps.OutputPackageFormat.TAR); packageComboBox.addItem(ExportProps.OutputPackageFormat.ZIP); packageComboBox.setNullSelectionAllowed(false); packageComboBox.setTextInputAllowed(false); packageComboBox.setValue(ExportProps.OutputPackageFormat.ZIP); /** * Job Details */ // Set Jobname panel jobDetailsLayout = new VerticalLayout(); jobDetailsLayout.setSpacing(true); jobDetailsLayout.setMargin(true); jobDetailsLayout.addComponent(txtJobName); txtJobName.setRequired(true); txtJobName.setRequiredError("Please enter a job name."); txtJobName.setWidth("100%"); txtJobName.setImmediate(true); String jobname_regexp = "^[ A-Za-z0-9._-]{1,128}$"; txtJobName.addValidator(new RegexpValidator(jobname_regexp, "Job names should be alpha-numeric, less than 128 characters and may include spaces, dashes and underscores")); txtJobName.addValidator(new JobNameUniqueValidator( "A job by that name already exists in your configured export directory")); txtJobName.addListener(resolutionValuesChangeListener); jobDetailsLayout.addComponent(txtUserNotation); txtUserNotation.setWidth("100%"); txtUserNotation.setImmediate(true); String usernotation_regexp = "^[ A-Za-z0-9_-]{0,32}$"; txtUserNotation.addValidator(new RegexpValidator(usernotation_regexp, "User names should be alpha-numeric, less than 32 characters and may include spaces, dashes and underscores")); txtUserNotation.addListener(resolutionValuesChangeListener); // Format Email boolean enableEmail = new BackgroundExecutor.Factory().getBackgroundExecutor().getMailServices() .isValidEmailConfig(); txtEmail.setEnabled(enableEmail); if (enableEmail) { jobDetailsLayout.addComponent(txtEmail); txtEmail.setWidth("100%"); txtEmail.setInputPrompt("enter your email address"); txtEmail.setImmediate(true); txtEmail.addValidator(new EmailValidator("Invalid format for email address.")); txtEmail.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { updateSubmitEnabledState(); } }); } VerticalLayout exportSummary = new VerticalLayout(); exportSummary.addComponent(numTilesLabel); exportSummary.addComponent(exportSizeEstimate); jobDetailsLayout.addComponent(new Panel(("Export summary"), exportSummary)); // Set submit and back buttons // Add listeners to all fields backButton = new ExpressZipButton("Back", Style.STEP); backButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { ((ExpressZipWindow) getApplication().getMainWindow()).regressToPrev(); } }); submitButton = new ExpressZipButton("Submit", Style.STEP); submitButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { txtJobName.validate(); } catch (InvalidValueException e) { txtJobName.requestRepaint(); updateSubmitEnabledState(); return; } for (ExportOptionsViewListener listener : listeners) { listener.submitJobEvent(getExportProps()); } } }); accordian = new Accordion(); accordian.addStyleName("expresszip"); accordian.setImmediate(true); accordian.addTab(jobDetailsLayout, JOB_DETAILS); accordian.addTab(formatOptionsLayout, FORMAT_OPTIONS); accordian.setSizeFull(); outputDetails = new VerticalLayout(); outputDetails.setMargin(true); outputDetails.setSpacing(true); outputDetails.addComponent(new Panel(DIMENSIONS, vrtOutputResolution)); outputDetails.addComponent(new Panel(TILING, griddingLayout)); accordian.addTab(outputDetails, EXPORT_CONFIGURATION); HorizontalLayout backSubmitLayout = new HorizontalLayout(); backSubmitLayout.setWidth("100%"); backSubmitLayout.addComponent(backButton); backSubmitLayout.addComponent(submitButton); backSubmitLayout.setComponentAlignment(backButton, Alignment.BOTTOM_LEFT); backSubmitLayout.setComponentAlignment(submitButton, Alignment.BOTTOM_RIGHT); VerticalLayout navLayout = new VerticalLayout(); navLayout.addComponent(backSubmitLayout); navLayout.setSpacing(true); ThemeResource banner = new ThemeResource("img/ProgressBar3.png"); navLayout.addComponent(new Embedded(null, banner)); // add scrollbars around formLayout VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); layout.setSpacing(true); Label step = new Label("Step 3: Configure Export Options"); step.addStyleName("step"); layout.addComponent(step); layout.addComponent(accordian); layout.setExpandRatio(accordian, 1.0f); layout.addComponent(navLayout); layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER); setCompositionRoot(layout); outputFormatComboBox.select(OUTPUT_FORMATS.get(0)); forceGriddingCheck(); updateGriddingEnabledState(); }