Java Code Examples for com.vaadin.ui.HorizontalLayout.addStyleName()

The following are Jave code examples for showing how to use addStyleName() of the com.vaadin.ui.HorizontalLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: holon-vaadin7   File: AbstractDialog.java   Source Code and License Vote up 5 votes
/**
 * Constructor
 */
public AbstractDialog() {
	super();

	// defaults
	setModal(true);
	setResizable(false);
	setDraggable(false);
	setClosable(false);

	// style name
	addStyleName("h-dialog");

	// build
	content = new Panel();
	content.setWidth("100%");
	content.addStyleName(ValoTheme.PANEL_BORDERLESS);
	content.addStyleName("h-dialog-content");

	actions = new HorizontalLayout();
	actions.setWidth("100%");
	actions.setSpacing(true);
	actions.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
	actions.addStyleName("h-dialog-actions");

	root = new VerticalLayout();
	root.addComponent(content);
	root.addComponent(actions);

	setContent(root);
}
 
Example 2
Project: osc-core   File: ViewUtil.java   Source Code and License Vote up 5 votes
/**
 * @param caption
 *            Caption Text Representing Header
 * @param guid
 *            Help GUID for caller view
 * @return
 *         Horizontal Layout containing Caption text and Help button
 */
public static HorizontalLayout createSubHeader(String caption, String guid) {

    HorizontalLayout subHeader = new HorizontalLayout();
    subHeader.setWidth("100%");
    subHeader.setHeight("35px");
    subHeader.setSpacing(true);
    subHeader.addStyleName("toolbar");
    final Label title = new Label(caption);
    title.setSizeUndefined();
    subHeader.addComponent(title);
    subHeader.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    subHeader.setExpandRatio(title, 1);

    // create help button if we have some GUID else do not add this button
    if (guid != null) {

        Button helpButton = new Button();
        helpButton.setImmediate(true);
        helpButton.setStyleName(Reindeer.BUTTON_LINK);
        helpButton.setDescription("Help");
        helpButton.setIcon(new ThemeResource("img/Help.png"));
        subHeader.addComponent(helpButton);
        helpButton.addClickListener(new HelpButtonListener(guid));
    }

    return subHeader;
}
 
Example 3
Project: md-stepper   File: VerticalStepper.java   Source Code and License Vote up 5 votes
private RowLayout(Step step) {
  this.step = step;

  label = getLabelProvider().getStepLabel(step);

  divider = new CssLayout();
  divider.addStyleName(STYLE_DIVIDER);
  divider.setHeight(100, Unit.PERCENTAGE);

  contentContainer = new Panel();
  contentContainer.addStyleName(STYLE_CONTENT_CONTAINER);
  contentContainer.addStyleName(ValoTheme.PANEL_BORDERLESS);
  contentContainer.setSizeFull();

  buttonBar = new HorizontalLayout();
  buttonBar.addStyleName(STYLE_BUTTON_BAR);
  buttonBar.setMargin(false);
  buttonBar.setSpacing(true);
  buttonBar.setWidth(100, Unit.PERCENTAGE);
  buttonBar.setMargin(new MarginInfo(false, false, !isLastStep(step), false));

  rootLayout = new GridLayout(2, 3);
  rootLayout.setSizeFull();
  rootLayout.setMargin(false);
  rootLayout.setSpacing(false);
  rootLayout.setColumnExpandRatio(1, 1);
  rootLayout.setRowExpandRatio(1, 1);
  rootLayout.addComponent(label, 0, 0, 1, 0);
  rootLayout.addComponent(divider, 0, 1, 0, 2);
  rootLayout.addComponent(contentContainer, 1, 1, 1, 1);
  rootLayout.addComponent(buttonBar, 1, 2, 1, 2);

  setCompositionRoot(rootLayout);
  addStyleName(STYLE_COMPONENT);
  setWidth(100, Unit.PERCENTAGE);
  setActive(false);
}
 
