Java 类com.vaadin.ui.HorizontalLayout 实例源码

项目:esup-ecandidat    文件:I18nField.java   
/**
 * Constructeur, initialisation du champs
 * @param listeLangueEnService 
 * @param langueParDefaut 
 * @param libelleBtnPlus 
 */
public I18nField(Langue langueParDefaut, List<Langue> listeLangueEnService, String libelleBtnPlus) {
    super();
    setRequired(false);         
    this.langueParDefaut = langueParDefaut;
    this.listeLangueEnService = listeLangueEnService;

    listLayoutTraductions = new ArrayList<HorizontalLayout>();
    listeTraduction = new ArrayList<I18nTraduction>();
    layoutComplet = new VerticalLayout();
    layoutComplet.setSpacing(true);
    layoutLangue = new VerticalLayout();
    layoutLangue.setSpacing(true);
    layoutComplet.addComponent(layoutLangue);

    btnAddLangue = new OneClickButton(libelleBtnPlus,FontAwesome.PLUS_SQUARE_O);
    btnAddLangue.setVisible(false);
    btnAddLangue.addStyleName(ValoTheme.BUTTON_TINY);
    layoutComplet.addComponent(btnAddLangue);
    btnAddLangue.addClickListener(e->{
        layoutLangue.addComponent(getLangueLayout(null));
        checkVisibleAddLangue();
        centerWindow();
    });     
}
项目:obog-manager    文件:LogoutConfirmView.java   
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    addComponent(new HeadingLabel("ログアウト確認", VaadinIcons.INFO_CIRCLE));
    addComponent(new Label("ログアウトします。"));

    HorizontalLayout buttonArea = new HorizontalLayout();
    buttonArea.setSpacing(true);
    addComponent(buttonArea);
    setComponentAlignment(buttonArea, Alignment.MIDDLE_CENTER);

    Button cancelButton = new Button("キャンセル", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME));
    buttonArea.addComponent(cancelButton);

    Button logoutButton = new Button("ログアウト", click -> {
        membershipService.logout();
        getUI().getNavigator().navigateTo(FrontView.VIEW_NAME);
    });
    logoutButton.setIcon(VaadinIcons.SIGN_OUT);
    logoutButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    buttonArea.addComponent(logoutButton);
}
项目:crawling-framework    文件:BaseView.java   
public BaseView(String title) {
    UI.getCurrent().getPage().setTitle(String.format("Analysis | %s", title));
    setWidth(100, PERCENTAGE);
    setSpacing(true);
    setMargin(true);

    HorizontalLayout actionBarLayout = new HorizontalLayout();
    actionBarLayout.setWidth(100, PERCENTAGE);

    MenuBar menu = new MenuBar();

    menu.addItem("Search", (item) -> UI.getCurrent().setContent(new SearchView()));
    menu.addItem("Context Cloud", (item) -> UI.getCurrent().setContent(new ContextCloudView()));

    actionBarLayout.addComponent(menu);

    addComponent(actionBarLayout);
}
项目:crawling-framework    文件:BaseView.java   
public BaseView(String title) {
    UI.getCurrent().getPage().setTitle(String.format("Crawler Admin | %s", title));
    setWidth(100, PERCENTAGE);
    setSpacing(true);
    setMargin(true);

    HorizontalLayout actionBarLayout = new HorizontalLayout();
    actionBarLayout.setWidth(100, PERCENTAGE);

    MenuBar menu = new MenuBar();

    MenuBar.MenuItem dataItem = menu.addItem("Configuration", null);
    dataItem.addItem("HTTP Sources", (item) -> UI.getCurrent().setContent(new HttpSourcesView()));
    dataItem.addItem("HTTP Source Tests", (item) -> UI.getCurrent().setContent(new HttpSourceTestsView()));
    dataItem.addItem("Named Queries", (item) -> UI.getCurrent().setContent(new NamedQueriesView()));
    dataItem.addItem("Import / Export", (item) -> UI.getCurrent().setContent(new ImportExportView()));

    menu.addItem("Page Analysis", (item) -> UI.getCurrent().setContent(new PageAnalysisView()));

    actionBarLayout.addComponent(menu);

    addComponent(actionBarLayout);
}
项目:holon-vaadin7    文件:QuestionDialog.java   
@Override
protected void buildActions(HorizontalLayout actionsContainer) {
    actionsContainer.setSpacing(true);
    // yes
    final Button btnYes = Components.button().styleName(ValoTheme.BUTTON_PRIMARY)
            .caption(Localizable.builder().message(DEFAULT_YES_BUTTON_MESSAGE)
                    .messageCode(DEFAULT_YES_BUTTON_MESSAGE_CODE).build())
            .onClick(e -> onDialogYesButtonClick(e.getButton())).build();
    getYesButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnYes)));
    actionsContainer.addComponent(btnYes);
    actionsContainer.setComponentAlignment(btnYes, Alignment.MIDDLE_LEFT);
    if (getWidth() > -1) {
        btnYes.setWidth("100%");
    }
    // no
    final Button btnNo = Components.button()
            .caption(Localizable.builder().message(DEFAULT_NO_BUTTON_MESSAGE)
                    .messageCode(DEFAULT_NO_BUTTON_MESSAGE_CODE).build())
            .onClick(e -> onDialogNoButtonClick(e.getButton())).build();
    getNoButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnNo)));
    actionsContainer.addComponent(btnNo);
    actionsContainer.setComponentAlignment(btnNo, Alignment.MIDDLE_RIGHT);
    if (getWidth() > -1) {
        btnNo.setWidth("100%");
    }
}
项目:esup-ecandidat    文件:CandidatCreerCompteView.java   
/**
 * Rafraichi le panel de connexion sans compte
 */
