Java Code Examples for com.vaadin.ui.VerticalLayout#setComponentAlignment()

The following examples show how to use com.vaadin.ui.VerticalLayout#setComponentAlignment() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfirmClearAll.java    From chipster with MIT License 6 votes vote down vote up
public ConfirmClearAll(ToolEditorUI root) {
	super("Do you really want to clear everyting?");
	this.setModal(true);
	this.setHeight("200px");
	this.root = root;
	initButtonsListener();
	VerticalLayout vLayout = new VerticalLayout();
	vLayout.setSpacing(true);
	vLayout.setMargin(true);
	vLayout.addComponent(new Label("This will clear all inputs, outputs, and parameters as well as the the text area. Do you really want to clear all?"));
	HorizontalLayout hLayout = new HorizontalLayout();
	hLayout.addComponent(ok);
	hLayout.addComponent(cancel);
	hLayout.setSpacing(true);
	vLayout.addComponent(hLayout);
	vLayout.setComponentAlignment(hLayout, Alignment.BOTTOM_RIGHT);
	this.setContent(vLayout);
}
 
Example 2
Source File: WebDialogs.java    From cuba with Apache License 2.0 5 votes vote down vote up
public MessageDialogBuilderImpl() {
    window = new CubaWindow();

    window.setModal(true);
    window.setResizable(false);

    layout = new VerticalLayout();
    layout.setStyleName("c-app-message-dialog");
    layout.setMargin(false);
    layout.setSpacing(true);

    messageLabel = new CubaLabel();
    messageLabel.setStyleName("c-app-message-dialog-text");
    messageLabel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    DialogAction action = new DialogAction(DialogAction.Type.OK);
    okButton = createButton(action);
    okButton.setClickHandler(me -> {
        try {
            action.actionPerform(ui.getTopLevelWindow());
        } finally {
            ui.removeWindow(window);
        }
    });

    layout.addComponent(messageLabel);

    layout.addComponent(okButton);
    layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);

    window.setContent(layout);

    ThemeConstants theme = ui.getApp().getThemeConstants();
    window.setWidth(theme.get("cuba.web.WebWindowManager.messageDialog.width"));
}
 
Example 3
Source File: SignUpViewImpl.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 5 votes vote down vote up
@Override
public void postConstruct() {
	super.postConstruct();		
	setSizeFull();
	
	layout = new VerticalLayout();
	layout.setSizeFull();
	layout.setSpacing(true);
	setCompositionRoot(layout);
	
	infoLabel = new Label("Vaadin4Spring Security Demo - SignUp");
	infoLabel.addStyleName(ValoTheme.LABEL_H2);
	infoLabel.setSizeUndefined();
	layout.addComponent(infoLabel);
	layout.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER);
	
	container = new VerticalLayout();
	container.setSizeUndefined();
	container.setSpacing(true);
	layout.addComponent(container);
	layout.setComponentAlignment(container, Alignment.MIDDLE_CENTER);
	layout.setExpandRatio(container, 1);
					
	form = new FormLayout();
	form.setWidth("400px");
	form.setSpacing(true);
	container.addComponent(form);
	buildForm();
				
	btnSignUp = new Button("Signup", FontAwesome.FLOPPY_O);
	btnSignUp.addStyleName(ValoTheme.BUTTON_FRIENDLY);
	btnSignUp.addClickListener(this);
	container.addComponent(btnSignUp);
	container.setComponentAlignment(btnSignUp, Alignment.MIDDLE_CENTER);

}
 
Example 4
Source File: ObligationAdviceEditorWindow.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("100%");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// horizontalLayout_1
	horizontalLayout_1 = buildHorizontalLayout_1();
	mainLayout.addComponent(horizontalLayout_1);
	
	// tableExpressions
	tableExpressions = new TreeTable();
	tableExpressions.setCaption("Expressions");
	tableExpressions.setImmediate(false);
	tableExpressions.setWidth("100%");
	tableExpressions.setHeight("-1px");
	mainLayout.addComponent(tableExpressions);
	mainLayout.setExpandRatio(tableExpressions, 1.0f);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Save");
	buttonSave.setImmediate(false);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(48));
	
	return mainLayout;
}
 
