List of usage examples for com.vaadin.ui TabSheet setWidth
@Override public void setWidth(String width)
From source file:com.m4gik.views.component.LibraryScreen.java
/** * @param audioFile/*from w ww . ja v a 2 s .com*/ * @return */ private CssLayout addDetails(AudioFile audioFile) { CssLayout details = new CssLayout(); details.setWidth("100%"); Label title = new Label("<h3>" + audioFile.getArtist() + "–" + audioFile.getTitle() + "</h3>", ContentMode.HTML); details.addComponent(title); title.setSizeUndefined(); TabSheet tabs = new TabSheet(); tabs.addStyleName(Runo.TABSHEET_SMALL); tabs.setWidth("100%"); tabs.setHeight("180px"); details.addComponent(tabs); FormLayout formLayout = new FormLayout(); tabs.addTab(formLayout, "Info"); Label text = new Label(audioFile.getTitle()); text.setCaption("Title:"); formLayout.addComponent(text); text = new Label(audioFile.getArtist()); text.setCaption("Artist:"); formLayout.addComponent(text); text = new Label(audioFile.getAlbum()); text.setCaption("Album:"); formLayout.addComponent(text); text = new Label(audioFile.getGenre()); text.setCaption("Genre:"); formLayout.addComponent(text); text = new Label(audioFile.getPrice() + "$"); text.setCaption("Price"); formLayout.addComponent(text); formLayout = new FormLayout(); tabs.addTab(formLayout, "Decription"); text = new Label(audioFile.getAbout()); formLayout.addComponent(text); formLayout = new FormLayout(); tabs.addTab(formLayout, "Lyrics"); text = new Label(audioFile.getLyrics()); formLayout.addComponent(text); return details; }
From source file:dhbw.clippinggorilla.userinterface.windows.PreferencesWindow.java
public PreferencesWindow(User user) { //setHeight("480px"); //setWidth("720px"); VerticalLayout windowContent = new VerticalLayout(); windowContent.setWidth("100%"); windowContent.setHeight("100%"); windowContent.setMargin(new MarginInfo(true, false, false, false)); TabSheet preferencesCategories = new TabSheet(); preferencesCategories.setWidth("100%"); preferencesCategories.setHeight("100%"); preferencesCategories.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); preferencesCategories.addStyleName(ValoTheme.TABSHEET_ICONS_ON_TOP); preferencesCategories.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS); windowContent.addComponent(preferencesCategories); windowContent.setExpandRatio(preferencesCategories, 1f); preferencesCategories.addComponent(buildUserTab(user)); preferencesCategories.addComponent(buildClippingsTab(user)); preferencesCategories.addComponent(buildSupportTab(user)); preferencesCategories.setSelectedTab(0); windowContent.addComponent(buildFooter(user)); setContent(windowContent);//from ww w.ja v a 2 s.c om setModal(true); addCloseShortcut(KeyCode.ENTER, null); setResizable(false); setClosable(false); setHeight("480px"); setWidth("720px"); }
From source file:eu.maxschuster.vaadin.signaturefield.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle(pageTitle);/*from w w w . jav a2 s. c o m*/ final VerticalLayout margin = new VerticalLayout(); setContent(margin); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("658px"); margin.addComponent(layout); margin.setComponentAlignment(layout, Alignment.TOP_CENTER); final Label header1 = new Label(pageTitle); header1.addStyleName("h1"); header1.setSizeUndefined(); layout.addComponent(header1); layout.setComponentAlignment(header1, Alignment.TOP_CENTER); final TabSheet tabSheet = new TabSheet(); tabSheet.setWidth("100%"); layout.addComponent(tabSheet); layout.setComponentAlignment(tabSheet, Alignment.TOP_CENTER); final Panel signaturePanel = new Panel(); signaturePanel.addStyleName("signature-panel"); signaturePanel.setWidth("100%"); tabSheet.addTab(signaturePanel, "Demo"); final VerticalLayout signatureLayout = new VerticalLayout(); signatureLayout.setMargin(true); signatureLayout.setSpacing(true); signatureLayout.setSizeFull(); signaturePanel.setContent(signatureLayout); final SignatureField signatureField = new SignatureField(); signatureField.setWidth("100%"); signatureField.setHeight("318px"); signatureField.setPenColor(Color.ULTRAMARINE); signatureField.setBackgroundColor("white"); signatureField.setConverter(new StringToDataUrlConverter()); signatureField.setPropertyDataSource(dataUrlProperty); signatureField.setVelocityFilterWeight(0.7); signatureLayout.addComponent(signatureField); signatureLayout.setComponentAlignment(signatureField, Alignment.MIDDLE_CENTER); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth("100%"); signatureLayout.addComponent(buttonLayout); final Button clearButton = new Button("Clear", new ClickListener() { @Override public void buttonClick(ClickEvent event) { signatureField.clear(); } }); buttonLayout.addComponent(clearButton); buttonLayout.setComponentAlignment(clearButton, Alignment.MIDDLE_LEFT); final Label message = new Label("Sign above"); message.setSizeUndefined(); buttonLayout.addComponent(message); buttonLayout.setComponentAlignment(message, Alignment.MIDDLE_CENTER); final ButtonLink saveButtonLink = new ButtonLink("Save", null); saveButtonLink.setTargetName("_blank"); buttonLayout.addComponent(saveButtonLink); buttonLayout.setComponentAlignment(saveButtonLink, Alignment.MIDDLE_RIGHT); final Panel optionsPanel = new Panel(); optionsPanel.setSizeFull(); tabSheet.addTab(optionsPanel, "Options"); final FormLayout optionsLayout = new FormLayout(); optionsLayout.setMargin(true); optionsLayout.setSpacing(true); optionsPanel.setContent(optionsLayout); final ComboBox mimeTypeComboBox = new ComboBox(null, mimeTypeContainer); optionsLayout.addComponent(mimeTypeComboBox); mimeTypeComboBox.setItemCaptionPropertyId("mimeType"); mimeTypeComboBox.setNullSelectionAllowed(false); mimeTypeComboBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { MimeType mimeType = (MimeType) event.getProperty().getValue(); signatureField.setMimeType(mimeType); } }); mimeTypeComboBox.setValue(MimeType.PNG); mimeTypeComboBox.setCaption("Result MIME-Type"); final CheckBox immediateCheckBox = new CheckBox("immediate", false); optionsLayout.addComponent(immediateCheckBox); immediateCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean immediate = (Boolean) event.getProperty().getValue(); signatureField.setImmediate(immediate); } }); final CheckBox readOnlyCheckBox = new CheckBox("readOnly", false); optionsLayout.addComponent(readOnlyCheckBox); readOnlyCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean readOnly = (Boolean) event.getProperty().getValue(); signatureField.setReadOnly(readOnly); mimeTypeComboBox.setReadOnly(readOnly); clearButton.setEnabled(!readOnly); } }); final CheckBox requiredCheckBox = new CheckBox("required (causes bug that clears field)", false); optionsLayout.addComponent(requiredCheckBox); requiredCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean required = (Boolean) event.getProperty().getValue(); signatureField.setRequired(required); } }); final CheckBox clearButtonEnabledButton = new CheckBox("clearButtonEnabled", false); optionsLayout.addComponent(clearButtonEnabledButton); clearButtonEnabledButton.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean clearButtonEnabled = (Boolean) event.getProperty().getValue(); signatureField.setClearButtonEnabled(clearButtonEnabled); } }); final Panel resultPanel = new Panel("Results:"); resultPanel.setWidth("100%"); layout.addComponent(resultPanel); final VerticalLayout resultLayout = new VerticalLayout(); resultLayout.setMargin(true); resultPanel.setContent(resultLayout); final Image stringPreviewImage = new Image("String preview image:"); stringPreviewImage.setWidth("500px"); resultLayout.addComponent(stringPreviewImage); final Image dataUrlPreviewImage = new Image("DataURL preview image:"); dataUrlPreviewImage.setWidth("500px"); resultLayout.addComponent(dataUrlPreviewImage); final TextArea textArea = new TextArea("DataURL:"); textArea.setWidth("100%"); textArea.setHeight("300px"); resultLayout.addComponent(textArea); final Label emptyLabel = new Label(); emptyLabel.setCaption("Is Empty:"); emptyLabel.setValue(String.valueOf(signatureField.isEmpty())); resultLayout.addComponent(emptyLabel); signatureField.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String signature = (String) event.getProperty().getValue(); stringPreviewImage.setSource(signature != null ? new ExternalResource(signature) : null); textArea.setValue(signature); emptyLabel.setValue(String.valueOf(signatureField.isEmpty())); } }); dataUrlProperty.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { try { final DataUrl signature = (DataUrl) event.getProperty().getValue(); dataUrlPreviewImage.setSource( signature != null ? new ExternalResource(serializer.serialize(signature)) : null); StreamResource streamResource = null; if (signature != null) { StreamSource streamSource = new StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(signature.getData()); } }; MimeType mimeType = MimeType.valueOfMimeType(signature.getMimeType()); String extension = null; switch (mimeType) { case JPEG: extension = "jpg"; break; case PNG: extension = "png"; break; } streamResource = new StreamResource(streamSource, "signature." + extension); streamResource.setMIMEType(signature.getMimeType()); streamResource.setCacheTime(0); } saveButtonLink.setResource(streamResource); } catch (MalformedURLException e) { logger.error(e.getMessage(), e); } } }); }
From source file:org.apache.ace.webui.vaadin.EditWindow.java
License:Apache License
/** * @param object/*from ww w. ja v a2 s. c om*/ * @param factories */ protected void initDialog(final NamedObject object, List<UIExtensionFactory> factories) { VerticalLayout fields = new VerticalLayout(); fields.setSpacing(true); fields.addComponent(m_name); fields.addComponent(m_description); TabSheet tabs = new TabSheet(); tabs.setHeight("350px"); tabs.setWidth("100%"); tabs.setVisible(!factories.isEmpty()); Map<String, Object> context = new HashMap<>(); context.put("object", object); populateContext(context); for (UIExtensionFactory factory : factories) { try { tabs.addTab(factory.create(context)); } catch (Throwable ex) { // We ignore extension factories that throw exceptions // TODO: log this or something ex.printStackTrace(); } } Button okButton = new Button("Ok", new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { onOk((String) m_name.getValue(), (String) m_description.getValue()); close(); } catch (Exception e) { handleError(e); } } }); // Allow enter to be used to close this dialog with enter directly... okButton.setClickShortcut(KeyCode.ENTER); okButton.addStyleName("primary"); Button cancelButton = new Button("Cancel", new Button.ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); cancelButton.setClickShortcut(KeyCode.ESCAPE); HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.setSpacing(true); buttonBar.addComponent(okButton); buttonBar.addComponent(cancelButton); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(fields); layout.addComponent(tabs); layout.addComponent(buttonBar); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT); m_name.focus(); }
From source file:org.apache.tamaya.ui.views.ConfigView.java
License:Apache License
public ConfigView() { Label caption = new Label("Raw Configuration"); Label description = new Label( "This view shows the overall <b>raw</b> configuration configArea. Dependening on your access rights you" + "may see partial or masked data. Similarly configuration can be <i>read-only</i> or <i>mutable</i>.", ContentMode.HTML);/*from w ww . jav a 2s .co m*/ TabSheet tabPane = new TabSheet(); tabPane.setHeight("100%"); tabPane.setWidth("100%"); tabPane.addTab(createConfigTab(), "Configuration"); tabPane.addTab(createEnvTab(), "Environment Properties"); tabPane.addTab(createSysPropsTab(), "System Properties"); tabPane.addTab(createRuntimeTab(), "Runtime Properties"); addComponents(caption, description, tabPane); caption.addStyleName(UIConstants.LABEL_HUGE); description.addStyleName(UIConstants.LABEL_LARGE); }
From source file:org.metawidget.vaadin.ui.layout.TabSheetLayoutDecorator.java
License:LGPL
@Override protected ComponentContainer createSectionWidget(ComponentContainer previousSectionWidget, String section, Map<String, String> attributes, ComponentContainer container, VaadinMetawidget metawidget) { TabSheet tabSheet; // Whole new tabbed pane? if (previousSectionWidget == null) { tabSheet = new TabSheet(); tabSheet.setWidth("100%"); // Add to parent container Map<String, String> tabbedPaneAttributes = CollectionUtils.newHashMap(); tabbedPaneAttributes.put(LABEL, ""); tabbedPaneAttributes.put(LARGE, TRUE); getDelegate().layoutWidget(tabSheet, PROPERTY, tabbedPaneAttributes, container, metawidget); } else {/* w ww.jav a 2s . co m*/ tabSheet = (TabSheet) previousSectionWidget.getParent(); } // New tab Panel tabPanel = new Panel(); // Tab name (possibly localized) String localizedSection = metawidget.getLocalizedKey(StringUtils.camelCase(section)); if (localizedSection == null) { localizedSection = section; } tabSheet.addTab(tabPanel, localizedSection, null); return tabPanel; }