private void refreshConnexionPanelStudent() {
    vlConnexionIsStudent.removeAllComponents();

    OneClickButton logBtn = new OneClickButton(
            applicationContext.getMessage("btnConnect", null, UI.getCurrent().getLocale()), FontAwesome.SIGN_OUT);
    logBtn.addClickListener(e -> {
        userController.connectCAS();
    });

    HorizontalLayout hlConnect = new HorizontalLayout();
    hlConnect.setSpacing(true);
    Label labelConnect = new Label(
            applicationContext.getMessage("accueilView.connect.cas", null, UI.getCurrent().getLocale()));
    hlConnect.addComponent(labelConnect);
    hlConnect.setComponentAlignment(labelConnect, Alignment.MIDDLE_LEFT);
    hlConnect.addComponent(logBtn);
    hlConnect.setComponentAlignment(logBtn, Alignment.MIDDLE_CENTER);

    vlConnexionIsStudent.addComponent(hlConnect);
}
项目:esup-ecandidat    文件:ScolMailWindow.java   
private void getVarLayout(String title, List<String> liste, HorizontalLayout hlContent){
    if (liste==null || liste.size()==0){
        return;
    }

    VerticalLayout vl = new VerticalLayout();
    if (title!=null){
        Label labelTitle = new Label(title);
        vl.addComponent(labelTitle);
        vl.setComponentAlignment(labelTitle, Alignment.MIDDLE_CENTER);
    }

    StringBuilder txt = new StringBuilder("<ul>");
    liste.forEach(e->txt.append("<li><input type='text' value='${"+e+"}'></li>"));
    txt.append("</ul>");
    Label labelSearch = new Label(txt.toString(),ContentMode.HTML);

    vl.addComponent(labelSearch);
    hlContent.addComponent(vl);
}
项目:esup-ecandidat    文件:CtrCandFormationView.java   
/**
 * @param txtCode
 * @return une ligne de légende
 */
