Example usage for com.vaadin.ui HorizontalLayout setWidth

List of usage examples for com.vaadin.ui HorizontalLayout setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 *  ????/*from  w ww  .j  a  va2  s .c o m*/
 * @param panelContent
 */
private void createCsrSelectTables(VerticalLayout panelContent) {
    csrSelectHLayout = new HorizontalLayout();
    csrSelectHLayout.setSpacing(true);
    csrSelectHLayout.setVisible(false);
    csrSelectHLayout.setWidth("100%");
    panelContent.addComponent(csrSelectHLayout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    caption.setDescription("<B>??</B>");
    csrSelectHLayout.addComponent(caption);

    // ???
    HorizontalLayout panelLayout = new HorizontalLayout();
    panelLayout.setSpacing(true);
    panelLayout.setMargin(false, true, false, true);
    panelLayout.setWidth("100%");

    Panel tablePanel = new Panel();
    tablePanel.setContent(panelLayout);
    csrSelectHLayout.addComponent(tablePanel);
    csrSelectHLayout.setExpandRatio(tablePanel, 1.0f);

    // (??)
    VerticalLayout leftComponents = createLeftComponents();
    panelLayout.addComponent(leftComponents);
    panelLayout.setExpandRatio(leftComponents, 0.4f);

    // ??("?")
    VerticalLayout middleComponents = createMiddleComponents();
    panelLayout.addComponent(middleComponents);
    panelLayout.setComponentAlignment(middleComponents, Alignment.MIDDLE_CENTER);
    panelLayout.setExpandRatio(middleComponents, 0.2f);

    // ?(????)
    VerticalLayout rightComponents = createRightComponents();
    panelLayout.addComponent(rightComponents);
    panelLayout.setExpandRatio(rightComponents, 0.4f);
}

From source file:com.klwork.explorer.project.MyCalendarView.java

License:Apache License

private void initLayoutContent() {
    initNavigationButtons();//from   ww w .j ava2s .c o  m
    initHideWeekEndButton();
    initReadOnlyButton();
    initDisabledButton();
    initAddNewEventButton();

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    hl.setSpacing(true);
    hl.setMargin(new MarginInfo(false, false, true, false));
    hl.addComponent(prevButton);
    hl.addComponent(captionLabel);
    hl.addComponent(monthButton);
    hl.addComponent(weekButton);
    hl.addComponent(nextButton);
    hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT);
    hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);

    monthButton.setVisible(viewMode == Mode.WEEK);
    weekButton.setVisible(viewMode == Mode.DAY);

    HorizontalLayout controlPanel = new HorizontalLayout();
    controlPanel.setSpacing(true);
    controlPanel.setMargin(new MarginInfo(false, false, true, false));
    controlPanel.setWidth("100%");
    //controlPanel.addComponent(localeSelect);
    //controlPanel.addComponent(timeZoneSelect);
    controlPanel.addComponent(formatSelect);
    controlPanel.addComponent(hideWeekendsButton);
    //controlPanel.addComponent(readOnlyButton);
    //controlPanel.addComponent(disabledButton);
    controlPanel.addComponent(addNewEvent);

    /*controlPanel.setComponentAlignment(timeZoneSelect,
        Alignment.MIDDLE_LEFT);*/
    controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT);
    /*controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT);*/
    controlPanel.setComponentAlignment(hideWeekendsButton, Alignment.MIDDLE_LEFT);
    /* controlPanel.setComponentAlignment(readOnlyButton,
        Alignment.MIDDLE_LEFT);
     controlPanel.setComponentAlignment(disabledButton,
        Alignment.MIDDLE_LEFT);*/
    controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT);

    GridLayout layout = (GridLayout) getContent();
    layout.addComponent(controlPanel);
    layout.addComponent(hl);
    layout.addComponent(calendarComponent);
    layout.setRowExpandRatio(layout.getRows() - 1, 1.0f);
}