Example 5
Source File: CountryMenuItemFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public void createOverviewPage(final VerticalLayout panelContent) {
	final MenuBar menuBar = new MenuBar();
	panelContent.addComponent(menuBar);
	panelContent.setComponentAlignment(menuBar, Alignment.TOP_LEFT);
	panelContent.setExpandRatio(menuBar, ContentRatio.LARGE);

	addSourcesAndIndicatorsToMenu(menuBar.addItem("By Topic",VaadinIcons.LINE_CHART, null), getTopicIndicatorMap());
	menuBar.setAutoOpen(true);
}
 
Example 6
Source File: RegexpEditorComponent.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private VerticalLayout buildVerticalLayout_2() {
	// common part: create layout
	verticalLayout_2 = new VerticalLayout();
	verticalLayout_2.setImmediate(false);
	verticalLayout_2.setWidth("100.0%");
	verticalLayout_2.setHeight("100.0%");
	verticalLayout_2.setMargin(false);
	
	// textFieldTestValue
	textFieldTestValue = new TextField();
	textFieldTestValue.setCaption("Test Value");
	textFieldTestValue.setImmediate(true);
	textFieldTestValue
			.setDescription("Enter a value to match against the regular expression.");
	textFieldTestValue.setWidth("-1px");
	textFieldTestValue.setHeight("-1px");
	textFieldTestValue.setInputPrompt("eg. example");
	verticalLayout_2.addComponent(textFieldTestValue);
	
	// buttonTest
	buttonTest = new Button();
	buttonTest.setCaption("Test");
	buttonTest.setImmediate(true);
	buttonTest.setWidth("-1px");
	buttonTest.setHeight("-1px");
	verticalLayout_2.addComponent(buttonTest);
	verticalLayout_2.setComponentAlignment(buttonTest, new Alignment(48));
	
	return verticalLayout_2;
}
 
Example 7
Source File: ToolEditorUI.java    From chipster with MIT License 5 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
	treeToolEditor = new TreeToolEditor(this);
	toolEditor = new ToolEditor(this);
	textEditor = new TextEditor(this);
	final Panel vLayout = new Panel();
	vSplitPanel = new VerticalSplitPanel();
	vSplitPanel.setSplitPosition(50, Unit.PERCENTAGE);
	vSplitPanel.setImmediate(true);
	vSplitPanel.setLocked(false);
	vSplitPanel.setWidth("100%");
	vLayout.setContent(vSplitPanel);
    setContent(vSplitPanel);
    VerticalLayout vvLayout = new VerticalLayout();
    vvLayout.setSizeFull();
    Label title = new Label("<h2><b>&nbsp;Tool Editor</b></h2>", ContentMode.HTML);

    vvLayout.addComponent(title);
    vvLayout.setComponentAlignment(title, Alignment.TOP_LEFT);
    HorizontalSplitPanel hSplitpPanel = new HorizontalSplitPanel();
    hSplitpPanel.setSizeFull();
    vvLayout.addComponent(hSplitpPanel);

    HorizontalLayout buttonPanel = getButtonPanel();
    vvLayout.addComponent(buttonPanel);
    vvLayout.setComponentAlignment(buttonPanel, Alignment.MIDDLE_CENTER);

    vvLayout.setExpandRatio(hSplitpPanel, 5);
    vvLayout.setComponentAlignment(hSplitpPanel, Alignment.TOP_LEFT);
    vvLayout.setMargin(false);
    vvLayout.setSpacing(false);
    hSplitpPanel.setFirstComponent(treeToolEditor);
    hSplitpPanel.setSecondComponent(toolEditor);
    vSplitPanel.setFirstComponent(vvLayout);
    vSplitPanel.setSecondComponent(textEditor);
    hSplitpPanel.setStyleName("topborder");
}
 
Example 8
Source File: AttributeSelectionWindow.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// horizontalLayout_1
	horizontalLayout_1 = buildHorizontalLayout_1();
	mainLayout.addComponent(horizontalLayout_1);
	
	// horizontalLayoutAttribute
	horizontalLayoutAttribute = new HorizontalLayout();
	horizontalLayoutAttribute.setImmediate(false);
	horizontalLayoutAttribute.setWidth("-1px");
	horizontalLayoutAttribute.setHeight("-1px");
	horizontalLayoutAttribute.setMargin(false);
	mainLayout.addComponent(horizontalLayoutAttribute);
	mainLayout.setExpandRatio(horizontalLayoutAttribute, 1.0f);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Select");
	buttonSave.setImmediate(true);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(48));
	
	return mainLayout;
}
 