private HorizontalLayout getLegendLineLayout(String txtCode) {
    HorizontalLayout hlLineLegend = new HorizontalLayout();
    hlLineLegend.setWidth(100, Unit.PERCENTAGE);
    hlLineLegend.setSpacing(true);

    Image flagImg = new Image(null, new ThemeResource("images/icon/Flag-" + txtCode + "-icon.png"));
    Label label = new Label(applicationContext.getMessage("formation.table.flagEtat.tooltip." + txtCode, null,
            UI.getCurrent().getLocale()));
    hlLineLegend.addComponent(flagImg);
    hlLineLegend.setComponentAlignment(flagImg, Alignment.MIDDLE_LEFT);
    hlLineLegend.addComponent(label);
    hlLineLegend.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
    hlLineLegend.setExpandRatio(label, 1);
    return hlLineLegend;
}
项目:esup-ecandidat    文件:SearchAnneeUnivApoField.java   
/**
 * Constructeur, initialisation du champs
 * @param libelleBtnFind 
 */
public SearchAnneeUnivApoField(String libelleBtnFind) {
    super();
    layout = new HorizontalLayout();
    layout.setSpacing(true);
    anneeField = new TextField();
    anneeField.addValueChangeListener(e->showOrHideError());
    anneeField.setNullRepresentation("");
    anneeField.setReadOnly(true);
    btnSearch = new OneClickButton(libelleBtnFind,FontAwesome.SEARCH);
    btnSearch.addClickListener(e->{
        SearchAnneeUnivApoWindow window = new SearchAnneeUnivApoWindow();
        window.addAnneeUniListener(a->changeFieldValue(a));
        UI.getCurrent().addWindow(window);
    });
    layout.addComponent(anneeField);
    layout.addComponent(btnSearch);
}
项目:esup-ecandidat    文件:I18nField.java   
/** Colore les champs en rouge si erreur
 * @param validate
 */
@SuppressWarnings("unchecked")
private void validateFields(Boolean validate){
    listLayoutTraductions.forEach(e -> {        
        AbstractField<String> tf;           
        if (e.getComponent(0) instanceof TextField || e.getComponent(0) instanceof RichTextArea){
            tf = (AbstractField<String>) e.getComponent(0);             
        }else if (e.getComponent(0) instanceof HorizontalLayout){               
            tf = (AbstractField<String>) e.getComponent(1);
        }else{
            tf = (AbstractField<String>) e.getComponent(1);
        }
        /* Ajout du style*/
        if (validate){
            tf.removeStyleName(StyleConstants.FIELD_ERROR_COMPLETE);
        }else{
            tf.addStyleName(StyleConstants.FIELD_ERROR_COMPLETE);
        }
    });
}
项目:osc-core    文件:EmailLayout.java   
public EmailLayout(GetEmailSettingsServiceApi getEmailSettingsService, SetEmailSettingsServiceApi setEmailSettingsService) {
    super();
    this.getEmailSettingsService = getEmailSettingsService;
    this.setEmailSettingsService = setEmailSettingsService;
    try {

        this.emailTable = createTable();

        // creating layout to hold edit button
        HorizontalLayout optionLayout = new HorizontalLayout();
        optionLayout.addComponent(createEditButton());

        // populating Email Settings in the Table
        populateEmailtable();

        // adding all components to Container
        this.container = new VerticalLayout();
        this.container.addComponent(optionLayout);
        this.container.addComponent(this.emailTable);

        // adding container to the root Layout
        addComponent(this.container);
    } catch (Exception ex) {
        log.error("Failed to get email settings", ex);
    }
}
项目:osc-core    文件:SummaryLayout.java   
public SummaryLayout(ServerApi server, BackupServiceApi backupService,
        ArchiveApi archiver) {
    super();
    this.server = server;
    this.backupService = backupService;
    this.archiver = archiver;
    this.summarytable = createTable();
    // creating Server table
    this.summarytable.addItem(new Object[] { "DNS Name: ", getHostName() }, new Integer(1));
    this.summarytable.addItem(new Object[] { "IP Address: ", getIpAddress() }, new Integer(2));
    this.summarytable.addItem(new Object[] { "Version: ", getVersion() }, new Integer(3));
    this.summarytable.addItem(new Object[] { "Uptime: ", server.uptimeToString() }, new Integer(4));
    this.summarytable.addItem(new Object[] { "Current Server Time: ", new Date().toString() }, new Integer(5));

    VerticalLayout tableContainer = new VerticalLayout();
    tableContainer.addComponent(this.summarytable);
    addComponent(tableContainer);
    addComponent(createCheckBox());

    HorizontalLayout actionContainer = new HorizontalLayout();
    actionContainer.addComponent(createDownloadButton());
    addComponent(actionContainer);
}
项目:osc-core    文件:ViewUtil.java   
/**
 * @param toolbar
 *            HorizontalLayout which contains all the action Buttons
 * @param toolbarButton
 *            Which Tool bar button to create (Provided using ENUM constant)
 * @param listner
 *            Click listener called when this button is clicked
 * @return
 */