From source file:com.kohmiho.mpsr.MPSRUI.java

private void initLayout() {

    setContent(splitPanel1);/*  w  ww.  j a v  a  2s  .  c  o  m*/

    VerticalLayout tableLayout = new VerticalLayout();
    splitPanel1.setFirstComponent(tableLayout);
    splitPanel1.setSecondComponent(splitPanel2);
    splitPanel1.setSplitPosition(30); // percentage

    VerticalLayout treeLayout = new VerticalLayout();
    splitPanel2.setFirstComponent(treeLayout);
    splitPanel2.setSecondComponent(welcomePage);
    splitPanel2.setSplitPosition(30);

    Label labelPrototype = new Label("Prototype");
    labelPrototype.setStyleName("prototype2");

    tree.setSizeFull();

    treeLayout.addComponent(labelPrototype);
    treeLayout.addComponent(tree);
    treeLayout.setSizeFull();
    treeLayout.setExpandRatio(tree, 1);

    // ***************************************************//

    HorizontalLayout tableLayoutTop = new HorizontalLayout();
    tableLayout.addComponent(tableLayoutTop);

    tableLayoutTop.addComponent(pdflink);
    // tableLayoutTop.addComponent(wordLink);
    tableLayoutTop.addComponent(saveMPSRButton);
    tableLayoutTop.addComponent(removeMPSRButton);

    pdflink.setTargetName("_blank");
    // wordLink.setTargetName("_blank");

    tableLayout.addComponent(mpsrTable);

    HorizontalLayout bottomLeftLayout = new HorizontalLayout();
    tableLayout.addComponent(bottomLeftLayout);

    bottomLeftLayout.addComponent(searchField);
    bottomLeftLayout.addComponent(addNewMPSRButton);

    tableLayout.setSizeFull();
    tableLayout.setExpandRatio(mpsrTable, 1);
    tableLayoutTop.setWidth("100%");
    mpsrTable.setSizeFull();
    bottomLeftLayout.setWidth("100%");
    searchField.setWidth("100%");
    bottomLeftLayout.setExpandRatio(searchField, 1);

}

From source file:com.kpg.diary.ui.MenuLayout.java

License:Apache License

/**
 * Builds the menu.// www .ja va2  s .  c o  m
 *
 * @param navigator
 *            the navigator
 * @return the css layout
 */
private CssLayout buildMenu(Navigator navigator) {
    // Add items
    menuItemsMap();
    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.addStyleName(ValoTheme.MENU_TITLE);

    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    menu.addComponent(top);
    // menu.addComponent(createThemeSelect());
    menu.addComponent(top);
    Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    Label title = new Label("<h2>Diary</h2>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);
    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);
    for (final Entry<String, String> item : menuItems.entrySet()) {
        Button b = new Button(item.getValue(), new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
        if (IConstants.NavigationMenu.ADDRESS.getKey().equals(item.getKey())) {
            b.setIcon(FontAwesome.BOOK);
        } else if (IConstants.NavigationMenu.PERSON.getKey().equals(item.getKey())) {
            b.setIcon(FontAwesome.USER);
        } else {
            b.setIcon(FontAwesome.APPLE);
        }
        menuItemsLayout.addComponent(b);
    }
    return menu;
}

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 ww. jav  a2 s .co  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();
}

From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java