Example 9
Source File: ExpressionSelectionWindow.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// optionGroupExpression
	optionGroupExpression = new OptionGroup();
	optionGroupExpression
			.setCaption("Select One Of The Following Types of Expressions");
	optionGroupExpression.setImmediate(false);
	optionGroupExpression.setWidth("-1px");
	optionGroupExpression.setHeight("-1px");
	mainLayout.addComponent(optionGroupExpression);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Select");
	buttonSave.setImmediate(false);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(24));
	
	return mainLayout;
}
 
Example 10
Source File: FilterManagementView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void viewListView() {
    removeAllComponents();
    final VerticalLayout tableListViewLayout = new VerticalLayout();
    tableListViewLayout.setSizeFull();
    tableListViewLayout.setSpacing(false);
    tableListViewLayout.setMargin(false);
    tableListViewLayout.setStyleName("table-layout");
    tableListViewLayout.addComponent(targetFilterHeader);
    tableListViewLayout.setComponentAlignment(targetFilterHeader, Alignment.TOP_CENTER);
    tableListViewLayout.addComponent(targetFilterTable);
    tableListViewLayout.setComponentAlignment(targetFilterTable, Alignment.TOP_CENTER);
    tableListViewLayout.setExpandRatio(targetFilterTable, 1.0F);
    addComponent(tableListViewLayout);
}
 
Example 11
Source File: WebDialogs.java    From cuba with Apache License 2.0 5 votes vote down vote up
public OptionDialogBuilderImpl() {
    window = new CubaWindow();

    window.setModal(true);
    window.setClosable(false);
    window.setResizable(false);

    messageLabel = new CubaLabel();
    messageLabel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    layout = new VerticalLayout();
    layout.setStyleName("c-app-option-dialog");
    layout.setMargin(false);
    layout.setSpacing(true);

    buttonsContainer = new HorizontalLayout();
    buttonsContainer.setMargin(false);
    buttonsContainer.setSpacing(true);

    layout.addComponent(messageLabel);
    layout.addComponent(buttonsContainer);

    layout.setExpandRatio(messageLabel, 1);
    layout.setComponentAlignment(buttonsContainer, Alignment.BOTTOM_RIGHT);

    window.setContent(layout);

    ThemeConstants theme = ui.getApp().getThemeConstants();
    window.setWidth(theme.get("cuba.web.WebWindowManager.optionDialog.width"));
}
 
Example 12
Source File: PolicyUploadWindow.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// upload
	upload = new Upload();
	upload.setCaption("Upload Xacml Policy File");
	upload.setImmediate(false);
	upload.setWidth("-1px");
	upload.setHeight("-1px");
	mainLayout.addComponent(upload);
	
	// checkBoxImportAttributes
	checkBoxImportAttributes = new CheckBox();
	checkBoxImportAttributes
			.setCaption("Import attributes into attribute dictionary.");
	checkBoxImportAttributes.setImmediate(false);
	checkBoxImportAttributes.setWidth("-1px");
	checkBoxImportAttributes.setHeight("-1px");
	mainLayout.addComponent(checkBoxImportAttributes);
	
	// checkBoxIgnoreStandard
	checkBoxIgnoreStandard = new CheckBox();
	checkBoxIgnoreStandard.setCaption("Ignore Standard Attributes");
	checkBoxIgnoreStandard.setImmediate(false);
	checkBoxIgnoreStandard.setWidth("-1px");
	checkBoxIgnoreStandard.setHeight("-1px");
	mainLayout.addComponent(checkBoxIgnoreStandard);
	mainLayout.setComponentAlignment(checkBoxIgnoreStandard, new Alignment(
			20));
	
	// checkBoxImportObligations
	checkBoxImportObligations = new CheckBox();
	checkBoxImportObligations
			.setCaption("Import obligations into obligation dictionary.");
	checkBoxImportObligations.setImmediate(false);
	checkBoxImportObligations.setWidth("-1px");
	checkBoxImportObligations.setHeight("-1px");
	mainLayout.addComponent(checkBoxImportObligations);
	
	// checkBoxImportAdvice
	checkBoxImportAdvice = new CheckBox();
	checkBoxImportAdvice
			.setCaption("Import advice into advice dictionary.");
	checkBoxImportAdvice.setImmediate(false);
	checkBoxImportAdvice.setWidth("-1px");
	checkBoxImportAdvice.setHeight("-1px");
	mainLayout.addComponent(checkBoxImportAdvice);
	
	return mainLayout;
}
 
