Java Code Examples for com.vaadin.ui.HorizontalLayout

The following are top voted examples for showing how to use com.vaadin.ui.HorizontalLayout. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: esup-ecandidat   File: I18nField.java   Source Code and License 7 votes vote down vote up
/**
 * 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();
	});		
}
 
Example 2
Project: obog-manager   File: LogoutConfirmView.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 3
Project: crawling-framework   File: BaseView.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 4
Project: crawling-framework   File: BaseView.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 5
Project: holon-vaadin7   File: QuestionDialog.java   Source Code and License 6 votes vote down vote up
@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%");
	}
}
 
Example 6
Project: esup-ecandidat   File: CandidatCreerCompteView.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 7
Project: esup-ecandidat   File: ScolMailWindow.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 8
Project: esup-ecandidat   File: CtrCandFormationView.java   Source Code and License 6 votes vote down vote up
/**
 * @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;
}
 
Example 9
Project: esup-ecandidat   File: SearchAnneeUnivApoField.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 10
Project: esup-ecandidat   File: I18nField.java   Source Code and License 6 votes vote down vote up
/** 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);
		}
	});
}
 
Example 11
Project: osc-core   File: EmailLayout.java   Source Code and License 6 votes vote down vote up
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);
    }
}
 
Example 12
Project: osc-core   File: SummaryLayout.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 13
Project: osc-core   File: ViewUtil.java   Source Code and License 6 votes vote down vote up
/**
 * @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;
}
 
Example 14
Project: osc-core   File: CRUDBaseSubView.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 15
Project: holon-vaadin7   File: AbstractDialog.java   Source Code and License 5 votes vote down vote up
/**
 * 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 16
Project: holon-vaadin7   File: DefaultDialog.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 17
Project: holon-vaadin   File: DefaultDialog.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 18
Project: spring-boot-vaadin-rabbitmq-pipeline-demo   File: DemoView.java   Source Code and License 5 votes vote down vote up
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);
	}
 
Example 19
Project: spring-boot-vaadin-rabbitmq-pipeline-demo   File: StreamView.java   Source Code and License 5 votes vote down vote up
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);
	}
 
Example 20
Project: esup-ecandidat   File: CandidatureWindow.java   Source Code and License 5 votes vote down vote up
/**
 * @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;
}
 
Example 21
Project: esup-ecandidat   File: RequiredColorPickerField.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
	
}
 
Example 22
Project: esup-ecandidat   File: LocalDateTimeField.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 23
Project: esup-ecandidat   File: LocalTimeField.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 24
Project: esup-ecandidat   File: I18nField.java   Source Code and License 5 votes vote down vote up
/** 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;
}
 
Example 25
Project: osc-core   File: CRUDBaseView.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 26
Project: osc-core   File: CRUDBaseView.java   Source Code and License 5 votes vote down vote up
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;
    }
 
Example 27
Project: osc-core   File: CRUDBaseView.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 28
Project: osc-core   File: SslConfigurationLayout.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 29
Project: osc-core   File: ViewUtil.java   Source Code and License 5 votes vote down vote up
/**
 * @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 30
Project: osc-core   File: ViewUtil.java   Source Code and License 5 votes vote down vote up
/**
 * @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);
            }
        }
    }
}
 
Example 31
Project: osc-core   File: ViewUtil.java   Source Code and License 5 votes vote down vote up
/**
 *
 * @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);
            }
        }
    }
}
 
Example 32
Project: osc-core   File: ViewUtil.java   Source Code and License 5 votes vote down vote up
/**
 *
 *
 *
 * @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;
}
 
Example 33
Project: osc-core   File: CRUDBaseSubView.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 34
Project: osc-core   File: ImportApplianceSoftwareVersionWindow.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 35
Project: osc-core   File: PasswordWindow.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 36
Project: md-stepper   File: VerticalStepper.java   Source Code and License 5 votes vote down vote up
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 37
Project: vaadin-016-helloworld-14   File: MainView.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 38
Project: Persephone   File: ApplicationOverviewPanel.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 39
Project: Persephone   File: PersephoneUI.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 40
Project: Persephone   File: PageHeader.java   Source Code and License 5 votes vote down vote up
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;
}