public PrimaryMasterPage() {

    //ContextWidget c= new ContextWidget();

    HorizontalLayout iHorizontalLayout = new HorizontalLayout();
    //addComponent(iHorizontalLayout,"top:0px;left:0px");
    iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth()));
    iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight()));
    iHorizontalLayout.setStyleName("backColorBlack");

    //String[] captions1 = {"Logo Here", "My Cool School", "Third"};

    //Layout A and its sub components
    Panel AP = new Panel();
    iHorizontalLayout.addComponent(AP);//from  www  . j  av  a 2s .c o  m
    AP.setSizeFull();
    AP.setStyleName("backColorBlack");
    VerticalLayout A1 = new VerticalLayout();
    AP.setContent(A1);
    //A.setSizeFull();
    A1.setSpacing(true);
    iHorizontalLayout.setExpandRatio(AP, 1);

    A1.setStyleName("backColorBlack");
    A1.setMargin(new MarginInfo(true, true, true, true));

    Button logoImage = new Button();
    logoImage.setIcon(FontAwesome.PICTURE_O);
    logoImage.setWidth("80px");
    logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS);
    //logoImage.setWidth("100px");
    A1.addComponent(logoImage);
    A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER);

    Label schoolName = new Label("The School Of Future");
    schoolName.setStyleName("v-label-big");
    A1.addComponent(schoolName);
    //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER);

    Label schoolMinorName = new Label("Random Branch");
    schoolMinorName.setStyleName("v-label-small");
    A1.addComponent(schoolMinorName);

    VerticalLayout A2 = new VerticalLayout();
    A1.addComponent(A2);
    MainMenuWidget iMainMenuWidget = new MainMenuWidget();
    A2.addComponent(iMainMenuWidget);

    //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER);

    //Layout B
    ContextWidgetTop c = new ContextWidgetTop();
    c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP,
            SliderPanelStyles.COLOR_RED);
    VerticalLayout B = new VerticalLayout();
    B.setSizeFull();
    //B.setSpacing(true);
    iHorizontalLayout.addComponent(c);
    c.addComponent(B);
    iHorizontalLayout.setExpandRatio(c, 7);

    //Layout B1 and its sub Components
    HorizontalLayout B1 = new HorizontalLayout();
    B.addComponent(B1);
    //B.setExpandRatio(B1, 1);
    //B1.setHeight("70px");
    B1.setSizeFull();
    //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED);

    HorizontalLayout B11 = new HorizontalLayout();
    B1.addComponent(B11);
    B1.setStyleName("backColorBlack");
    B11.setSizeFull();
    B1.setHeight("45px");
    //B1.setStyleName("backColorWhite");
    //B1.setMargin(new MarginInfo(false, true, false, true));

    TextField iTextField = new TextField();
    iTextField.setWidth("200px");
    iTextField.setInputPrompt("Search!");
    iTextField.setStyleName("v-text-type-search");
    iTextField.focus();
    B11.addComponent(iTextField);
    B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT);

    //Layout B2 and its Sub Components
    ContextWidget B2 = new ContextWidget();
    B2.setSizeFull();
    B.addComponent(B2);
    B.setExpandRatio(B2, 10);
    B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT,
            SliderPanelStyles.COLOR_BLUE);
    //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED);
    VerticalLayout v = new VerticalLayout();
    B2.addComponent(v);

    Button b1111 = new Button(
            "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this");
    v.addComponent(b1111);
    Button b1112 = new Button("Put all the inner components like this");
    v.addComponent(b1112);

    /*
    Panel p = new Panel();
    VerticalLayout v= new VerticalLayout();
    v.addComponent(new TextField("Name"));
    v.addComponent(new TextField("Street address"));
    v.addComponent(new TextField("Postal code"));
    p.setContent(v);
    B2.addComponent(p);
    v.setWidth(String.valueOf(B2.getWidth()*10)+"px");
    //v.setSizeFull();// <- This will cause issues. Don't do this
    p.setSizeFull();
    */

    //ContextWidget iContextPanel= new ContextWidget(p);
    //B2.addComponent(iContextPanel);
    //setPosition(p, iComponentPositionPanel);

    addComponent(iHorizontalLayout);
}

From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java

License:Open Source License