public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
        ClickListener listner) {
    Button button = new Button(toolbarButton.getText());
    button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    button.setDescription(toolbarButton.getTooltip());
    button.setStyleName(ValoTheme.BUTTON_LINK);
    if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
        button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
    }
    button.setEnabled(false);
    button.setId(toolbarButton.getId());
    button.addClickListener(listner);
    toolbar.addComponent(button);
    return button;
}
项目:osc-core    文件:CRUDBaseSubView.java   
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title) {
    HorizontalLayout header = ViewUtil.createSubHeader(title, getSubViewHelpGuid());
    Button refresh = new Button();
    refresh.setStyleName(Reindeer.BUTTON_LINK);
    refresh.setDescription("Refresh");
    refresh.setIcon(new ThemeResource("img/Refresh.png"));
    refresh.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            populateTable();
        }
    });
    header.addComponent(refresh);
    return header;
}
项目:holon-vaadin7    文件:AbstractDialog.java   
/**
 * 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);
}
项目:holon-vaadin7    文件:DefaultDialog.java   
@Override
protected void buildActions(HorizontalLayout actionsContainer) {
    Button btn = Components.button().styleName(ValoTheme.BUTTON_PRIMARY)
            .fullWidth().caption(Localizable.builder().message(DEFAULT_BUTTON_MESSAGE)
                    .messageCode(DEFAULT_BUTTON_MESSAGE_CODE).build())
            .onClick(e -> onDialogButtonClick(e.getButton())).build();
    // configurator
    getOkButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btn)));
    actionsContainer.addComponent(btn);
}
项目:holon-vaadin    文件:DefaultDialog.java   
@Override
protected void buildActions(HorizontalLayout actionsContainer) {
    Button btn = Components.button().styleName(ValoTheme.BUTTON_PRIMARY)
            .fullWidth().caption(Localizable.builder().message(DEFAULT_BUTTON_MESSAGE)
                    .messageCode(DEFAULT_BUTTON_MESSAGE_CODE).build())
            .onClick(e -> onDialogButtonClick(e.getButton())).build();
    // configurator
    getOkButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btn)));
    actionsContainer.addComponent(btn);
}
项目:spring-boot-vaadin-rabbitmq-pipeline-demo    文件:DemoView.java   
private void addDataGrid() {

        Grid<app.Event> grid = dataGrid.get();
        grid.setWidth("100%");

        HorizontalLayout bottomLayout = new HorizontalLayout();
        bottomLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
        bottomLayout.addComponent(grid);
        bottomLayout.setWidth("100%");

        addComponent(bottomLayout);
    }
项目:spring-boot-vaadin-rabbitmq-pipeline-demo    文件:StreamView.java   
private void addDataGrid() {

        grid = streamDataGrid.get();
        grid.setWidth("100%");

        HorizontalLayout bottomLayout = new HorizontalLayout();
        bottomLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
        bottomLayout.addComponent(grid);
        bottomLayout.setWidth("100%");

        addComponent(bottomLayout);
    }
项目:esup-ecandidat    文件:CandidatureWindow.java   
/**
 * @param btn
 * @return le layout de bouton conditionnel
 */
private HorizontalLayout getLayoutBtnConditionnel(final OneClickButton btn) {
    btn.addStyleName(ValoTheme.BUTTON_TINY);
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(btn);
    layout.setComponentAlignment(btn, Alignment.MIDDLE_CENTER);
    return layout;
}
项目:esup-ecandidat    文件:RequiredColorPickerField.java   
/**
 * Constructeur, initialisation du champs
 */
