List of usage examples for com.vaadin.ui Image setWidth
@Override public void setWidth(String width)
From source file:annis.gui.ReportBugWindow.java
License:Apache License
private void addScreenshotPreview(Layout layout, final byte[] rawImage, String mimeType) { StreamResource res = new StreamResource(new ScreenDumpStreamSource(rawImage), "screendump_" + UUID.randomUUID().toString() + ".png"); res.setMIMEType(mimeType);//from ww w .j a v a2 s.c om final Image imgScreenshot = new Image("Attached screenshot", res); imgScreenshot.setAlternateText( "Screenshot of the ANNIS browser window, " + "no other window or part of the desktop is captured."); imgScreenshot.setVisible(false); imgScreenshot.setWidth("100%"); Button btShowScreenshot = new Button("Show attached screenshot", new ShowScreenshotClickListener(imgScreenshot)); btShowScreenshot.addStyleName(BaseTheme.BUTTON_LINK); btShowScreenshot.setIcon(FontAwesome.PLUS_SQUARE_O); layout.addComponent(btShowScreenshot); layout.addComponent(imgScreenshot); }
From source file:com.cerebro.gorgone.landingpage.SignInWindow.java
private Component setFirstStep() { VerticalLayout firstStep = new VerticalLayout(); firstStep.setMargin(true);//from www. jav a2 s . com // Body HorizontalLayout body = new HorizontalLayout(); FormLayout datiIniziali = new FormLayout(); TextField nomePG = new TextField("Nome del Personaggio"); nomePG.setRequired(true); TextField cognomePG = new TextField("Cognome del Personaggio"); cognomePG.setRequired(true); OptionGroup sessoPG = new OptionGroup("Sesso del Personaggio"); sessoPG.setRequired(true); sessoPG.addItems("Maschio", "Femmina"); ComboBox razzaPG = new ComboBox("Razza"); razzaPG.setRequired(true); Slider age = new Slider("Et"); age.setImmediate(true); age.setWidth("200px"); age.setVisible(false); HorizontalLayout ageDescription = new HorizontalLayout(); ageDescription.setHeight("250px"); Label ageText = new Label("Valore dell'et: "); Label ageValue = new Label(age.getValue().toString()); Label periodoVita = new Label(""); ageDescription.addComponents(ageText, ageValue, periodoVita); age.addValueChangeListener((Property.ValueChangeEvent event) -> { System.out.println("Valore: " + age.getValue().toString()); ageValue.setValue(age.getValue().toString()); Double value = (100 * (age.getValue()) / (age.getMax())); if (value < 14) { periodoVita.setValue("Bambino"); } else if (value > 14 && value < 24) { periodoVita.setValue("Adolescenza"); } else if (value > 24 && value < 73) { periodoVita.setValue("Et adulta"); } else if (value > 73) { periodoVita.setValue("Et anziana"); } }); ageDescription.addComponents(ageText, ageValue, periodoVita); ageDescription.setVisible(false); datiIniziali.addComponents(nomePG, cognomePG, sessoPG, razzaPG, age, ageDescription); Panel descrizioneRazza = new Panel(); CssLayout descrizioneRazzaContent = new CssLayout(); descrizioneRazza.setWidth("400px"); descrizioneRazza.setHeight("500px"); descrizioneRazza.setContent(descrizioneRazzaContent); // Dettagli di popolazione e comportamento ComboBox TableQuery tq_races = new TableQuery(DatabaseTables.RACES_TABLE, connPool); tq_races.setVersionColumn(DatabaseTables.RACES_VERSION); SQLContainer container_races = null; try { container_races = new SQLContainer(tq_races); } catch (Exception ex) { logger.error(ex.getMessage()); } razzaPG.setContainerDataSource(container_races); razzaPG.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); razzaPG.setItemCaptionPropertyId(DatabaseTables.RACES_NAME); razzaPG.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (razzaPG.getValue() != null) { logger.info("Razza selezionata: " + razzaPG.getValue()); age.setVisible(true); ageDescription.setVisible(true); descrizioneRazzaContent.removeAllComponents(); Item item = razzaPG.getContainerDataSource().getItem(razzaPG.getValue()); race = (String) item.getItemProperty(DatabaseTables.RACES_NAME).getValue(); Label nameRace = new Label(race); FileResource imageSrc = new FileResource( new File(MyUI.basePath + item.getItemProperty(DatabaseTables.RACES_IMAGE).getValue())); Image imageRace = new Image(null, imageSrc); imageRace.setWidth("200px"); Label descriptionRace = new Label( (String) item.getItemProperty(DatabaseTables.RACES_DESCRIPTION).getValue(), ContentMode.HTML); min_age = (int) item.getItemProperty(DatabaseTables.RACES_MIN_AGE).getValue(); max_age = (int) item.getItemProperty(DatabaseTables.RACES_MAX_AGE).getValue(); age.setMin(min_age); age.setMax(max_age); strenght = (int) item.getItemProperty(DatabaseTables.RACES_STRENGHT).getValue(); resistance = (int) item.getItemProperty(DatabaseTables.RACES_RESISTANCE).getValue(); agility = (int) item.getItemProperty(DatabaseTables.RACES_AGILITY).getValue(); intelligence = (int) item.getItemProperty(DatabaseTables.RACES_INTELLIGENCE).getValue(); wisdom = (int) item.getItemProperty(DatabaseTables.RACES_WISDOM).getValue(); charm = (int) item.getItemProperty(DatabaseTables.RACES_CHARM).getValue(); Label min_ageL = new Label("Et minima: " + min_age); Label max_ageL = new Label("Et masima " + max_age); // Panel levels = new Panel(); // VerticalLayout levelsContent = new VerticalLayout(); // levels.setContent(levelsContent); // Label strenghtL = new Label("Forza: " + strenght); // levelsContent.addComponents(strenghtL); String levelTable = "<table><tr><td>Forza</td><td>Resistenza</td><td>Agilit</td><td>Intelligenza</td>" + "<td>Saggezza</td><td>Carisma</td></tr><tr>" + "<td>" + strenght + "</td>" + "<td>" + resistance + "</td>" + "<td>" + agility + "</td>" + "<td>" + intelligence + "</td>" + "<td>" + wisdom + "</td>" + "<td>" + charm + "</td>" + "</tr></table>"; Label levels = new Label(levelTable, ContentMode.HTML); descrizioneRazzaContent.addComponents(nameRace, imageRace, descriptionRace, min_ageL, max_ageL, levels); } } }); body.addComponents(datiIniziali, descrizioneRazza); CssLayout footer = new CssLayout(); Button next = new Button("Avanti ->"); next.addClickListener((Button.ClickEvent event) -> { user.setNomePG(nomePG.getValue()); user.setCognomePG(cognomePG.getValue()); user.setSessoPG(sessoPG.getValue().toString()); user.setRazzaPG(race); user.setEtaPG(age.getValue().toString()); user.setForzaPG(strenght); user.setResistenzaPG(resistance); user.setAgilitaPG(agility); user.setIntelligenzaPG(intelligence); user.setSaggezzaPG(wisdom); user.setCarismaPG(charm); this.setContent(setSecondStep()); }); footer.addComponents(next, createCancelButton()); firstStep.addComponents(setHeader("2/4"), body, footer); return firstStep; }
From source file:com.cerebro.gorgone.landingpage.SignInWindow.java
private Component setSecondStep() { VerticalLayout secondStep = new VerticalLayout(); HorizontalLayout body = new HorizontalLayout(); Panel sx = new Panel(); VerticalLayout sxContent = new VerticalLayout(); sx.setContent(sxContent);//from w w w . j a v a 2s .co m Label welcome = null; if (user.getSessoPG().equals("Maschio")) { welcome = new Label("Benvenuto: " + user.getNomePG() + "!"); } else if (user.getSessoPG().equals("Femmina")) { welcome = new Label("Benvenuta: " + user.getNomePG() + "!"); } ComboBox carrieraPG = new ComboBox("Scegli la tua carriera:"); carrieraPG.isRequired(); Panel careerDescription = new Panel(); CssLayout careerDescrContent = new CssLayout(); careerDescription.setContent(careerDescrContent); sxContent.addComponents(welcome, carrieraPG, careerDescription); // Dettagli di popolazione e comportamento ComboBox TableQuery tq_career = new TableQuery(DatabaseTables.CAREER_TABLE, connPool); tq_career.setVersionColumn(DatabaseTables.CAREER_VERSION); SQLContainer container_career = null; try { container_career = new SQLContainer(tq_career); } catch (Exception ex) { logger.error(ex.getMessage()); } carrieraPG.setContainerDataSource(container_career); carrieraPG.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); carrieraPG.setItemCaptionPropertyId(DatabaseTables.CAREER_NAME); carrieraPG.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (carrieraPG.getValue() != null) { logger.info("Carriera: " + carrieraPG.getValue().toString()); careerDescrContent.removeAllComponents(); Item item = (Item) carrieraPG.getContainerDataSource().getItem(carrieraPG.getValue()); career = (String) item.getItemProperty(DatabaseTables.CAREER_NAME).getValue(); Label careerName = new Label(career); FileResource imageSrc = new FileResource( new File(MyUI.basePath + item.getItemProperty(DatabaseTables.CAREER_IMAGE).getValue())); Image imageCareer = new Image(null, imageSrc); imageCareer.setWidth("200px"); Label careerDescription = new Label(item.getItemProperty(DatabaseTables.CAREER_DESCRIPTION), ContentMode.HTML); strenght_car = (int) item.getItemProperty(DatabaseTables.CAREER_STRENGTH).getValue(); resistance_car = (int) item.getItemProperty(DatabaseTables.CAREER_RESISTANCE).getValue(); agility_car = (int) item.getItemProperty(DatabaseTables.CAREER_AGILITY).getValue(); intelligence_car = (int) item.getItemProperty(DatabaseTables.CAREER_INTELLIGENCE).getValue(); wisdom_car = (int) item.getItemProperty(DatabaseTables.CAREER_WISDOM).getValue(); charm_car = (int) item.getItemProperty(DatabaseTables.CAREER_CHARM).getValue(); String modsTable = "<table><tr><td>Forza</td><td>Resistenza</td><td>Agilit</td><td>Intelligenza</td>" + "<td>Saggezza</td><td>Carisma</td></tr><tr>" + "<td>" + strenght_car + "</td>" + "<td>" + resistance_car + "</td>" + "<td>" + agility_car + "</td>" + "<td>" + intelligence_car + "</td>" + "<td>" + wisdom_car + "</td>" + "<td>" + charm_car + "</td>" + "</tr></table>"; Label mods = new Label(modsTable, ContentMode.HTML); careerDescrContent.addComponents(careerName, imageCareer, careerDescription, mods); } } }); Panel dx = new Panel(); VerticalLayout dxContent = new VerticalLayout(); dx.setContent(dxContent); ComboBox orientamentoPG = new ComboBox("Scegli il tuo orientamento:"); orientamentoPG.isRequired(); Panel orientamentoDescription = new Panel(); CssLayout orientamentoDescrContent = new CssLayout(); orientamentoDescription.setContent(orientamentoDescrContent); dxContent.addComponents(orientamentoPG, orientamentoDescription); // Dettagli di popolazione e comportamento ComboBox TableQuery tq_orientamento = new TableQuery(DatabaseTables.MORALCODE_TABLE, connPool); tq_orientamento.setVersionColumn(DatabaseTables.MORALCODE_VERSION); SQLContainer container_orientamento = null; try { container_orientamento = new SQLContainer(tq_orientamento); } catch (Exception ex) { logger.error(ex.getMessage()); } orientamentoPG.setContainerDataSource(container_orientamento); orientamentoPG.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); orientamentoPG.setItemCaptionPropertyId(DatabaseTables.MORALCODE_TENDENCY); orientamentoPG.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (orientamentoPG.getValue() != null) { logger.info("Orientamento: " + orientamentoPG.getValue().toString()); orientamentoDescrContent.removeAllComponents(); Item item = (Item) orientamentoPG.getContainerDataSource().getItem(orientamentoPG.getValue()); moralCode = (String) item.getItemProperty(DatabaseTables.MORALCODE_TENDENCY).getValue(); Label orientamentoName = new Label(moralCode); FileResource imageSrc = new FileResource(new File( MyUI.basePath + item.getItemProperty(DatabaseTables.MORALCODE_IMAGE).getValue())); Image imageTendency = new Image(null, imageSrc); imageTendency.setWidth("200px"); Label orientamentoDescription = new Label( item.getItemProperty(DatabaseTables.MORALCODE_DESCRIPTION), ContentMode.HTML); orientamentoDescrContent.addComponents(orientamentoName, imageTendency, orientamentoDescription); } } }); body.addComponents(sx, dx); CssLayout footer = new CssLayout(); Button next = new Button("Avanti ->"); next.addClickListener((Button.ClickEvent event) -> { user.setCarrieraPG(career); // Gestire modificatori user.setForzaPG(user.getForzaPG() + strenght_car); user.setResistenzaPG(user.getResistenzaPG() + resistance_car); user.setAgilitaPG(user.getAgilitaPG() + agility_car); user.setIntelligenzaPG(user.getIntelligenzaPG() + intelligence_car); user.setSaggezzaPG(user.getSaggezzaPG() + wisdom_car); user.setCarismaPG(user.getCarismaPG() + charm_car); user.setOrientamentoPG(moralCode); this.setContent(setThirdStep()); }); footer.addComponents(next, createCancelButton()); secondStep.addComponents(setHeader("3/4"), body, footer); return secondStep; }
From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); HorizontalLayout attachmentRow = new HorizontalLayout(); attachmentRow.setStyleName("attachment-row"); attachmentRow.setWidth("100%"); attachmentRow.setSpacing(true);//from w w w . j a va2 s. c o m attachmentRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setHeight("40px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentRow.addComponent(thumbnailWrap); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); } if (MimeTypesUtil.isImageType(docName)) { Button b = new Button(attachment.getTitle(), new Button.ClickListener() { private static final long serialVersionUID = -1713187920922886934L; @Override public void buttonClick(Button.ClickEvent event) { AttachmentPreviewView previewView = new AttachmentPreviewView(VaadinResourceManager .getResourceManager().getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE)); EventBusFactory.getInstance().post(new ShellEvent.PushView(this, previewView)); } }); b.setWidth("100%"); attachmentRow.addComponent(b); attachmentRow.setExpandRatio(b, 1.0f); } else { Label l = new Label(attachment.getTitle()); l.setWidth("100%"); attachmentRow.addComponent(l); attachmentRow.setExpandRatio(l, 1.0f); } return attachmentRow; }
From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentFieldRow(final Content attachment, Button.ClickListener additionalListener) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }/* w w w . j av a 2 s .c o m*/ final HorizontalLayout attachmentLayout = new HorizontalLayout(); attachmentLayout.setSpacing(true); attachmentLayout.setStyleName("attachment-row"); attachmentLayout.setWidth("100%"); attachmentLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setHeight("40px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap); Label attachmentLink = new Label(docName); attachmentLayout.addComponent(attachmentLink); attachmentLayout.setExpandRatio(attachmentLink, 1.0f); Button removeAttachment = new Button( "<span aria-hidden=\"true\" data-icon=\"" + IconConstants.DELETE + "\"></span>", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialog.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.CloseListener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ResourceService attachmentService = ApplicationContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); if (additionalListener != null) { removeAttachment.addClickListener(additionalListener); } removeAttachment.setHtmlContentAllowed(true); removeAttachment.setStyleName("link"); attachmentLayout.addComponent(removeAttachment); return attachmentLayout; }
From source file:com.esofthead.mycollab.vaadin.ui.AttachmentDisplayComponent.java
License:Open Source License
public static Component constructAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }// w w w .j av a 2 s . co m final AbsoluteLayout attachmentLayout = new AbsoluteLayout(); attachmentLayout.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentLayout.setHeight(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT); attachmentLayout.setStyleName("attachment-block"); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setSizeFull(); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setDescription(docName); thumbnail.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;"); if (MimeTypesUtil.isImageType(docName)) { thumbnail.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = -2853211588120500523L; @Override public void click(MouseEvents.ClickEvent event) { Resource previewResource = VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE); UI.getCurrent().addWindow(new AttachmentPreviewWindow(previewResource)); } }); } CssLayout attachmentNameWrap = new CssLayout(); attachmentNameWrap.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentNameWrap.setStyleName("attachment-name-wrap"); Label attachmentName = new Label(StringUtils.trim(docName, 60, true)); attachmentName.setStyleName("attachment-name"); attachmentNameWrap.addComponent(attachmentName); attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;"); Button trashBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ResourceService attachmentService = ApplicationContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); trashBtn.setIcon(FontAwesome.TRASH_O); trashBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;"); Button downloadBtn = new Button(); FileDownloader fileDownloader = new FileDownloader( VaadinResourceManager.getResourceManager().getStreamResource(attachment.getPath())); fileDownloader.extend(downloadBtn); downloadBtn.setIcon(FontAwesome.DOWNLOAD); downloadBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;"); return attachmentLayout; }
From source file:com.foc.vaadin.gui.components.FVImageField.java
License:Apache License
public Image resizeImage(Image image, int maxWidth, int maxHeight) { if (image != null) { double ratio = getRatio(image, maxWidth, maxHeight); String newHeight = Integer.toString((int) (image.getHeight() * ratio)); String newWidth = Integer.toString((int) (image.getWidth() * ratio)); image.setWidth(newWidth + "px"); image.setHeight(newHeight + "px"); setWidth(newWidth + "px"); setHeight(newHeight + "px"); }//from w w w . ja va 2s.co m return image; }
From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java
License:Apache License
private void createFooterSideBar() { VerticalLayout verticalLayout = super.getView(); sideBarFooter.setSizeUndefined();// www . ja va 2 s.c o m sideBarFooter.addStyleName("user"); Image profilePic = new Image(null, new ThemeResource("img/profile-pic.png")); profilePic.setWidth("34px"); sideBarFooter.addComponent(profilePic); Label userName = new Label("MOHELLEBI ATAF"); userName.setSizeUndefined(); sideBarFooter.addComponent(userName); Command cmd = new Command() { @Override public void menuSelected(MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }; MenuBar settings = new MenuBar(); MenuItem settingsMenu = settings.addItem("", null); settingsMenu.setStyleName("icon-cog"); settingsMenu.addItem("Settings", cmd); settingsMenu.addItem("Preferences", cmd); settingsMenu.addSeparator(); settingsMenu.addItem("My Account", cmd); sideBarFooter.addComponent(settings); Button exit = new NativeButton("Exit"); exit.addStyleName("icon-cancel"); exit.setDescription("Sign Out"); sideBarFooter.addComponent(exit); exit.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { } }); verticalLayout.addComponent(sideBarFooter); }
From source file:com.hack23.cia.web.impl.ui.application.views.common.AbstractView.java
License:Apache License
/** * Creates the basic layout with panel and footer. * * @param panelName// w w w.j a va2 s .c o m * the panel name */ protected final void createBasicLayoutWithPanelAndFooter(final String panelName) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(100, Unit.PERCENTAGE); final VerticalLayout pageModeContent = new VerticalLayout(); pageModeContent.setMargin(true); pageModeContent.setSpacing(true); pageModeContent.setWidth(100, Unit.PERCENTAGE); pageModeContent.setHeight(100, Unit.PERCENTAGE); layout.addComponent(pageModeContent); final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png"); final Image ciaLogoImage = new Image(null, ciaLogoResource); final HorizontalLayout topHeader = new HorizontalLayout(); topHeader.addComponent(ciaLogoImage); ciaLogoImage.setWidth("75px"); ciaLogoImage.setHeight("75px"); topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL); final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout(); final Label titleLabel = new Label("Citizen Intelligence Agency"); titleLabel.setStyleName("Header"); topTitleHeadertPanel.addComponent(titleLabel); topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT); final Label sloganLabel = new Label("// Tracking politicians like bugs!"); sloganLabel.setStyleName("HeaderSlogan"); topTitleHeadertPanel.addComponent(sloganLabel); topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT); topHeader.addComponent(topTitleHeadertPanel); topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID); topHeaderRightPanel.removeAllComponents(); topHeader.addComponent(topHeaderRightPanel); topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT); topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE); if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) { final Link userHomePageLink = pageLinkFactory.createUserHomeViewPageLink(); topHeaderRightPanel.addComponent(userHomePageLink); topHeaderRightPanel.setComponentAlignment(userHomePageLink, Alignment.MIDDLE_RIGHT); final Button logoutButton = new Button(LOGOUT, FontAwesome.SIGN_OUT); final LogoutRequest logoutRequest = new LogoutRequest(); logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); logoutButton.addClickListener(new LogoutClickListener(logoutRequest, applicationManager)); topHeaderRightPanel.addComponent(logoutButton); topHeaderRightPanel.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT); } else { final Link createRegisterPageLink = pageLinkFactory.createRegisterPageLink(); topHeaderRightPanel.addComponent(createRegisterPageLink); topHeaderRightPanel.setComponentAlignment(createRegisterPageLink, Alignment.MIDDLE_RIGHT); final Link createLoginPageLink = pageLinkFactory.createLoginPageLink(); topHeaderRightPanel.addComponent(createLoginPageLink); topHeaderRightPanel.setComponentAlignment(createLoginPageLink, Alignment.MIDDLE_RIGHT); } topHeaderRightPanel.setWidth("100%"); topHeaderRightPanel.setHeight("60px"); topHeader.setWidth("100%"); topHeader.setHeight("60px"); pageModeContent.addComponent(topHeader); pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER); pageModeContent.addComponent(getBarmenu()); pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER); panel = new Panel(panelName); panel.setSizeFull(); pageModeContent.addComponent(panel); pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE); pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink()); setContent(layout); setWidth(100, Unit.PERCENTAGE); setHeight(100, Unit.PERCENTAGE); setSizeFull(); }
From source file:com.klwork.explorer.ui.business.social.QQWeiboDisplayPage.java
License:Apache License
/** * //from w w w.j a va 2 s .c o m */ @Override public Image initRetweetPic(final SocialUserWeibo orginWeibo) { // Image image = currentImage(orginWeibo.getOriginalPic(), null, "/460"); if (image != null) { image.setHeight("120px"); image.setWidth("120px"); } return image; }