private void createView() {
    LspsUI ui = (LspsUI) getUI();//from  w ww . j  a v a2  s .  com
    Person user = ui.getUser().getPerson();
    userRights = user.getRights();

    setTitle(ui.getMessage(TITLE));

    Panel panel = new Panel();
    panel.addStyleName("l-border-none");
    setContent(panel);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    panel.setContent(layout);

    //user data and settings will be laid out next to each other
    HorizontalLayout topSection = new HorizontalLayout();
    topSection.setSpacing(true);
    topSection.setWidth("100%");
    layout.addComponent(topSection);

    VerticalLayout userData = createUserDataSection(ui, user);
    topSection.addComponent(userData);
    topSection.setExpandRatio(userData, 1);

    Label spacer = new Label();
    spacer.setWidth("20px");
    topSection.addComponent(spacer);

    VerticalLayout settings = createSettingsSection(ui);
    topSection.addComponent(settings);
    topSection.setExpandRatio(settings, 1);

    //substitution section
    VerticalLayout substitution = createSubstitutionSection(ui, user);
    layout.addComponent(substitution);

    Label spacer2 = new Label();
    spacer2.setHeight("10px");
    layout.addComponent(spacer2);

    //buttons
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button saveButton = new Button(ui.getMessage("action.save"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (save()) {
                if (requestReload) {
                    JavaScript.getCurrent().execute("window.location.reload()");
                } else {
                    close();
                }
            }
        }
    });
    saveButton.setData(BUTTON_TYPE_SAVE);
    buttons.addComponent(saveButton);
    Button cancelButton = new Button(ui.getMessage("action.cancel"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    buttons.addComponent(cancelButton);
    layout.addComponent(buttons);
}

From source file:com.lst.deploymentautomation.vaadin.page.TodoListView.java

License:Open Source License

@SuppressWarnings("serial")
@Override// w  w w  . j  a v a  2  s  .  c om
protected Component createHeader(Component titleComponent) {
    LspsUI ui = (LspsUI) getUI();

    actionBtn = new MenuBar();
    actionBtn.addStyleName("menu-button-action");
    actionBtn.setVisible(false); //initially hidden
    MenuItem actions = actionBtn.addItem("", new ThemeResource("../icons/popup-menu.png"), null);

    final ViewAction refreshTodos = new ViewAction() {

        @Override
        public void invoke() {
            toggleSelectionMode(false);
            container.refresh();
        }
    };

    actions.addItem(ui.getMessage("action.lock"), new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            lock();
        }
    });
    actions.addItem(ui.getMessage("action.annotate") + "...", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            getUI().addWindow(new TodoAnnotation(getSelectedTodoIds(), refreshTodos));
        }
    });
    actions.addSeparator();
    actions.addItem(ui.getMessage("action.unlock"), new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            unlock();
        }
    });
    actions.addItem(ui.getMessage("action.reject") + "...", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            getUI().addWindow(new TodoRejection(getSelectedTodoIds(), refreshTodos));
        }
    });
    actions.addItem(ui.getMessage("action.delegate") + "...", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            getUI().addWindow(new TodoDelegation(getSelectedTodoIds(), refreshTodos));
        }
    });
    actions.addItem(ui.getMessage("action.escalate") + "...", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            getUI().addWindow(new TodoEscalation(getSelectedTodoIds(), refreshTodos));
        }
    });

    selectBtn = new Button(ui.getMessage("action.select"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            toggleSelectionMode(true);
        }
    });
    selectBtn.addStyleName("menu-button");

    cancelBtn = new Button(ui.getMessage("action.cancel"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            toggleSelectionMode(false);
        }
    });
    cancelBtn.setVisible(false); //initially hidden
    cancelBtn.addStyleName("menu-button");

    titleComponent.addStyleName("l-content-title");

    HorizontalLayout layout = new HorizontalLayout();
    HorizontalLayout btnLayout = new HorizontalLayout();
    layout.setWidth("100%");
    layout.addComponent(titleComponent);
    layout.addComponent(btnLayout);
    layout.setSpacing(true);
    btnLayout.addComponent(actionBtn);
    btnLayout.addComponent(cancelBtn);
    btnLayout.addComponent(selectBtn);
    layout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT);
    return layout;
}