public RequiredColorPickerField(String caption) {
    super();
    layout = new HorizontalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setSpacing(true);
    colorTextField = new TextField();
    colorTextField.addValueChangeListener(e->showOrHideError());
    colorTextField.setNullRepresentation("");
    colorTextField.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
    colorTextField.setReadOnly(true);

    btnColor = new ColorPicker("Couleur de l'alerte");
    btnColor.addColorChangeListener(e->{
        changeFieldValue(e.getColor().getCSS());
    });
    btnColor.setPosition(Page.getCurrent().getBrowserWindowWidth() / 2 - 246/2,
               Page.getCurrent().getBrowserWindowHeight() / 2 - 507/2);
    btnColor.setSwatchesVisibility(true);
    btnColor.setHistoryVisibility(false);
    btnColor.setTextfieldVisibility(true);
    btnColor.setHSVVisibility(false);
    layout.addComponent(btnColor);
    layout.addComponent(colorTextField);
    layout.setExpandRatio(colorTextField, 1);

}
项目:esup-ecandidat    文件:LocalDateTimeField.java   
public LocalDateTimeField() {
    dateField = new DateField();
    dateField.addValueChangeListener(e->showOrHideErrorDateField());
    hourNs = new NativeSelect();
    hourNs.addValueChangeListener(e->fireValueChange(false));
    minuteNs = new NativeSelect();
    minuteNs.addValueChangeListener(e->fireValueChange(false));
    hlContent = new HorizontalLayout();
    //hlContent.setSizeFull();
    hlContent.setSpacing(true);

    dateField.setImmediate(true);
    hlContent.addComponent(dateField);

    for (Integer i = 0; i<24; i++){
        hourNs.addItem(i);
        hourNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i));
    }
    hourNs.setNullSelectionAllowed(false);
    hourNs.setImmediate(true);
    hourNs.setValue(0);
    for (Integer i = 0; i<60; i++){
        minuteNs.addItem(i);
        minuteNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i));
    }
    minuteNs.setNullSelectionAllowed(false);
    minuteNs.setImmediate(true);
    minuteNs.setValue(0);
    hlContent.addComponent(hourNs);
    hlContent.setComponentAlignment(hourNs, Alignment.MIDDLE_LEFT);
    Label label1 = new Label(":");
    hlContent.addComponent(label1);
    hlContent.setComponentAlignment(label1, Alignment.MIDDLE_LEFT);
    hlContent.addComponent(minuteNs);
    hlContent.setComponentAlignment(minuteNs, Alignment.MIDDLE_LEFT);
    Label label2 = new Label("(HH:MM)");
    hlContent.addComponent(label2);
    hlContent.setComponentAlignment(label2, Alignment.MIDDLE_LEFT);
}
项目:esup-ecandidat    文件:LocalTimeField.java   
public LocalTimeField() {
    hourNs = new NativeSelect();
    minuteNs = new NativeSelect();
    hlContent = new HorizontalLayout();
    //hlContent.setSizeFull();
    hlContent.setSpacing(true);
    for (Integer i = 0; i<24; i++){
        hourNs.addItem(i);
        hourNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i));
    }
    hourNs.setNullSelectionAllowed(false);
    hourNs.setImmediate(true);
    for (Integer i = 0; i<60; i++){
        minuteNs.addItem(i);
        minuteNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i));
    }
    minuteNs.setNullSelectionAllowed(false);
    minuteNs.setImmediate(true);
    hlContent.addComponent(hourNs);
    hlContent.setComponentAlignment(hourNs, Alignment.MIDDLE_LEFT);
    Label label1 = new Label(":");
    hlContent.addComponent(label1);
    hlContent.setComponentAlignment(label1, Alignment.MIDDLE_LEFT);
    hlContent.addComponent(minuteNs);
    hlContent.setComponentAlignment(minuteNs, Alignment.MIDDLE_LEFT);
    Label label2 = new Label("(HH:MM)");
    hlContent.addComponent(label2);
    hlContent.setComponentAlignment(label2, Alignment.MIDDLE_LEFT);
}
项目:esup-ecandidat    文件:I18nField.java   
/** Renvoie un layout contenant un choix de langue et une traduction
 * @param traductionOther
 * @return le layout
 */
