Example usage for com.vaadin.ui Image Image

List of usage examples for com.vaadin.ui Image Image

Introduction

In this page you can find the example usage for com.vaadin.ui Image Image.

Prototype

public Image(String caption, Resource source) 

Source Link

Document

Creates a new Image whose contents is loaded from given resource.

Usage

From source file:com.cerebro.gorgone.landingpage.SignInWindow.java

private Component setFirstStep() {
    VerticalLayout firstStep = new VerticalLayout();
    firstStep.setMargin(true);//from www  .ja v  a 2  s  .c  o m
    // 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);/* w  w  w  .  j  a v a 2 s  . c om*/
    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.cerebro.provevaadin.Equipment.java

public Equipment() {
    GridLayout contentSx = new GridLayout(15, 18);
    contentSx.setId("equip_body");
    contentSx.setHeight("600px");
    contentSx.setWidth("300px");

    FileResource helmetFile = new FileResource(new File(basepath + "red.png"));
    Image helmet = new Image("Helmet", helmetFile);
    helmet.setHeight("100px");
    contentSx.addComponent(helmet, 8, 0);

    sinistra.setContent(contentSx);//from w ww  . j  a v a2 s.  com
    //        root.setWidth("300px");
    //        root.setHeight("600px");
    //        
    //        FileResource bodyMaleFile = new FileResource(new File(basepath + "body-male.jpg"));
    //        FileResource helmetFile = new FileResource(new File(basepath + "red.png"));
    //        
    //        Image image = new Image("MaleBody", bodyMaleFile);
    //        image.setWidth(root.getWidth(), root.getWidthUnits());
    //        Image helmet = new Image("Helmet", helmetFile);
    //        helmet.setHeight("100px");
    //        
    //        root.addComponent(image, "left: 0px; top: 0px;");
    //        root.addComponent(helmet, "left: 50%; top: 100px");
    //        
    //        sinistra.setContent(root);
    //        
    //        
    //        destra.setContent(rootDx);
    //        
    this.addComponents(sinistra, destra);
}

From source file:com.esofthead.mycollab.community.shell.view.components.AboutWindow.java

License:Open Source License

public AboutWindow() {

    MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth();
    this.setContent(content);

    Image about = new Image("", new AssetResource(WebResourceIds._about));
    MVerticalLayout rightPanel = new MVerticalLayout();
    ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", MyCollabVersion.getVersion()));
    Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"),
            System.getProperty("java.runtime.version")));
    Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath());
    WebBrowser browser = Page.getCurrent().getWebBrowser();
    Label osLbl = new Label(
            String.format("%s, %s", System.getProperty("os.name"), browser.getBrowserApplication()));
    osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);
    Div licenseDiv = new Div().appendChild(new Text("Powered by: "))
            .appendChild(new A("https://www.mycollab.com").appendText("MyCollab"))
            .appendChild(new Text(". Open source under GPL license"));
    Label licenseLbl = new Label(licenseDiv.write(), ContentMode.HTML);
    Label copyRightLbl = new Label(String.format("&copy; %s - %s MyCollab Ltd. All rights reserved", "2011",
            new GregorianCalendar().get(Calendar.YEAR) + ""), ContentMode.HTML);
    rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl)
            .withAlign(copyRightLbl, Alignment.BOTTOM_LEFT);
    content.with(about, rightPanel).expand(rightPanel);
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.CrmLoginViewImpl.java

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);/*w ww . j  a v  a2  s  .c  o m*/
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    Label welcomeText = new Label("Login to CRM");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new CrmEvent.PlainLogin(this, new String[] {
                    emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) }));
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.module.project.view.ProjectLoginViewImpl.java

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);//  www  .j a va 2s  .com
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    Label welcomeText = new Label("Login to Projects");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new ProjectEvent.PlainLogin(this, new String[] {
                    emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) }));
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.module.user.view.LoginViewImpl.java

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);/*ww  w  .  j  a v  a2 s .  c  o m*/
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    Label welcomeText = new Label("Welcome Back!");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ShellController.doLogin(emailField.getValue(), pwdField.getValue(), rememberPassword.getValue());
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.shell.ui.MainView.java

License:Open Source License

private void initUI() {
    this.setStyleName("main-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);/*w  w  w . j  ava  2  s  .  co m*/
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    contentLayout.addComponent(welcomeTextWrapper);

    ModuleButton crmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_CRM));
    crmButton.setWidth("100%");
    crmButton.addStyleName("crm");
    crmButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -1218427186205574547L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null));
        }
    });

    contentLayout.addComponent(crmButton);

    ModuleButton pmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT));
    pmButton.setWidth("100%");
    pmButton.addStyleName("project");
    pmButton.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -5323408319082242586L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
        }
    });
    contentLayout.addComponent(pmButton);

    ModuleButton fileButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_DOCUMENT));
    fileButton.setWidth("100%");
    fileButton.addStyleName("document");
    contentLayout.addComponent(fileButton);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.shell.view.MainView.java

License:Open Source License

public MainView() {
    super();/*  ww  w .  jav a  2  s . co m*/
    this.setSizeFull();

    MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth();
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    contentLayout.addComponent(welcomeTextWrapper);

    Button crmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_CRM), new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null));
        }
    });
    crmButton.addStyleName(UIConstants.BUTTON_ACTION);
    crmButton.setWidth("100%");

    contentLayout.addComponent(crmButton);

    Button pmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT),
            new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent clickEvent) {
                    EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
                }
            });
    pmButton.setWidth("100%");
    pmButton.addStyleName(UIConstants.BUTTON_ACTION);
    contentLayout.addComponent(pmButton);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.module.crm.view.account.AccountListNoItemView.java

License:Open Source License

public AccountListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/*  ww  w  .  j av a2 s . co m*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/account.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(AccountI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(AccountI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button createAccountBtn = new Button(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new AccountEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(createAccountBtn);
    createAccountBtn.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Accounts", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}