Example 13
Source File: GitPushWindow.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// textAreaComments
	textAreaComments = new TextArea();
	textAreaComments.setCaption("Add Comments");
	textAreaComments.setImmediate(false);
	textAreaComments
			.setDescription("Enter comments that reflect the changes you have made to the repository domains and/or policy files.");
	textAreaComments.setWidth("400px");
	textAreaComments.setHeight("-1px");
	textAreaComments.setInvalidAllowed(false);
	textAreaComments.setRequired(true);
	textAreaComments
			.setInputPrompt("Eg. Add new rule for employees in marketing department.");
	mainLayout.addComponent(textAreaComments);
	
	// tableChanges
	tableChanges = new Table();
	tableChanges.setCaption("Changes To Be Pushed");
	tableChanges.setImmediate(false);
	tableChanges.setWidth("100.0%");
	tableChanges.setHeight("-1px");
	mainLayout.addComponent(tableChanges);
	mainLayout.setExpandRatio(tableChanges, 1.0f);
	
	// buttonPush
	buttonPush = new Button();
	buttonPush.setCaption("Push Changes");
	buttonPush.setImmediate(true);
	buttonPush.setWidth("-1px");
	buttonPush.setHeight("-1px");
	mainLayout.addComponent(buttonPush);
	mainLayout.setComponentAlignment(buttonPush, new Alignment(48));
	
	return mainLayout;
}
 
Example 14
Source File: PIPParamEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// textFieldName
	textFieldName = new TextField();
	textFieldName.setCaption("Parameter Name");
	textFieldName.setImmediate(false);
	textFieldName.setWidth("-1px");
	textFieldName.setHeight("-1px");
	textFieldName.setInvalidAllowed(false);
	textFieldName.setRequired(true);
	mainLayout.addComponent(textFieldName);
	
	// textFieldValue
	textFieldValue = new TextField();
	textFieldValue.setCaption("Parameter Value");
	textFieldValue.setImmediate(false);
	textFieldValue.setWidth("-1px");
	textFieldValue.setHeight("-1px");
	textFieldValue.setInvalidAllowed(false);
	textFieldValue.setRequired(true);
	mainLayout.addComponent(textFieldValue);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Save");
	buttonSave.setImmediate(true);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(48));
	
	return mainLayout;
}
 
Example 15
Source File: PolicySetEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// labelID
	labelID = new Label();
	labelID.setCaption("Policy Set ID");
	labelID.setImmediate(false);
	labelID.setWidth("100.0%");
	labelID.setHeight("-1px");
	labelID.setValue("Label");
	mainLayout.addComponent(labelID);
	
	// textFieldVersion
	textFieldVersion = new TextField();
	textFieldVersion.setCaption("Version");
	textFieldVersion.setImmediate(false);
	textFieldVersion
			.setDescription("The format is numbers only separated by decimal point.");
	textFieldVersion.setWidth("-1px");
	textFieldVersion.setHeight("-1px");
	textFieldVersion.setInvalidAllowed(false);
	textFieldVersion.setRequired(true);
	textFieldVersion.setInputPrompt("Eg. 1 or 1.0 or 1.0.0 etc.");
	mainLayout.addComponent(textFieldVersion);
	
	// listSelectAlgorithm
	listSelectAlgorithm = new ListSelect();
	listSelectAlgorithm.setCaption("Policy Combining Algorithm");
	listSelectAlgorithm.setImmediate(false);
	listSelectAlgorithm.setWidth("100.0%");
	listSelectAlgorithm.setHeight("-1px");
	listSelectAlgorithm.setInvalidAllowed(false);
	listSelectAlgorithm.setRequired(true);
	mainLayout.addComponent(listSelectAlgorithm);
	
	// textAreaDescription
	textAreaDescription = new TextArea();
	textAreaDescription.setCaption("Description");
	textAreaDescription.setImmediate(false);
	textAreaDescription.setWidth("100.0%");
	textAreaDescription.setHeight("-1px");
	mainLayout.addComponent(textAreaDescription);
	mainLayout.setExpandRatio(textAreaDescription, 1.0f);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Save");
	buttonSave.setImmediate(true);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(48));
	
	return mainLayout;
}
 