private HorizontalLayout getLangueLayout(I18nTraduction traductionOther){
    /*Le layout renvoyé*/
    HorizontalLayout hlLangueOther = new HorizontalLayout();
    listLayoutTraductions.add(hlLangueOther);
    hlLangueOther.setSpacing(true);
    hlLangueOther.setWidth(100, Unit.PERCENTAGE);

    /*La combobox avec les icones de drapeaux*/
    ComboBoxLangue cbLangue = new ComboBoxLangue(listeLangueEnService,false);
    cbLangue.selectLangue((traductionOther==null?null:traductionOther.getLangue()));
    cbLangue.setWidth(75, Unit.PIXELS);
    hlLangueOther.addComponent(cbLangue);

    /*Le textField... ou */
    AbstractField<String> tfValOther = getNewValueComponent();      
    tfValOther.setWidth(100, Unit.PERCENTAGE);
    if (traductionOther!=null){
        tfValOther.setValue(traductionOther.getValTrad());
    }       
    hlLangueOther.addComponent(tfValOther);
    hlLangueOther.setExpandRatio(tfValOther,1);

    /*Le bouton de suppression de la langue*/
    OneClickButton removeLangue = new OneClickButton(FontAwesome.MINUS_SQUARE_O);
    removeLangue.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    removeLangue.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    removeLangue.addClickListener(e->{layoutLangue.removeComponent(hlLangueOther);listLayoutTraductions.remove(hlLangueOther);checkVisibleAddLangue();centerWindow();});
    hlLangueOther.addComponent(removeLangue);
    return hlLangueOther;
}
项目:osc-core    文件:CRUDBaseView.java   
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title, final boolean isChildTable) {

    HorizontalLayout header = null;
    if (isChildTable) {
        header = ViewUtil.createSubHeader(title, getChildHelpGuid());
    } else {
        header = ViewUtil.createSubHeader(title, getParentHelpGuid());
    }

    Button refresh = new Button();
    refresh.setStyleName(Reindeer.BUTTON_LINK);
    refresh.setDescription("Refresh");
    refresh.setIcon(new ThemeResource("img/Refresh.png"));
    refresh.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (isChildTable) {
                populateChildTable(getParentItem());
            } else {
                populateParentTable();
            }
        }
    });
    header.addComponent(refresh);
    return header;
}
项目:osc-core    文件:CRUDBaseView.java   
private HorizontalLayout createParentToolbar(List<ToolbarButtons> parentCRUDButtons) {

        this.parentToolbar = new HorizontalLayout();
        this.parentToolbar.addStyleName("buttonToolbar");
        this.parentToolbar.setWidth("100%");
        Label filler = new Label();

        for (ToolbarButtons button : parentCRUDButtons) {
            if (button == null) {
                continue;
            }
            if (button.getAlignment() == HorizontalAlignment.RIGHT
                    && this.parentToolbar.getComponentIndex(filler) == -1) {
                this.parentToolbar.addComponent(filler);
                this.parentToolbar.setExpandRatio(filler, 1.0f);
            }
            Button buttonComponent = ViewUtil.buildToolbarButton(this.parentToolbar, button, this.buttonClickListener);
            if (button == ToolbarButtons.ADD || button == ToolbarButtons.SHOW_PENDING_ACKNOWLEDGE_ALERTS
                    || button == ToolbarButtons.SHOW_ALL_ALERTS) {
                buttonComponent.setEnabled(true);
            }
            // TODO: Future. Later use the following code to support Parent Table drill down
        }
        if (this.parentToolbar.getComponentIndex(filler) == -1) {
            this.parentToolbar.addComponent(filler);
            this.parentToolbar.setExpandRatio(filler, 1.0f);
        }

        return this.parentToolbar;
    }
