List of usage examples for com.vaadin.ui Panel Panel
public Panel()
From source file:de.catma.ui.repository.CorpusPanel.java
License:Open Source License
private Component createCorporaPanel() { Panel corporaPanel = new Panel(); corporaPanel.getContent().setSizeUndefined(); corporaPanel.setSizeFull();// www. j a v a 2 s . co m corporaContainer = new HierarchicalContainer(); corporaTree = new Tree(); corporaTree.setContainerDataSource(corporaContainer); corporaTree.addStyleName("bold-label-caption"); corporaTree.setCaption("Corpora"); corporaTree.addItem(allDocuments); corporaTree.setChildrenAllowed(allDocuments, false); corporaTree.setImmediate(true); corporaContainer.addContainerProperty(SORTCAP_PROP, String.class, null); for (Corpus c : repository.getCorpora()) { addCorpusToTree(c); } corporaContainer.sort(new Object[] { SORTCAP_PROP }, new boolean[] { true }); corporaTree.setValue(allDocuments); corporaPanel.addComponent(corporaTree); return corporaPanel; }
From source file:de.catma.ui.repository.SourceDocumentPanel.java
License:Open Source License
private Component createDocumentsPanel() { Panel documentsPanel = new Panel(); documentsContainer = new HierarchicalContainer(); documentsTree = new Tree(); documentsTree.setContainerDataSource(documentsContainer); documentsTree.setCaption("Documents"); documentsTree.addStyleName("bold-label-caption"); documentsTree.setImmediate(true);//from www . j a v a 2 s. co m documentsTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_ID); documentsTree.setDragMode(TreeDragMode.NODE); documentsPanel.addComponent(documentsTree); documentsPanel.getContent().setSizeUndefined(); documentsPanel.setSizeFull(); documentsContainer.addContainerProperty(SORTCAP_PROP, String.class, null); for (SourceDocument sd : repository.getSourceDocuments()) { addSourceDocumentToTree(sd); } documentsContainer.sort(new Object[] { SORTCAP_PROP }, new boolean[] { true }); return documentsPanel; }
From source file:de.catma.ui.repository.SourceDocumentPanel.java
License:Open Source License
private Component createContentInfoForm() { Panel contentInfoPanel = new Panel(); contentInfoPanel.getContent().setSizeUndefined(); contentInfoPanel.getContent().setWidth("100%"); contentInfoPanel.setSizeFull();//from w w w .j a v a2 s. co m contentInfoForm = new Form(); contentInfoForm.setSizeFull(); contentInfoForm.setCaption("Information"); contentInfoForm.setWriteThrough(false); contentInfoForm.setReadOnly(true); contentInfoForm.setEnabled(false); BeanItem<ContentInfoSet> contentInfoItem = new BeanItem<ContentInfoSet>(emptyContentInfoSet); contentInfoForm.setItemDataSource(contentInfoItem); contentInfoForm.setVisibleItemProperties(new String[] { "title", "author", "description", "publisher" }); contentInfoForm.setReadOnly(true); contentInfoPanel.addComponent(contentInfoForm); return contentInfoPanel; }
From source file:de.catma.ui.repository.TagLibraryPanel.java
License:Open Source License
private Component createTagLibraryTreePanel() { Panel tagLibraryPanel = new Panel(); tagLibraryPanel.getContent().setSizeUndefined(); tagLibraryPanel.setSizeFull();//from w ww . j a v a2 s .c o m tagLibraryContainer = new HierarchicalContainer(); tagLibrariesTree = new Tree(); tagLibrariesTree.setContainerDataSource(tagLibraryContainer); tagLibrariesTree.setCaption("Tag Libraries"); tagLibrariesTree.addStyleName("bold-label-caption"); tagLibrariesTree.setImmediate(true); tagLibrariesTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_ID); tagLibraryContainer.addContainerProperty(SORTCAP_PROP, String.class, null); for (TagLibraryReference tlr : repository.getTagLibraryReferences()) { addTagLibraryReferenceToTree(tlr); } tagLibraryContainer.sort(new Object[] { SORTCAP_PROP }, new boolean[] { true }); tagLibraryPanel.addComponent(tagLibrariesTree); return tagLibraryPanel; }
From source file:de.codecentric.vaadin.copy2clipboard.Copy2ClipboardApplication.java
License:Apache License
/** * (non-Javadoc)/*from w w w .j a v a 2 s. c om*/ * * @see com.vaadin.Application#init() */ @Override public void init() { mainWindow = new Window(); setMainWindow(mainWindow); // Add a Copy2ClipboardButton to the main page: Copy2ClipboardButton button = new Copy2ClipboardButton(); button.setCaption("Copy"); button.setClipboardText("copy this to the clipboard"); button.addListener(new CopyListener("from page: copied to clipboard")); mainWindow.addComponent(button); // Add a Copy2ClipboardButton to a panel: Copy2ClipboardButton c2c = new Copy2ClipboardButton(); c2c.setCaption("panelTest"); c2c.setClipboardText("clipboard text from panel"); c2c.addListener(new CopyListener("from panel: copied to clipboard")); Panel panel = new Panel(); panel.addComponent(c2c); mainWindow.addComponent(panel); Button modal = new Button("open modal window"); modal.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { C2CModalWindow w = new C2CModalWindow("Modal window"); w.center(); w.setContent(new ModalLayout()); mainWindow.addWindow(w); } }); mainWindow.addComponent(modal); }
From source file:de.decidr.ui.view.AbstractListComponent.java
License:Apache License
/** * TODO: add comment/* w w w . j av a 2s . c o m*/ * */ @SuppressWarnings("serial") public AbstractListComponent() { super(); buttonPolicies = new HashMap<Button, ButtonPolicy>(); buttons = new Vector<Button>(); verticalLayout = new VerticalLayout(); buttonHorizontalLayout = new HorizontalLayout(); buttonPanel = new Panel(); setCompositionRoot(verticalLayout); valueChangeListener = new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { updateButtonStatus(); } }; itemClickListener = new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { System.out.println("Click!"); if (event.isDoubleClick() && defaultAction != null) { contentTable.setValue(event.getItemId()); defaultAction.buttonClick(null); } } }; }
From source file:de.decidr.ui.view.EditTenantComponent.java
License:Apache License
/** * This method initializes the components of the {@link EditTenantComponent} * .//from w w w . j ava 2s .c o m */ private void init() { tenantContainer = new TenantContainer(); verticalLayout = new VerticalLayout(); buttonHorizontalLayout = new HorizontalLayout(); editTenantLabel = new Label("<h2>Edit tenant</h2>"); editTenantLabel.setContentMode(Label.CONTENT_XHTML); buttonPanel = new Panel(); tenantTable = new TenantTable(tenantContainer); searchPanel = new SearchPanel(tenantTable); deleteButton = new Button("Delete", new DeleteTenantAction(tenantTable)); setCompositionRoot(verticalLayout); verticalLayout.setSpacing(true); verticalLayout.addComponent(editTenantLabel); verticalLayout.addComponent(searchPanel); verticalLayout.addComponent(tenantTable); verticalLayout.addComponent(buttonPanel); buttonPanel.setCaption("Selected tenants:"); buttonPanel.addComponent(buttonHorizontalLayout); buttonHorizontalLayout.setSpacing(true); buttonHorizontalLayout.addComponent(deleteButton); }
From source file:de.decidr.ui.view.LoginComponent.java
License:Apache License
/** * This method initializes the components of the {@link LoginComponent}. *//*from www . jav a2 s . c o m*/ private void init(InvitationDialogComponent invD) { verticalLayout = new VerticalLayout(); invisiblePanel = new Panel(); invisiblePanel.addActionHandler(this); loginLabel = new Label("<h3>Login:</h3>"); loginLabel.setContentMode(Label.CONTENT_XHTML); usernameTextField = new TextField(); usernameTextField.setCaption("Username"); usernameTextField.setImmediate(true); passwordTextField = new TextField(); passwordTextField.setCaption("Password"); passwordTextField.setSecret(true); if (invD == null) { loginListener = new LoginAction(); loginButton = new Button("Login", loginListener); usernameTextField.focus(); } else { loginListener = new LoginWithInvitationAction(invD); loginButton = new Button("Login", loginListener); loginButton.focus(); } forgotPasswordButton = new Button("Forgot your password?", new ShowResetPasswordAction()); forgotPasswordButton.setStyleName(Button.STYLE_LINK); registerButton = new Button("Register", new ShowRegistrationAction()); registerButton.setStyleName(Button.STYLE_LINK); setCompositionRoot(verticalLayout); ((VerticalLayout) invisiblePanel.getContent()).setSpacing(false); ((VerticalLayout) invisiblePanel.getContent()).setMargin(false); invisiblePanel.addComponent(usernameTextField); invisiblePanel.addComponent(passwordTextField); verticalLayout.setSpacing(true); verticalLayout.setMargin(true); verticalLayout.addComponent(loginLabel); verticalLayout.addComponent(invisiblePanel); verticalLayout.addComponent(loginButton); verticalLayout.addComponent(forgotPasswordButton); verticalLayout.addComponent(registerButton); }
From source file:de.decidr.ui.view.ProfileSettingsComponent.java
License:Apache License
/** * This method initializes the components of the * {@link ProfileSettingsComponent}./* ww w . ja v a2s. c o m*/ */ private void init() { settingsForm.setWriteThrough(false); settingsItem = new BeanItem(user.getUserProfile(), properties); settingsForm.setItemDataSource(settingsItem); settingsForm.setFormFieldFactory(new SettingsFieldFactory()); settingsForm.setVisibleItemProperties(properties); addressPanel = new Panel(); usernamePanel = new Panel(); profileButtonPanel = new Panel(); usernameGridLayout = new GridLayout(2, 2); verticalLayout = new VerticalLayout(); addressVerticalLayout = new VerticalLayout(); profileButtonHorizontalLayout = new HorizontalLayout(); myProfileLabel = new Label("<h2> My Profile </h2>"); myProfileLabel.setContentMode(Label.CONTENT_XHTML); usernameLabel = new Label("Username: "); emailLabel = new Label("Email address: "); usernameNameLabel = new Label(user.getUserProfile().getUsername()); emailNameLabel = new Label(user.getEmail()); changeEmailLink = new Button("Change email", new ShowChangeEmailAction()); changeEmailLink.setStyleName(Button.STYLE_LINK); changePasswordLink = new Button("Change password", new ShowChangePasswordAction()); changePasswordLink.setStyleName(Button.STYLE_LINK); leaveTenantLink = new Button("Leave tenant", new ShowLeaveTenantDialogAction()); leaveTenantLink.setStyleName(Button.STYLE_LINK); saveButton = new Button("Save", new SaveProfileAction()); settingsForm.addField("button", saveButton); statusCheckBox = new CheckBox(); statusCheckBox.setValue(user.getUnavailableSince() != null ? true : false); statusCheckBox.addListener(new ChangeStatusAction(user.getId())); statusCheckBox.setImmediate(true); this.setCompositionRoot(verticalLayout); verticalLayout.setSpacing(true); verticalLayout.addComponent(myProfileLabel); verticalLayout.addComponent(usernamePanel); usernamePanel.addComponent(usernameGridLayout); usernameGridLayout.setSpacing(true); usernameGridLayout.addComponent(usernameLabel, 0, 0); usernameGridLayout.addComponent(usernameNameLabel, 1, 0); usernameGridLayout.addComponent(emailLabel, 0, 1); usernameGridLayout.addComponent(emailNameLabel, 1, 1); verticalLayout.addComponent(profileButtonPanel); profileButtonPanel.addComponent(profileButtonHorizontalLayout); profileButtonHorizontalLayout.setSpacing(true); profileButtonHorizontalLayout.addComponent(changeEmailLink); profileButtonHorizontalLayout.addComponent(changePasswordLink); profileButtonHorizontalLayout.addComponent(leaveTenantLink); profileButtonHorizontalLayout.addComponent(statusCheckBox); statusCheckBox.setCaption("Set my status to unavailable"); profileButtonHorizontalLayout.setComponentAlignment(statusCheckBox, Alignment.TOP_RIGHT); verticalLayout.addComponent(addressPanel); addressPanel.addComponent(addressVerticalLayout); addressVerticalLayout.setSpacing(true); addressVerticalLayout.addComponent(settingsForm); }
From source file:de.decidr.ui.view.TenantSettingsComponent.java
License:Apache License
/** * This method initializes the components for the tenant settings component. *//*w w w . j a v a 2 s . co m*/ private void init() { verticalLayout = new VerticalLayout(); browseHorizontalLayout = new HorizontalLayout(); buttonHorizontalLayout = new HorizontalLayout(); schemeHorizontalLayout = new HorizontalLayout(); browsePanel = new Panel(); schemePanel = new Panel(); schemePanel.setCaption("Color Scheme"); buttonPanel = new Panel(); tenantSettingsLabel = new Label("Tenant Settings for " + tenant.getName()); textArea = new TextField(); textArea.setRows(10); textArea.setColumns(30); textArea.setCaption("Description"); textArea.setValue(tenant.getDescription()); logoUpload = new UploadComponent(tenant.getLogo().getId(), new UploadAction()); saveButton = new Button("Save", new SaveTenantSettingsAction()); restoreDefaultSettingsButton = new Button("Restore Default Settings", new RestoreDefaultTenantSettingsAction()); logoEmbedded = new Embedded("", new FileResource(UIConventions.getLogoFile(tenant.getId()), DecidrUI.getCurrent())); logoEmbedded.setCaption("Logo"); logoEmbedded.setImmediate(true); setCompositionRoot(verticalLayout); verticalLayout.setSpacing(true); verticalLayout.addComponent(tenantSettingsLabel); verticalLayout.addComponent(textArea); verticalLayout.addComponent(logoEmbedded); verticalLayout.addComponent(browsePanel); browsePanel.addComponent(browseHorizontalLayout); browseHorizontalLayout.setSpacing(true); browseHorizontalLayout.addComponent(logoUpload); verticalLayout.addComponent(schemePanel); schemePanel.addComponent(schemeHorizontalLayout); schemeHorizontalLayout.setSpacing(true); changeToBasic(); verticalLayout.addComponent(buttonPanel); buttonPanel.addComponent(buttonHorizontalLayout); buttonHorizontalLayout.setSpacing(true); buttonHorizontalLayout.addComponent(saveButton); buttonHorizontalLayout.addComponent(restoreDefaultSettingsButton); }