List of usage examples for com.vaadin.ui Image setId
@Override public void setId(String id)
From source file:com.mycompany.exodious.login.java
public login() { this.setId("loginPanel"); this.setSpacing(true); Image logo = new Image(); logo.setId("logo"); logo.setSource(slikaLogo);//from w w w . j av a 2 s .c o m logo.setHeight("18em"); logo.setWidth("30em"); Label welcome = new Label("Welcome, please login"); welcome.setId("welcome"); TextField username = new TextField("Your ID"); PasswordField password = new PasswordField("Password"); Button submit = new Button("Login"); submit.setIcon(FontAwesome.SIGN_IN); submit.addStyleName(ValoTheme.BUTTON_PRIMARY); submit.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { } }); addComponents(logo, welcome, username, password, submit); setComponentAlignment(logo, Alignment.MIDDLE_CENTER); setComponentAlignment(welcome, Alignment.MIDDLE_CENTER); setComponentAlignment(username, Alignment.MIDDLE_CENTER); setComponentAlignment(password, Alignment.MIDDLE_CENTER); setComponentAlignment(submit, Alignment.MIDDLE_CENTER); }
From source file:de.kaiserpfalzEdv.office.ui.web.widgets.about.AboutPanel.java
License:Apache License
@PostConstruct public void init() { Image logo = new Image(null, new ThemeResource("../images/lichti-wappen.png")); logo.setId("about-logo"); logo.setAlternateText("Logo: Kaiserpfalz EDV-Service"); logo.setWidth(150f, Unit.PIXELS);/*from www . j av a2 s .c o m*/ logo.setHeight(170f, Unit.PIXELS); logo.setCaption("Kaiserpfalz EDV-Service"); addComponent(logo); setComponentAlignment(logo, Alignment.MIDDLE_CENTER); Label name = new Label( "<div style='text-align: center;'><b>" + application.get(ApplicationMetaData.APPLICATION_NAME) + "</b>" + "<br/>" + "<i><small>Version " + application.get(ApplicationMetaData.APPLICATION_VERSION) + "</small></i></div>", ContentMode.HTML); name.setWidth(200f, Unit.PIXELS); addComponent(name); setComponentAlignment(name, Alignment.MIDDLE_CENTER); addComponent(new Label("")); addComponent(new Label("License: " + license.getId())); addComponent(new Label("Licensee: " + license.getLicensee())); addComponent(new Label("")); addComponent(new Label("Issued: " + license.getIssueDate())); addComponent(new Label("Issuer: " + license.getIssuer())); addComponent(new Label("")); addComponent(new Label("Valid (Time): " + license.getStart() + " - " + license.getExpiry())); addComponent(new Label("Valid (Version): " + license.getVersionRange().getStart() + " - " + license.getVersionRange().getEnd())); LOG.trace("Initialized: {}", this); LOG.trace(" application: {}", application); LOG.trace(" license: {}", license); }
From source file:edu.kit.dama.ui.admin.LoginInformationBar.java
License:Apache License
/** * Build a menu item and return it./*from w ww.j a v a 2s . c om*/ * * @param pId The item id. * @param pImage The item image. * * @return The item. */ private Image buildMenuItem(String pId, ThemeResource pImage) { Image item = new Image(null, pImage); item.setId(pId); item.addStyleName("shadow"); item.addStyleName("menu"); item.addStyleName("myclickablecomponent"); item.setWidth("70px"); new HelpExtension().extend(item); return item; }
From source file:edu.kit.dama.ui.admin.MainControlPanel.java
License:Apache License
/** * Create a new cell for the UI. Each cell contains an image located in the * provided resource and a help label for the cell adverse to it. * Furthermore, a style is provided which can be 'help-left' or 'help-right' * depending on which side the help text should be aligned (help in left col * -> align right)./* www. j a v a 2 s.c o m*/ * * @param pResourceString The image resource string. * @param The alignment of the image (TOP_LEFT or TOP_RIGHT, depending on * the column) * @param cellNumber The cell number (0-3) counting from top left to bottom * right * @param pHelp The help string which may contain HTML tags. * @param pStyle The help label style ('help-left' or 'help-right'). * * @return The cell layout. */ private VerticalLayout createCell(String pResourceString, Alignment pAlignment, int cellNumber, String pHelp, String pStyle) { final String cellHeight = "132px"; //create the cell image Image cellImage = new Image(null, new ThemeResource(pResourceString)); cellImage.addStyleName("border"); //create the cell image wrapper, which provides the shadow and this show/hide functionality VerticalLayout imageWrapper = new VerticalLayout(cellImage); imageWrapper.addComponent(cellImage); imageWrapper.setComponentAlignment(cellImage, Alignment.MIDDLE_CENTER); imageWrapper.setWidth(cellHeight); imageWrapper.setHeight(cellHeight); imageWrapper.addStyleName("shadow"); imageWrapper.addStyleName("visible"); //help label for the cell adverse to the current cell Label oppositeCellHelp = new Label(pHelp, ContentMode.HTML); oppositeCellHelp.addStyleName(pStyle); oppositeCellHelp.setSizeFull(); oppositeCellHelp.addStyleName("invisible"); oppositeCellHelp.setHeight(cellHeight); //the cell layout containing image and help label VerticalLayout cell = new VerticalLayout(); cell.addComponent(imageWrapper); cell.setComponentAlignment(imageWrapper, pAlignment); cell.setMargin(true); cell.addComponent(oppositeCellHelp); cell.setComponentAlignment(oppositeCellHelp, Alignment.MIDDLE_CENTER); //define component ids depending on the provided cell number //--------- //| 0 | 1 | //| 2 | 3 | //--------- //Each cell gets the id 'image<cellNumber>' //The currently created wrapper and help label are getting the cellId of the adverse cell (0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2). //These ids are used then by edu.kit.dama.ui.admin.client.HelpConnector to show/hide elements on mouse over. switch (cellNumber) { case 0: cellImage.setId("image0"); //this cell contains the help for cell 1 imageWrapper.setId("image1_wrapper"); oppositeCellHelp.setId("image1_help"); break; case 1: cellImage.setId("image1"); //this cell contains the help for cell 0 imageWrapper.setId("image0_wrapper"); oppositeCellHelp.setId("image0_help"); break; case 2: cellImage.setId("image2"); //this cell contains the help for cell 3 imageWrapper.setId("image3_wrapper"); oppositeCellHelp.setId("image3_help"); break; case 3: cellImage.setId("image3"); //this cell contains the help for cell 2 imageWrapper.setId("image2_wrapper"); oppositeCellHelp.setId("image2_help"); break; } //link the HelpExtension to the image new HelpExtension().extend(cellImage); return cell; }