From source file:com.lst.deploymentautomation.vaadin.page.TodoView.java

License:Open Source License

@SuppressWarnings("serial")
@Override//from   ww  w  . ja  va 2s .c  om
protected Component createHeader(Component titleComponent) {
    LspsUI ui = (LspsUI) getUI();

    MenuBar menu = new MenuBar();
    menu.addStyleName("menu-button-action");
    MenuItem actions = menu.addItem("", new ThemeResource("../icons/popup-menu.png"), null);

    final ViewAction closeView = new ViewAction() {

        @Override
        public void invoke() {
            close(); //maybe close only if the to-do is not allocated to the user anymore
        }
    };
    final ViewAction refreshAnnotations = new ViewAction() {

        @Override
        public void invoke() {
            Todo todo = todoService.getTodo(todoHolder.getTodo().getId());
            refreshAnnotations(todo);
        }
    };

    actions.addItem(ui.getMessage("action.info"), new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            //get fresh info
            Todo todo = todoService.getTodo(todoHolder.getTodo().getId());
            getUI().addWindow(new TodoDetails(todo));
        }
    });
    actions.addSeparator();
    actions.addItem(ui.getMessage("action.annotate") + "...", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            //get fresh info
            Todo todo = todoService.getTodo(todoHolder.getTodo().getId());
            getUI().addWindow(new TodoAnnotation(todo, refreshAnnotations));
        }
    });
    actions.addSeparator();
    actions.addItem(ui.getMessage("action.unlock"), new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            unlock();
        }
    });
    actions.addItem(ui.getMessage("action.reject") + "...", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            getUI().addWindow(new TodoRejection(todoHolder.getTodo().getId(), closeView));
        }
    });
    actions.addItem(ui.getMessage("action.delegate") + "...", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            getUI().addWindow(new TodoDelegation(todoHolder.getTodo().getId(), closeView));
        }
    });
    actions.addItem(ui.getMessage("action.escalate") + "...", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            getUI().addWindow(new TodoEscalation(todoHolder.getTodo().getId(), closeView));
        }
    });

    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth("100%");
    layout.addComponent(titleComponent);
    layout.setExpandRatio(titleComponent, 1);
    layout.addComponent(menu);
    layout.setComponentAlignment(menu, Alignment.MIDDLE_RIGHT);
    return layout;
}

From source file:com.m4gik.views.component.LibraryScreen.java

/**
 * This method builds library screen. This method overrides an existing
 * method.//from  w  ww.j ava2 s. c  o  m
 * 
 * @see com.m4gik.views.component.ViewScreen#build()
 */
@Override
public Layout build() {
    HorizontalLayout root = new HorizontalLayout();
    root.setSizeFull();
    root.setCaption("Media Library");
    root.setHeight("200%");
    root.setWidth("100%");

    this.content = new VerticalLayout();
    content.setSizeFull();
    root.addComponent(content);

    final GridLayout grid = new GridLayout(4, 1);
    Panel top = new Panel("Music Collection", grid);
    top.setSizeFull();
    top.addStyleName(Runo.PANEL_LIGHT);
    grid.setWidth("100%");
    grid.setMargin(true);
    grid.addStyleName(Runo.LAYOUT_DARKER);
    content.addComponent(top);
    content.setExpandRatio(top, 1);

    grid.addLayoutClickListener(new LayoutClickListener() {

        private static final long serialVersionUID = -1864555729437118182L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            for (Iterator<Component> it = grid.iterator(); it.hasNext();) {
                Component c = it.next();
                c.removeStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED);

            }

            if (event.getChildComponent() != null) {
                event.getChildComponent().addStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED);
            }
        }
    });

    buildAudioLibrary(grid, null);

    return root;

}