Example 4
Project: holon-vaadin   File: AbstractDialog.java   Source Code and License Vote up 5 votes
/**
 * Constructor
 */
public AbstractDialog() {
	super();

	// defaults
	setModal(true);
	setResizable(false);
	setDraggable(false);
	setClosable(false);

	// style name
	addStyleName("h-dialog");

	// build
	content = new Panel();
	content.setWidth("100%");
	content.addStyleName(ValoTheme.PANEL_BORDERLESS);
	content.addStyleName("h-dialog-content");

	actions = new HorizontalLayout();
	actions.setWidth("100%");
	actions.setSpacing(true);
	actions.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
	actions.addStyleName("h-dialog-actions");

	root = new VerticalLayout();
	root.addComponent(content);
	root.addComponent(actions);

	setContent(root);
}
 
Example 5
Project: osc-core   File: MainUI.java   Source Code and License Vote up 4 votes
private void buildHeader() {
    this.header.addStyleName("branding");
    this.header.addStyleName("header");

    // product name and information
    Label product = new Label(this.server.getProductName() + "<br> <span class='product-version'> Version: "
            + this.server.getVersionStr() + "</span>", ContentMode.HTML);
    product.addStyleName("product-label");
    product.setSizeUndefined();

    HorizontalLayout brandingLayout = new HorizontalLayout();
    brandingLayout.addStyleName("header-content");
    brandingLayout.addComponent(new Image(null, new ThemeResource("img/logo.png")));
    brandingLayout.addComponent(product);

    // creating home help button
    Button mainHelpButton = new Button();
    mainHelpButton.setImmediate(true);
    mainHelpButton.setStyleName(Reindeer.BUTTON_LINK);
    mainHelpButton.setDescription("Help");
    mainHelpButton.setIcon(new ThemeResource("img/headerHelp.png"));
    mainHelpButton.addClickListener(new ClickListener() {

        private String guid = "";

        @Override
        public void buttonClick(ClickEvent event) {
            ViewUtil.showHelpBrowserWindow(this.guid);
        }

    });

    HorizontalLayout helpLayout = new HorizontalLayout();
    helpLayout.addComponent(mainHelpButton);
    helpLayout.addStyleName("homeHelpButton");

    // Adding current user to header
    Label user = new Label("User: " + getCurrent().getSession().getAttribute("user").toString());
    // header banner
    HorizontalLayout userlayout = new HorizontalLayout();
    userlayout.addStyleName("user");
    userlayout.addComponent(user);
    // create Logout button next to user
    userlayout.addComponent(buildLogout());
    // Adding help button to the user layout next to logout button
    userlayout.addComponent(helpLayout);

    this.header.setWidth("100%");
    this.header.setHeight("65px");
    this.header.addComponent(brandingLayout);
    this.header.addComponent(userlayout);
    this.header.setExpandRatio(brandingLayout, 1);
    this.root.addComponent(this.header);
}
 
