List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java
License:Open Source License
private void buildView() { CssLayout content = new CssLayout(); content.setWidth("100%"); setCaption("eHealth Exchange - " + AdminContext.getSessionAttributes().getSelectedPatientName()); VerticalComponentGroup vGroup = new VerticalComponentGroup(); Label displayAction = new Label( "<div style='color:#333;'><p>First perform a secured <b>Search</b> (DocumentQuery) for all available patient documents." + " Then <b>highlight</b> the document of interest in the table, then click" + " on the <b>Retrieve Document</b> button to perform a secured DocumentRetrieve." + " Decrpyt the document by clicking any of the 2 <b>Decryption</b> buttons results may vary depending" + " on you privileges. Once decrypted you may view the HTML form by clicking on the <b>View Clinical Document</b>.</p></div>", Label.CONTENT_XHTML); vGroup.addComponent(displayAction);//w w w . j a v a 2 s . c o m Button searchBTN = new Button("Search"); searchBTN.setStyleName(Runo.BUTTON_SMALL); searchBTN.setWidth("100"); content.addComponent(vGroup); content.addComponent(searchBTN); table = new Table(); table.setWidth("100%"); table.setHeight("350px"); table.setMultiSelect(false); table.setSelectable(true); table.setImmediate(true); // react at once when something is selected table.setEditable(false); table.setWriteThrough(true); table.setContainerDataSource(populateTable()); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(false); table.setVisibleColumns(new Object[] { "patientId", "docId", "docType", "respId", "msgId" }); table.setColumnHeaders( new String[] { "Patient ID", "Document ID", "Document Type", "Repository", "Message" }); content.addComponent(table); retrieveBTN = new Button("Retrieve Document"); decryptDocBTN = new Button("Decrypt Document"); decryptDocMaskBTN = new Button("Decrypt Doc and Entries"); viewHTMLBTN = new Button("View Clinical Document"); viewPDFBTN = new Button("Consent PDF"); viewXACMLBTN = new Button("Consent Policy"); viewSAMLBTN = new Button("View Authorization (SAML)"); viewMetaData = new Button("View Meta Data"); HorizontalComponentGroup hGroup = new HorizontalComponentGroup(); hGroup.setWidth("100%"); retrieveBTN.setEnabled(false); decryptDocBTN.setEnabled(false); decryptDocMaskBTN.setEnabled(false); viewHTMLBTN.setEnabled(false); viewPDFBTN.setEnabled(false); viewXACMLBTN.setEnabled(false); viewSAMLBTN.setEnabled(false); viewMetaData.setEnabled(false); hGroup.addComponent(retrieveBTN); hGroup.addComponent(decryptDocBTN); hGroup.addComponent(decryptDocMaskBTN); hGroup.addComponent(viewHTMLBTN); hGroup.addComponent(viewPDFBTN); hGroup.addComponent(viewXACMLBTN); hGroup.addComponent(viewSAMLBTN); hGroup.addComponent(viewMetaData); content.addComponent(hGroup); searchBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { patientId = AdminContext.getSessionAttributes().getSelectedPatientId(); patientName = AdminContext.getSessionAttributes().getSelectedPatientName(); currentDocument = ""; decryptDocument = ""; requestedService = "DocQuery"; //area.setValue(currentDocument); //area.setCaption("No Documents Selected"); String decision = "Permit"; if (patientId.equals("PUI100015060013")) { PolicyEnforcementObject pObj = policyEngine.enforceResouce( AdminContext.getSessionAttributes().getPurposeOfUse(), "PSY", "DocumentQueryOut"); decision = pObj.getPdpDecision(); } if (decision.equals("Permit")) { String res = lookUpPatient(); metaData = res; if (res.indexOf("XDSDocumentEntry.uniqueId") > -1) { AdhocQueryResponse adhoc = getQueryResponse(res); RegistryObjectListType rList = adhoc.getRegistryObjectList(); List<ExchangeResults> xList = processMetaData(rList); refreshTable(xList); } else { //throw warning docId = "NA"; docType = "NA"; messageId = "NA"; respId = "1.3.6.1.4.1.21367.2010.1.2.1040"; ExchangeResults eR = new ExchangeResults(patientName, patientId, docId, docType, "", "", "", messageId, respId); List<ExchangeResults> xList = new ArrayList(); xList.add(eR); refreshTable(xList); displayErrorMessage(res); } retrieveBTN.setEnabled(false); decryptDocBTN.setEnabled(false); decryptDocMaskBTN.setEnabled(false); viewHTMLBTN.setEnabled(false); viewPDFBTN.setEnabled(false); viewXACMLBTN.setEnabled(false); viewSAMLBTN.setEnabled(true); viewMetaData.setEnabled(true); } else { getWindow().showNotification("Warning", "You do not have the necessary authorization privileges to perform this operation.", Window.Notification.TYPE_WARNING_MESSAGE); } } }); table.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { Object rowId = table.getValue(); if (rowId != null) { patientName = (String) table.getContainerProperty(rowId, "patientName").getValue(); patientId = (String) table.getContainerProperty(rowId, "patientId").getValue(); docId = (String) table.getContainerProperty(rowId, "docId").getValue(); docType = (String) table.getContainerProperty(rowId, "docType").getValue(); respId = (String) table.getContainerProperty(rowId, "respId").getValue(); messageId = (String) table.getContainerProperty(rowId, "msgId").getValue(); if (docType.equals("Consult Notes")) { retrieveBTN.setEnabled(true); decryptDocBTN.setEnabled(true); decryptDocBTN.setCaption("Decrypt Document"); decryptDocMaskBTN.setEnabled(true); viewHTMLBTN.setEnabled(true); viewPDFBTN.setEnabled(false); viewXACMLBTN.setEnabled(false); } else if (docType.equals("Consent Notes") || docType.equals("Consult")) { retrieveBTN.setEnabled(true); decryptDocBTN.setEnabled(true); decryptDocBTN.setCaption("Extract Document"); decryptDocMaskBTN.setEnabled(false); viewHTMLBTN.setEnabled(true); viewPDFBTN.setEnabled(true); viewXACMLBTN.setEnabled(true); } else { getWindow().showNotification("Warning", "Could not determine document type for processing.", Window.Notification.TYPE_WARNING_MESSAGE); } } } }); retrieveBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Object rowId = table.getValue(); String decision = "Permit"; if (patientId.equals("PUI100015060013")) { PolicyEnforcementObject pObj = policyEngine.enforceResouce( AdminContext.getSessionAttributes().getPurposeOfUse(), "PSY", "DocumentRetrieveOut"); decision = pObj.getPdpDecision(); } if (decision.equals("Permit")) { if (rowId != null) { getDocument(); requestedService = "DocRetrieve"; System.out.println("CURRENT DOCUMENT SIZE: " + currentDocument.length()); Popover popover = getPopoverTextArea(currentDocument, "Document Retrieve Response"); popover.showRelativeTo(getNavigationBar()); } else { getWindow().showNotification("Warning", "No row selected, Please select document for retrieval.", Window.Notification.TYPE_WARNING_MESSAGE); } } else { getWindow().showNotification("Warning", "You do not have the necessary authorization privileges to perform this operation.", Window.Notification.TYPE_WARNING_MESSAGE); } } }); decryptDocBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (currentDocument.length() == 0) { getWindow().showNotification("Warning", "You must select and retrieve document first.", Window.Notification.TYPE_WARNING_MESSAGE); } else { try { String sOrg = AdminContext.getSessionAttributes().getSelectedOrg(); if (sOrg.equals("FEISystems")) { ihe.iti.xds_b._2007.RetrieveDocumentSetResponse xdsbRetrieveDocumentSetResponse = unmarshallFromXml( ihe.iti.xds_b._2007.RetrieveDocumentSetResponse.class, currentDocument); ihe.iti.xds_b._2007.RetrieveDocumentSetResponse.DocumentResponse documentResponse = xdsbRetrieveDocumentSetResponse .getDocumentResponse().get(0); if (docType.equals("Consult Notes")) { byte[] processDocBytes = documentResponse.getDocument(); decryptDocument = decryptDocumentExcludeElements(processDocBytes, keyD); } else { byte[] processDocBytes = documentResponse.getDocument(); decryptDocument = new String(processDocBytes); } } else { decryptDocument = currentDocument; } Popover popover = getPopoverLabel(convertXMLtoXHTML(decryptDocument), "Decrypted - Document Only"); popover.showRelativeTo(getNavigationBar()); } catch (Exception ex) { ex.printStackTrace(); } } } }); decryptDocMaskBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (currentDocument.length() == 0) { getWindow().showNotification("Warning", "You must select and retrieve document first.", Window.Notification.TYPE_WARNING_MESSAGE); } else { String decision = "Permit"; if (patientId.equals("PUI100015060013")) { PolicyEnforcementObject pObj = policyEngine.enforceResouce( AdminContext.getSessionAttributes().getPurposeOfUse(), "PSY", "DocumentEntryUnMask"); decision = pObj.getPdpDecision(); } if (decision.equals("Permit")) { try { ihe.iti.xds_b._2007.RetrieveDocumentSetResponse xdsbRetrieveDocumentSetResponse = unmarshallFromXml( ihe.iti.xds_b._2007.RetrieveDocumentSetResponse.class, currentDocument); ihe.iti.xds_b._2007.RetrieveDocumentSetResponse.DocumentResponse documentResponse = xdsbRetrieveDocumentSetResponse .getDocumentResponse().get(0); if (docType.equals("Consult Notes")) { byte[] processDocBytes = documentResponse.getDocument(); decryptDocument = decryptDocument(processDocBytes, keyD, keyM); } else { byte[] processDocBytes = documentResponse.getDocument(); decryptDocument = new String(processDocBytes); } Popover popover = getPopoverLabel(convertXMLtoXHTML(decryptDocument), "Decrypted - Document and Masked Entries"); popover.showRelativeTo(getNavigationBar()); } catch (Exception ex) { ex.printStackTrace(); } } else { getWindow().showNotification("Warning", "You do not have the necessary authorization privileges to perform this operation.", Window.Notification.TYPE_WARNING_MESSAGE); } } } }); viewHTMLBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (decryptDocument.length() == 0) { getWindow().showNotification("Warning", "You must select and retrieve document first, then view decrypted version, before attempting to transform it.", Window.Notification.TYPE_WARNING_MESSAGE); } else { String decision = "Permit"; if (patientId.equals("PUI100015060013")) { PolicyEnforcementObject pObj = policyEngine.enforceResouce( AdminContext.getSessionAttributes().getPurposeOfUse(), "PSY", "DocumentView"); decision = pObj.getPdpDecision(); } if (decision.equals("Permit")) { String sOrg = AdminContext.getSessionAttributes().getSelectedOrg(); if (sOrg.equals("FEISystems")) { getWindow().showNotification("Warning", disclosure, Window.Notification.TYPE_WARNING_MESSAGE); } String title = ""; if (docType.equals("Consult Notes")) { title = "Summary of Episode - C32"; } else if (docType.equals("Consent Notes")) { title = "CDA R2 Consent Directive"; } else { title = "Unknown Document Type"; } Popover popover = getPopoverLabel(getHTMLVersionOfCDA(decryptDocument), title); popover.showRelativeTo(getNavigationBar()); } else { getWindow().showNotification("Warning", "You do not have the necessary authorization privileges to perform this operation.", Window.Notification.TYPE_WARNING_MESSAGE); } } } }); viewPDFBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processPDFForViewing(); } }); viewXACMLBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processXACMLForViewing(); } }); viewSAMLBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processSAMLForViewing(); } }); viewMetaData.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processMetaDataForViewing(); } }); setContent(content); }
From source file:gov.va.ehtac.appsonfhir.ui.Tools.java
public Tools() { setCaption("Patient Tools"); final HorizontalButtonGroup hGroup = new HorizontalButtonGroup(); Button weightBTN = new Button("Weight Scale"); weightBTN.setIcon(FontAwesome.DELICIOUS); weightBTN.setWidth("310px"); Button heartRateBTN = new Button("Heart Rate"); heartRateBTN.setIcon(FontAwesome.HEART); heartRateBTN.setWidth("310px"); Button bloodPressureBTN = new Button("Blood Pressure"); bloodPressureBTN.setIcon(FontAwesome.HEART_O); bloodPressureBTN.setWidth("310px"); Button glucoseBTN = new Button("Diabetes Management"); glucoseBTN.setIcon(FontAwesome.FILE_CODE_O); glucoseBTN.setWidth("310px"); hGroup.addComponent(weightBTN);// w w w . j a v a 2 s. co m hGroup.addComponent(heartRateBTN); hGroup.addComponent(bloodPressureBTN); hGroup.addComponent(glucoseBTN); setContent(new CssLayout(hGroup)); }
From source file:info.magnolia.filesystembrowser.app.field.FileBrowserField.java
License:Open Source License
@Override protected Component initContent() { layout.setWidth("100%"); layout.addComponent(image);/*from w ww.j a va 2s . c o m*/ layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER); Button editButton = new Button("Edit", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { openMediaEditor(); } }); editButton.setWidth("100%"); layout.addComponent(editButton); layout.setExpandRatio(image, 1f); return layout; }
From source file:jp.primecloud.auto.ui.MyCloudManage.java
License:Open Source License
MyCloudManage(Application ap) { apl = ap;//from w w w . j a v a2s .co m // setIcon(Icons.EDITMINI.resource()); setCaption(ViewProperties.getCaption("window.myCloudManage")); setModal(true); setWidth("550px"); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true); // ? HorizontalLayout tbar = new HorizontalLayout(); tbar.setWidth("100%"); tbar.setSpacing(true); // ? Label tcaption = new Label(ViewProperties.getCaption("table.cloud")); tcaption.setWidth("300px"); tbar.addComponent(tcaption); tbar.setComponentAlignment(tcaption, Alignment.MIDDLE_LEFT); // Edit Button editButton = new Button(ViewProperties.getCaption("button.editCloud")); editButton.setDescription(ViewProperties.getCaption("description.editCloud")); editButton.setIcon(Icons.EDITMINI.resource()); editButton.setWidth("85px"); editButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.editButtonClick(event); } }); tbar.addComponent(editButton); tbar.setComponentAlignment(editButton, Alignment.BOTTOM_RIGHT); // Delete Button deleteButton = new Button(ViewProperties.getCaption("button.delete")); deleteButton.setDescription(ViewProperties.getCaption("description.delete")); deleteButton.setWidth("85px"); deleteButton.setIcon(Icons.DELETEMINI.resource()); deleteButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.deleteButtonClick(event); } }); tbar.addComponent(deleteButton); tbar.setComponentAlignment(deleteButton, Alignment.BOTTOM_RIGHT); tbar.setExpandRatio(tcaption, 10); layout.addComponent(tbar); // ? Label spacer1 = new Label(""); spacer1.setHeight("5px"); layout.addComponent(spacer1); // cloudTable = new CloudTable(); layout.addComponent(cloudTable); // ? Label spacer2 = new Label(""); spacer2.setHeight("7px"); layout.addComponent(spacer2); // ?? HorizontalLayout bbar = new HorizontalLayout(); bbar.setWidth("100%"); HorizontalLayout rlay = new HorizontalLayout(); rlay.setSpacing(true); // New Button addButton = new Button(ViewProperties.getCaption("button.newCloud")); addButton.setDescription(ViewProperties.getCaption("description.newCloud")); addButton.setIcon(Icons.ADD.resource()); addButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.addButtonClick(event); } }); bbar.addComponent(addButton); bbar.setComponentAlignment(addButton, Alignment.MIDDLE_LEFT); // Switch Button switchButton = new Button(ViewProperties.getCaption("button.switch")); switchButton.setDescription(ViewProperties.getCaption("description.mycloud.switch")); switchButton.setWidth("85px"); switchButton.setIcon(Icons.SELECTMINI.resource()); switchButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.switchButtonClick(event); } }); // [Enter]?switchButton switchButton.setClickShortcut(KeyCode.ENTER); switchButton.focus(); rlay.addComponent(switchButton); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.setWidth("85px"); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.close(); } }); rlay.addComponent(cancelButton); bbar.addComponent(rlay); bbar.setComponentAlignment(rlay, Alignment.MIDDLE_RIGHT); layout.addComponent(bbar); // ??? initData(); //???/? if (ViewContext.getPowerUser()) { addButton.setEnabled(true); deleteButton.setEnabled(true); editButton.setEnabled(true); //?????????????? if (ViewContext.getPowerUser() && !ViewContext.getPowerDefaultMaster().equals(ViewContext.getLoginUser())) { addButton.setEnabled(false); } } else if (ViewContext.getUserNo().equals(ViewContext.getLoginUser())) { addButton.setEnabled(true); deleteButton.setEnabled(true); editButton.setEnabled(true); } else { addButton.setEnabled(false); deleteButton.setEnabled(false); editButton.setEnabled(false); } // showClouds(); }
From source file:kn.uni.gis.ui.AdminWindow.java
License:Apache License
private Component loginComponent() { final VerticalLayout layout = new VerticalLayout(); final PasswordField passwordField = new PasswordField("Old Hunters Age"); passwordField.setWidth("-1px"); passwordField.setHeight("-1px"); passwordField.focus();//from w w w.j ava 2 s . c om Button button_2 = new Button(); button_2.setCaption("Login"); button_2.setImmediate(false); button_2.setWidth("-1px"); button_2.setHeight("-1px"); button_2.addListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (password.equals(passwordField.getValue())) { AdminWindow.this.removeComponent(layout); AdminWindow.this.addComponent(createTable()); } else { AdminWindow.this.showNotification("Wrong age!"); } } }); layout.addComponent(passwordField); layout.addComponent(button_2); layout.setComponentAlignment(passwordField, Alignment.TOP_CENTER); layout.setComponentAlignment(button_2, Alignment.BOTTOM_CENTER); return layout; }
From source file:kn.uni.gis.ui.GameApplication.java
License:Apache License
private Window createGameWindow() { tabsheet = new TabSheet(); tabsheet.setImmediate(true);/*from w ww .j a v a2 s. co m*/ tabsheet.setCloseHandler(new CloseHandler() { @Override public void onTabClose(TabSheet tabsheet, Component tabContent) { Game game = ((GameComposite) tabContent).getGame(); GameComposite remove = gameMap.remove(game); // closes the game and the running thread! remove.getLayer().handleApplicationClosedEvent(new ApplicationClosedEvent()); eventBus.unregister(remove); eventBus.unregister(remove.getLayer()); map.removeLayer(remove.getLayer()); tabsheet.removeComponent(tabContent); if (gameMap.isEmpty()) { pi.setVisible(false); } } }); final Window mywindow = new Window("Games"); mywindow.setPositionX(0); mywindow.setPositionY(0); mywindow.setHeight("50%"); mywindow.setWidth("25%"); VerticalLayout layout = new VerticalLayout(); HorizontalLayout lay = new HorizontalLayout(); final Button button_1 = new Button(); button_1.setCaption("Open Game"); button_1.setWidth("-1px"); button_1.setHeight("-1px"); button_1.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { final String id = textField_1.getValue().toString(); if (id.length() < 5) { window.showNotification("id must have at least 5 characters", Notification.TYPE_ERROR_MESSAGE); } else { String sql = String.format("select player_id,player_name,min(timestamp),max(timestamp) from %s" + " where id LIKE ? group by player_id, player_name", GisResource.FOX_HUNTER); final Game game = new Game(id); final PreparedStatement statement = geoUtil.getConn() .prepareStatement("select poly_geom,timestamp from " + GisResource.FOX_HUNTER + " where id LIKE ? and player_id=? and timestamp > ? order by timestamp LIMIT " + MAX_STATES_IN_MEM); try { geoUtil.getConn().executeSafeQuery(sql, new DoWithin() { @Override public void doIt(ResultSet executeQuery) throws SQLException { while (executeQuery.next()) { if (statement == null) { } String playerId = executeQuery.getString(1); Timestamp min = executeQuery.getTimestamp(3); Timestamp max = executeQuery.getTimestamp(4); game.addPlayer(playerId, executeQuery.getString(2), min, max, new TimingIterator(geoUtil, id, playerId, min.getTime(), statement)); } } }, id + "%"); } catch (SQLException e) { LOGGER.info("error on sql!", e); } game.finish(statement); if (!!!gameMap.containsKey(game)) { if (game.getStates().size() == 0) { window.showNotification("game not found!"); } else { LOGGER.info("received game info: {},{} ", game.getId(), game.getStates().size()); GameVectorLayer gameVectorLayer = new GameVectorLayer(GameApplication.this, eventBus, game, createColorMap(game)); final GameComposite gameComposite = new GameComposite(GameApplication.this, game, gameVectorLayer, eventBus); eventBus.register(gameComposite); eventBus.register(gameVectorLayer); map.addLayer(gameVectorLayer); gameMap.put(game, gameComposite); // Add the component to the tab sheet as a new tab. Tab addTab = tabsheet.addTab(gameComposite); addTab.setCaption(game.getId().substring(0, 5)); addTab.setClosable(true); pi.setVisible(true); // pl.get PlayerState playerState = game.getStates().get(game.getFox()).peek(); map.zoomToExtent(new Bounds(CPOINT_TO_POINT.apply(playerState.getPoint()))); } } } } private Map<Player, Integer> createColorMap(Game game) { Function<Double, Double> scale = HardTasks.scale(0, game.getStates().size()); ImmutableMap.Builder<Player, Integer> builder = ImmutableMap.builder(); int i = 0; for (Player play : game.getStates().keySet()) { builder.put(play, getColor(scale.apply((double) i++))); } return builder.build(); } private Integer getColor(double dob) { int toReturn = 0; toReturn = toReturn | 255 - (int) Math.round(255 * dob); toReturn = toReturn | (int) ((Math.round(255 * dob)) << 16); return toReturn; // return (int) (10000 + 35000 * dob + 5000 * dob + 1000 * dob + // 5 * dob); } }); Button button_2 = new Button(); button_2.setCaption("All seeing Hunter"); button_2.setImmediate(false); button_2.setWidth("-1px"); button_2.setHeight("-1px"); button_2.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (adminWindow == null) { adminWindow = new AdminWindow(password, geoUtil, new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { textField_1.setValue(event.getItemId().toString()); mywindow.bringToFront(); button_1.focus(); } }); window.addWindow(adminWindow); adminWindow.setWidth("30%"); adminWindow.setHeight("40%"); adminWindow.addListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { adminWindow = null; } }); } } }); lay.addComponent(button_1); textField_1 = new TextField(); textField_1.setImmediate(false); textField_1.setWidth("-1px"); textField_1.setHeight("-1px"); lay.addComponent(textField_1); lay.addComponent(button_2); lay.addComponent(pi); lay.setComponentAlignment(pi, Alignment.TOP_RIGHT); layout.addComponent(lay); layout.addComponent(tabsheet); mywindow.addComponent(layout); mywindow.setClosable(false); /* Add the window inside the main window. */ return mywindow; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
public void addTab(final VerticalLayout menu, final Component content, final String caption) { if (content == null || caption == null) { throw new NullPointerException("Arguments may not be null"); }//from ww w . j a v a 2s.co m final Button button = new NativeButton(caption, tabChangeListener); button.setWidth("100%"); menu.addComponent(button); buttonComponentMap.put(button, content); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Button createImageFixedHeight() { final Button button = new Button("zen"); button.setWidth("100%"); button.setHeight("50px"); return button; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getButtonPreviews() { Layout grid = getPreviewLayout("Buttons"); Button button = new Button("Button"); grid.addComponent(button);//from ww w . j ava 2 s.c o m button = new Button("Default"); button.setStyleName("default"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); grid.addComponent(button); button = new Button("Small Default"); button.setStyleName("small default"); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); grid.addComponent(button); button = new Button("Disabled"); button.setEnabled(false); grid.addComponent(button); button = new Button("Disabled default"); button.setEnabled(false); button.setStyleName("default"); grid.addComponent(button); button = new Button("Link style"); button.setStyleName(BaseTheme.BUTTON_LINK); grid.addComponent(button); button = new Button("Disabled link"); button.setStyleName(BaseTheme.BUTTON_LINK); button.setEnabled(false); grid.addComponent(button); button = new Button("120px overflows out of the button"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); button.setWidth("120px"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); button.setIcon(new ThemeResource("../runo/icons/32/document-txt.png")); grid.addComponent(button); button = new Button("Big link"); button.setStyleName(BaseTheme.BUTTON_LINK + " big"); button.setIcon(new ThemeResource("../runo/icons/32/document.png")); grid.addComponent(button); button = new Button("Borderless"); button.setStyleName("borderless"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Borderless icon on top"); button.setStyleName("borderless icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Icon on top"); button.setStyleName("icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/users.png")); grid.addComponent(button); button = new Button("Wide Default"); button.setStyleName("wide default"); grid.addComponent(button); button = new Button("Wide"); button.setStyleName("wide"); grid.addComponent(button); button = new Button("Tall"); button.setStyleName("tall"); grid.addComponent(button); button = new Button("Wide, Tall & Big"); button.setStyleName("wide tall big"); grid.addComponent(button); button = new Button("Icon on right"); button.setStyleName("icon-on-right"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big icon"); button.setStyleName("icon-on-right big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Toggle (down)"); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("down"); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); button = new Button(); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("icon-only"); button.addStyleName("down"); button.setIcon(new ThemeResource("../runo/icons/16/user.png")); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); Link l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); grid.addComponent(l); l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); l.setIcon(new ThemeResource("../runo/icons/32/globe.png")); grid.addComponent(l); return grid; }
From source file:my.vaadin.profile.MainLayout.java
public MainLayout() { Label header = new Label("Student"); header.addStyleName("colored"); header.addStyleName("h2"); //header.addStyleName("alignRight"); header.setSizeUndefined();/* w ww . j a v a 2 s . c o m*/ Button signOut = new Button("Sign-Out"); signOut.setSizeUndefined(); signOut.addStyleName("small"); Label menu = new Label("Menu"); menu.addStyleName("colored"); menu.addStyleName("h2"); upperSection.setSizeFull(); innerUpperSection.addComponent(header); innerUpperSection.addComponent(signOut); innerUpperSection.setExpandRatio(signOut, 1); innerUpperSection.setSpacing(true); innerUpperSection.setComponentAlignment(signOut, Alignment.MIDDLE_RIGHT); upperSection.addComponent(innerUpperSection); upperSection.setMargin(new MarginInfo(false, true, false, false)); upperSection.setComponentAlignment(innerUpperSection, Alignment.TOP_RIGHT); upperSection.addStyleName("borderBottom"); menuTitle.addComponent(menu); menuLayout.addComponent(menuTitle); menuLayout.setWidth("100%"); menuLayout.setComponentAlignment(menuTitle, Alignment.MIDDLE_CENTER); //menuLayout.addStyleName("whiteStuff"); // menuLayout.setExpandRatio(, 1); //contentLayout.addComponent(); lowerSection.addComponent(menuLayout); lowerSection.addComponent(contentLayout); addComponent(upperSection); addComponent(lowerSection); upperSection.setHeight(4, UNITS_EM); //showBorders(); setSizeFull(); lowerSection.setSizeFull(); //menuLayout.setSizeFull(); contentLayout.setSizeFull(); setExpandRatio(lowerSection, 1); lowerSection.setSplitPosition(15); Button lolol = new Button("hi"); menuLayout.addComponent(lolol); lolol.setWidth("100%"); lolol.setStyleName("borderless"); }