Example 16
Source File: EditPDPGroupWindow.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("100.0%");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// textName
	textName = new TextField();
	textName.setCaption("Group Name");
	textName.setImmediate(false);
	textName.setWidth("-1px");
	textName.setHeight("-1px");
	textName.setRequired(true);
	mainLayout.addComponent(textName);
	
	// textDescription
	textDescription = new TextArea();
	textDescription.setCaption("Group Description");
	textDescription.setImmediate(false);
	textDescription.setWidth("100.0%");
	textDescription.setHeight("-1px");
	textDescription.setNullSettingAllowed(true);
	mainLayout.addComponent(textDescription);
	mainLayout.setExpandRatio(textDescription, 1.0f);
	
	// tablePolicies
	tablePolicies = new Table();
	tablePolicies.setCaption("Policies");
	tablePolicies.setImmediate(false);
	tablePolicies.setWidth("-1px");
	tablePolicies.setHeight("-1px");
	mainLayout.addComponent(tablePolicies);
	mainLayout.setExpandRatio(tablePolicies, 1.0f);
	
	// tablePIP
	tablePIP = new Table();
	tablePIP.setCaption("PIP Configurations");
	tablePIP.setImmediate(false);
	tablePIP.setWidth("-1px");
	tablePIP.setHeight("-1px");
	mainLayout.addComponent(tablePIP);
	mainLayout.setExpandRatio(tablePIP, 1.0f);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Save");
	buttonSave.setImmediate(true);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(48));
	
	return mainLayout;
}
 
Example 17
Source File: SignInViewImpl.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 4 votes vote down vote up
@Override
public void postConstruct() {	
	super.postConstruct();		
	setSizeFull();
	layout = new VerticalLayout();
	layout.setSizeFull();
	layout.setSpacing(true);
	setCompositionRoot(layout);
	
	caption = new Label("Sign in to Vaadin4Spring Security Demo");
	caption.addStyleName(ValoTheme.LABEL_H2);
	caption.setSizeUndefined();		
	layout.addComponent(caption);
	layout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
	
	loginPanel = new VerticalLayout();
	loginPanel.setSizeUndefined();
	loginPanel.setSpacing(true);
	loginPanel.setMargin(true);
	layout.addComponent(loginPanel);
	layout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
	layout.setExpandRatio(loginPanel, 1);
	
	errorMessage = new Label();
	errorMessage.setWidth("300px");
	errorMessage.addStyleName(ValoTheme.LABEL_FAILURE);		
	errorMessage.setVisible(false);
	loginPanel.addComponent(errorMessage);
	
	username = new TextField("Username");
	username.setImmediate(true);
	username.setWidth("300px");
	username.setNullRepresentation("");
	username.setInputPrompt("Enter your username");
	loginPanel.addComponent(username);
	
	password = new PasswordField("Password");
	password.setImmediate(true);
	password.setWidth("300px");
	password.setNullRepresentation("");
	loginPanel.addComponent(password);
	
	rememberMe = new CheckBox("Remember me");
	rememberMe.setValue(false);
	rememberMe.addStyleName(ValoTheme.CHECKBOX_LARGE);
	loginPanel.addComponent(rememberMe);
	
	btnLogin = new Button("Signin", FontAwesome.UNLOCK);
	btnLogin.addStyleName(ValoTheme.BUTTON_PRIMARY);
	btnLogin.addClickListener(this);
	btnLogin.setWidth("100%");
	loginPanel.addComponent(btnLogin);							
	
	final Label infoLabel = new Label(FontAwesome.INFO_CIRCLE.getHtml() + " You can sign in as: <br/>\"user\" with password \"user\" <br/>\"admin\" with password \"admin\".", ContentMode.HTML);
	infoLabel.setWidth("300px");
	loginPanel.addComponent(infoLabel);
}
 
Example 18
Source File: AssignBugWindow.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public AbstractComponent getLayout() {
    VerticalLayout layout = new VerticalLayout();
    this.informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);

    layout.addComponent(informationLayout.getLayout());

    final MButton approveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), clickEvent -> {
        if (EditForm.this.validateForm()) {
            // Save bug status and assignee
            final BugService bugService = AppContextUtil.getSpringBean(BugService.class);
            bugService.updateSelectiveWithSession(AssignBugWindow.this.bug, UserUIContext.getUsername());

            // Save comment
            final String commentValue = commentArea.getValue();
            if (StringUtils.isNotBlank(commentValue)) {
                final CommentWithBLOBs comment = new CommentWithBLOBs();
                comment.setComment(Jsoup.clean(commentValue, Whitelist.relaxed()));
                comment.setCreatedtime(LocalDateTime.now());
                comment.setCreateduser(UserUIContext.getUsername());
                comment.setSaccountid(AppUI.getAccountId());
                comment.setType(ProjectTypeConstants.BUG);
                comment.setTypeid("" + bug.getId());
                comment.setExtratypeid(CurrentProjectVariables.getProjectId());

                CommentService commentService = AppContextUtil.getSpringBean(CommentService.class);
                commentService.saveWithSession(comment, UserUIContext.getUsername());
            }

            close();
            EventBusFactory.getInstance().post(new BugEvent.BugChanged(this, bug.getId()));
        }
    }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.SHARE);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MHorizontalLayout controlsBtn = new MHorizontalLayout(cancelBtn, approveBtn);
    layout.addComponent(controlsBtn);
    layout.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);

    return layout;
}
 