Example 6
Project: osc-core   File: JobsArchiverPanel.java   Source Code and License Vote up 4 votes
public JobsArchiverPanel(ArchiveLayout parentLayout, ArchiveServiceApi archiveService,
        GetJobsArchiveServiceApi getJobsArchiveService, UpdateJobsArchiveServiceApi updateJobsArchiveService) {
    super();
    this.parentLayout = parentLayout;
    this.archiveService = archiveService;
    this.getJobsArchiveService = getJobsArchiveService;
    this.updateJobsArchiveService = updateJobsArchiveService;

    try {
        this.dto = populateJobsArchiveDto().getDto();

        // create frequency layout component
        VerticalLayout freqLayout = new VerticalLayout();
        freqLayout.addComponent(createLastTriggerLabel());
        freqLayout.addComponent(createAutoSchedCheckBox());
        freqLayout.addComponent(createFrequencyOptionGroup());
        freqLayout.addStyleName(StyleConstants.COMPONENT_SPACING);
        freqLayout.setSpacing(true);

        // create triggering panel component
        Panel triggerPanel = new Panel();
        triggerPanel.setWidth("50%");
        triggerPanel.setContent(freqLayout);

        // create threshold layout component
        HorizontalLayout thresLayout = new HorizontalLayout();
        thresLayout.addComponent(this.thresholdLabel);
        thresLayout.addComponent(createArchiveThreshold());
        thresLayout.addComponent(createThresholdOptionGroup());
        thresLayout.addStyleName(StyleConstants.COMPONENT_SPACING);
        thresLayout.setSpacing(true);

        // add all components to container
        this.container = new VerticalLayout();
        this.container.addStyleName(StyleConstants.COMPONENT_SPACING);
        this.container.addComponent(this.triggerLabel);
        this.container.addComponent(triggerPanel);
        this.container.addComponent(thresLayout);

        // add buttons component to container
        HorizontalLayout buttonLayout = new HorizontalLayout();
        buttonLayout.addComponent(createOnDemandScheduleButton());
        buttonLayout.addComponent(createUpdateScheduleButton());
        buttonLayout.setSpacing(true);
        this.container.addComponent(buttonLayout);

        // add container to root panel
        this.container.setSpacing(true);
        this.panel.setWidth("100%");
        this.panel.setContent(this.container);
        setCompositionRoot(this.panel);

    } catch (Exception ex) {
        log.error("Failed to init archiver panel", ex);
    }
}
 
Example 7
Project: osc-core   File: NetworkLayout.java   Source Code and License Vote up 4 votes
public NetworkLayout(GetNetworkSettingsServiceApi getNetworkSettingsService,
        CheckNetworkSettingsServiceApi checkNetworkSettingsService,
        SetNetworkSettingsServiceApi setNetworkSettingsService,
        GetNATSettingsServiceApi getNATSettingsService,
        SetNATSettingsServiceApi setNATSettingsService,
        ValidationApi validator, ServerApi server) {
    super();
    this.getNetworkSettingsService = getNetworkSettingsService;
    this.checkNetworkSettingsService = checkNetworkSettingsService;
    this.setNetworkSettingsService = setNetworkSettingsService;
    this.getNATSettingsService = getNATSettingsService;
    this.setNATSettingsService = setNATSettingsService;
    this.server = server;
    try {

        // creating layout to hold option group and edit button
        HorizontalLayout optionLayout = new HorizontalLayout();
        optionLayout.addComponent(createIPSettingsEditButton());
        optionLayout.addComponent(createOptionGroup());
        optionLayout.addStyleName(StyleConstants.COMPONENT_SPACING_TOP_BOTTOM);

        Panel networkPanel = new Panel("IP Details");
        VerticalLayout networkLayout = new VerticalLayout();
        networkLayout.addComponent(optionLayout);
        this.networkTable = createNetworkTable();
        networkLayout.addComponent(this.networkTable);
        networkPanel.setContent(networkLayout);

        Panel natPanel = new Panel("NAT Details");
        VerticalLayout natLayout = new VerticalLayout();
        HorizontalLayout editNatLayout = new HorizontalLayout();
        editNatLayout.addStyleName(StyleConstants.COMPONENT_SPACING_TOP_BOTTOM);
        editNatLayout.addComponent(createNATEditButton());
        natLayout.addComponent(editNatLayout);

        this.natTable = createNATTable();
        natLayout.addComponent(this.natTable);
        natLayout.addStyleName(StyleConstants.COMPONENT_SPACING_TOP_BOTTOM);
        natPanel.setContent(natLayout);

        // populating Network Information in the Table
        populateNetworkTable();

        // populating NAT information in the Table
        populateNATTable();

        addComponent(networkPanel);
        addComponent(natPanel);

    } catch (Exception ex) {
        log.error("Failed to get network settings", ex);
    }
}