项目:osc-core    文件:CRUDBaseView.java   
private HorizontalLayout createChildToolBar(List<ToolbarButtons> buttonList) {
    this.childToolbar = new HorizontalLayout();
    this.childToolbar.addStyleName("buttonToolbar");

    for (ToolbarButtons button : buttonList) {
        if (button == null) {
            continue;
        }
        ViewUtil.buildToolbarButton(this.childToolbar, button, this.buttonClickListener);
    }

    return this.childToolbar;
}
项目:osc-core    文件:SslConfigurationLayout.java   
private HorizontalLayout createHeaderForSslList() {
    HorizontalLayout header = ViewUtil.createSubHeader("List of available certificates", null);

    Button refresh = new Button();
    refresh.setStyleName(Reindeer.BUTTON_LINK);
    refresh.setDescription("Refresh");
    refresh.setIcon(new ThemeResource("img/Refresh.png"));
    refresh.addClickListener((Button.ClickListener) event -> buildSslConfigurationTable());
    header.addComponent(refresh);
    return header;
}
项目:osc-core    文件:ViewUtil.java   
/**
 * @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;
}
项目:osc-core    文件:ViewUtil.java   
/**
 * @param enabled
 *            either enable or disable all the buttons in the gived Layout
 * @param layout
 *            Layout these buttons belongs to
 * @param ignoreList
 *            Buttons who does not need this state change i.e. Add button
 */
public static void setButtonsEnabled(boolean enabled, HorizontalLayout layout, List<String> ignoreList) {
    if (layout != null) {
        Iterator<Component> iterate = layout.iterator();
        while (iterate.hasNext()) {
            Component c = iterate.next();
            if (c instanceof Button && !ignoreList.contains(c.getId())) {
                c.setEnabled(enabled);
            }
        }
    }
}
项目:osc-core    文件:ViewUtil.java   
/**
 *
 * @param enabled
 *            either enable or disable given set of buttons
 * @param layout
 *            Layout these buttons belongs to
 * @param itemsToEnable
 *            List of Buttons which needs to be enabled/disabled
 */
public static void enableToolBarButtons(boolean enabled, HorizontalLayout layout, List<String> itemsToEnable) {
    if (layout != null) {
        Iterator<Component> iterate = layout.iterator();
        while (iterate.hasNext()) {
            Component c = iterate.next();
            if (c instanceof Button && itemsToEnable.contains(c.getId())) {
                c.setEnabled(enabled);
            }
        }
    }
}
项目:osc-core    文件:ViewUtil.java   
/**
 *
 *
 *
 * @param layout
 *            Parent layout of the button
 * @param id
 *            String id of the button
 * @return
 *         Returns a Button Object from the ID provided
 */