Example 19
Source File: AdviceEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// textFieldAdviceID
	textFieldAdviceID = new TextField();
	textFieldAdviceID.setCaption("Advice ID");
	textFieldAdviceID.setImmediate(false);
	textFieldAdviceID.setWidth("-1px");
	textFieldAdviceID.setHeight("-1px");
	textFieldAdviceID.setInvalidAllowed(false);
	textFieldAdviceID.setRequired(true);
	textFieldAdviceID.setInputPrompt("Eg. urn:com:foo:advice:sample");
	mainLayout.addComponent(textFieldAdviceID);
	
	// optionGroupEffect
	optionGroupEffect = new OptionGroup();
	optionGroupEffect.setCaption("Applies To");
	optionGroupEffect.setImmediate(false);
	optionGroupEffect.setWidth("-1px");
	optionGroupEffect.setHeight("-1px");
	optionGroupEffect.setInvalidAllowed(false);
	optionGroupEffect.setRequired(true);
	mainLayout.addComponent(optionGroupEffect);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Save");
	buttonSave.setImmediate(true);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(48));
	
	return mainLayout;
}
 
Example 20
Source File: DemoContentLayout.java    From GridExtensionPack with Apache License 2.0 4 votes vote down vote up
public DemoContentLayout() {
	final SelectGrid<TestObject> grid = new SelectGrid<>();
	grid.addColumn(TestObject::getFoo).setCaption("Foo");
	grid.addColumn(TestObject::getBar, new NumberRenderer()).setCaption("Bar");
	grid.addColumn(TestObject::getKm, new NumberRenderer()).setCaption("KM");
	grid.setHeightByRows(10);
	grid.setHeightMode(HeightMode.ROW);

	// Show it in the middle of the screen
	setStyleName("demoContentLayout");
	setSizeFull();
	addComponent(grid);
	setComponentAlignment(grid, Alignment.MIDDLE_CENTER);

	final TableSelectionModel<TestObject> tableSelect = new TableSelectionModel<>();
	grid.setSelectionModel(tableSelect);
	tableSelect.setMode(TableSelectionMode.CTRL);

	HorizontalLayout tableSelectionControls = new HorizontalLayout();
	tableSelectionControls.setCaption("Table Selection Controls");

	// Controls for testing different TableSelectionModes
	for (final TableSelectionMode t : TableSelectionMode.values()) {
		tableSelectionControls.addComponent(new Button(t.toString(), e -> tableSelect.setMode(t)));
	}

	addComponent(tableSelectionControls);

	// TODO: PagingDataProvider

	PagedDataProvider<TestObject, SerializablePredicate<TestObject>> dataProvider = new PagedDataProvider<>(
			DataProvider.ofCollection(TestObject.generateTestData(995)));
	grid.setDataProvider(dataProvider);
	PagingControls pagingControls = dataProvider.getPagingControls();

	HorizontalLayout pages = new HorizontalLayout();
	pages.setCaption("Paging controls");
	pages.addComponent(new Button("First", e -> pagingControls.setPageNumber(0)));
	pages.addComponent(new Button("Previous", e -> pagingControls.previousPage()));
	pages.addComponent(new Button("Next", e -> pagingControls.nextPage()));
	pages.addComponent(new Button("Last", e -> pagingControls.setPageNumber(pagingControls.getPageCount() - 1)));
	VerticalLayout controls = new VerticalLayout();
	controls.addComponents(tableSelectionControls, pages);
	controls.setWidth("100%");
	controls.setHeightUndefined();
	controls.setComponentAlignment(tableSelectionControls, Alignment.MIDDLE_CENTER);
	controls.setComponentAlignment(pages, Alignment.BOTTOM_CENTER);
	addComponent(controls);
	setComponentAlignment(controls, Alignment.MIDDLE_CENTER);

	grid.getEditor().setEnabled(true);
	for (Column<TestObject, ?> c : grid.getColumns()) {
		c.setHidable(true);
	}
}