public static Button getButtonById(HorizontalLayout layout, String id) {
    if (layout != null) {
        Iterator<Component> iterate = layout.iterator();
        while (iterate.hasNext()) {
            Component c = iterate.next();
            if (c instanceof Button && c.getId().equals(id)) {
                return (Button) c;
            }
        }
    }
    return null;
}
项目:osc-core    文件:CRUDBaseSubView.java   
public HorizontalLayout createToolbar(ToolbarButtons[] crudButtons) {
    this.toolbar = new HorizontalLayout();
    this.toolbar.addStyleName("buttonToolbar");
    for (ToolbarButtons button : crudButtons) {
        if (button == null) {
            continue;
        }
        Button buttonComponent = ViewUtil.buildToolbarButton(this.toolbar, button, this.buttonClickListener);
        if (button == ToolbarButtons.ADD || button == ToolbarButtons.BACK) {
            buttonComponent.setEnabled(true);
        }
    }

    return this.toolbar;
}
项目:osc-core    文件:ImportApplianceSoftwareVersionWindow.java   
@Override
public void populateForm() {
    this.form.setMargin(true);
    this.form.setSizeUndefined();

    this.uploader = new ApplianceUploader();
    this.uploader.setSizeFull();
    this.uploader.getUpload().addSucceededListener(getUploadSucceededListener());

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(this.uploader);
    layout.setCaption(VmidcMessages.getString(VmidcMessages_.UPLOAD_APPLIANCE_CAPTION));

    this.form.addComponent(layout);
}
项目:osc-core    文件:PasswordWindow.java   
@Override
public void populateForm() throws Exception {
    this.form.setMargin(true);
       this.form.setSizeUndefined();

       HorizontalLayout layout = new HorizontalLayout();
       this.passwordField = new PasswordField();
       this.passwordField.setRequired(true);

       layout.addComponent(this.passwordField);
       layout.setCaption(VmidcMessages.getString(VmidcMessages_.PASSWORD_CAPTION));

       this.form.addComponent(layout);
}
项目:md-stepper    文件:VerticalStepper.java   
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);
}
项目:vaadin-016-helloworld-14    文件:MainView.java   
@Override
protected Component createComponent() {
  final CssLayout contentLayout = new CssLayout(new Label("Content"));
  contentLayout.setSizeFull();
  contentLayout.setId(cssLayoutID().apply(MainUI.class, "Content"));

  final VerticalLayout menuLayout = new VerticalLayout();
  menuLayout.setId(verticalLayoutID().apply(MainUI.class, "MenuLayout"));
  menuLayout.setStyleName(ValoTheme.MENU_ROOT);
  menuLayout.setWidth(100, Unit.PERCENTAGE);
  menuLayout.setHeight(100, Unit.PERCENTAGE);
  menuLayout.setSizeFull();

  // to hard bound
  menuLayout.addComponent(new MenuComponent(contentLayout));


  final HorizontalLayout mainLayout = new HorizontalLayout();
  mainLayout.setId(horizontalLayoutID().apply(MainUI.class, "MainLayout"));
  mainLayout.setSizeFull();
  mainLayout.addComponent(menuLayout);
  mainLayout.addComponent(contentLayout);

  mainLayout.setExpandRatio(menuLayout, 0.20f);
  mainLayout.setExpandRatio(contentLayout, 0.80f);

  return mainLayout;
}
项目:Persephone    文件:ApplicationOverviewPanel.java   
private Layout buttonsLayout(Button... buttons) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();

    List<Component> components = new ArrayList<>(Arrays.asList(buttons));

    // Set HTML id for each button
    for(Component b : components) {
        b.setId(b.getCaption().replace(' ', '-')+"-btn");
    }

    // Split components into sublists of 5 elements
    int partitionSize = 5;
    List<List<Component>> partitions = new ArrayList<>();
    for (int i = 0; i < components.size(); i += partitionSize) {
        partitions.add(components.subList(i, Math.min(i + partitionSize, components.size())));
    }

    // Create vertical layouts for each list of buttons
    for(List<Component> sublist : partitions) {
        VerticalLayout vLayout = new VerticalLayout();
        vLayout.setMargin(false);

        sublist.stream().forEach(btn -> {
            btn.setSizeFull();
            vLayout.addComponent(btn);
        });

        layout.addComponent(vLayout);
    }

    return layout;
}
项目:Persephone    文件:PersephoneUI.java   
private Layout getFooter() {
    Layout footer = new HorizontalLayout();

    footer.addComponent(new Label("Persephone v"+persephoneVersion));
    footer.addComponent(new Link("Created by Vianney FAIVRE", new ExternalResource("https://vianneyfaiv.re"), "_blank", 0, 0, BorderStyle.DEFAULT));
    footer.addComponent(new Link("GitHub", new ExternalResource("https://github.com/vianneyfaivre/Persephone"), "_blank", 0, 0, BorderStyle.DEFAULT));

    footer.setHeight(20, Unit.PIXELS);
    footer.setStyleName("persephone-footer");
    return footer;
}
项目:Persephone    文件:PageHeader.java   
private HorizontalLayout getButtons(Component... components) {
    Button backButton = new Button("Go Back", VaadinIcons.BACKSPACE_A);
    backButton.setId("back-btn");
    backButton.addClickListener(e -> getUI().getNavigator().navigateTo(PersephoneViews.APPLICATIONS));

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(backButton);
    layout.addComponents(components);
    return layout;
}