Example usage for com.vaadin.ui Embedded Embedded

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

Introduction

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

Prototype

public Embedded() 

Source Link

Document

Creates a new empty Embedded object.

Usage

From source file:annis.gui.AboutWindow.java

License:Apache License

public AboutWindow() {
    setSizeFull();// w w  w .j av a2s  .co  m

    layout = new VerticalLayout();
    setContent(layout);
    layout.setSizeFull();
    layout.setMargin(true);

    HorizontalLayout hLayout = new HorizontalLayout();

    Embedded logoAnnis = new Embedded();
    logoAnnis.setSource(new ThemeResource("images/annis-logo-128.png"));
    logoAnnis.setType(Embedded.TYPE_IMAGE);
    hLayout.addComponent(logoAnnis);

    Embedded logoSfb = new Embedded();
    logoSfb.setSource(new ThemeResource("images/sfb-logo.jpg"));
    logoSfb.setType(Embedded.TYPE_IMAGE);
    hLayout.addComponent(logoSfb);

    Link lnkFork = new Link();
    lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS"));
    lnkFork.setIcon(
            new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"));
    lnkFork.setTargetName("_blank");
    hLayout.addComponent(lnkFork);

    hLayout.setComponentAlignment(logoAnnis, Alignment.MIDDLE_LEFT);
    hLayout.setComponentAlignment(logoSfb, Alignment.MIDDLE_RIGHT);
    hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT);

    layout.addComponent(hLayout);

    layout.addComponent(new Label(
            "ANNIS is a project of the " + "<a href=\"http://www.sfb632.uni-potsdam.de/\">SFB632</a>.",
            Label.CONTENT_XHTML));
    layout.addComponent(new Label("Homepage: " + "<a href=\"http://corpus-tools.org/annis/\">"
            + "http://corpus-tools.org/annis/</a>.", Label.CONTENT_XHTML));
    layout.addComponent(new Label("Version: " + VersionInfo.getVersion()));
    layout.addComponent(new Label("Vaadin-Version: " + Version.getFullVersion()));

    TextArea txtThirdParty = new TextArea();
    txtThirdParty.setSizeFull();

    StringBuilder sb = new StringBuilder();

    sb.append("The ANNIS team wants to thank these third party software that "
            + "made the ANNIS GUI possible:\n");

    File thirdPartyFolder = new File(VaadinService.getCurrent().getBaseDirectory(), "THIRD-PARTY");
    if (thirdPartyFolder.isDirectory()) {
        for (File c : thirdPartyFolder.listFiles((FileFilter) new WildcardFileFilter("*.txt"))) {
            if (c.isFile()) {
                try {
                    sb.append(FileUtils.readFileToString(c)).append("\n");
                } catch (IOException ex) {
                    log.error("Could not read file", ex);
                }
            }
        }
    }

    txtThirdParty.setValue(sb.toString());
    txtThirdParty.setReadOnly(true);
    txtThirdParty.addStyleName("shared-text");
    txtThirdParty.setWordwrap(false);

    layout.addComponent(txtThirdParty);

    btClose = new Button("Close");
    final AboutWindow finalThis = this;
    btClose.addClickListener(new OkClickListener(finalThis));
    layout.addComponent(btClose);

    layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(txtThirdParty, 1.0f);

}

From source file:ar.com.zir.cipres.ui.login.LoginForm.java

@AutoGenerated
private AbsoluteLayout buildAbsoluteLayout_1() {
    // common part: create layout
    absoluteLayout_1 = new AbsoluteLayout();
    absoluteLayout_1.setImmediate(false);
    absoluteLayout_1.setWidth("100.0%");
    absoluteLayout_1.setHeight("100.0%");

    // pwdPassword
    pwdPassword = new PasswordField();
    pwdPassword.setCaption("Password");
    pwdPassword.setImmediate(true);//from ww  w.java 2  s.  c o m
    pwdPassword.setDescription("Contrasea del usuario");
    pwdPassword.setWidth("-1px");
    pwdPassword.setHeight("-1px");
    pwdPassword.setTabIndex(6);
    pwdPassword.setRequired(true);
    pwdPassword.setNullSettingAllowed(true);
    absoluteLayout_1.addComponent(pwdPassword, "top:99.0px;left:211.0px;");

    // txtUsuario
    txtUsuario = new TextField();
    txtUsuario.setCaption("Usuario");
    txtUsuario.setImmediate(true);
    txtUsuario.setDescription("Nombre de usuario");
    txtUsuario.setWidth("-1px");
    txtUsuario.setHeight("-1px");
    txtUsuario.setTabIndex(5);
    txtUsuario.setRequired(true);
    txtUsuario.setInputPrompt("Ingrese el usuario");
    txtUsuario.setMaxLength(10);
    absoluteLayout_1.addComponent(txtUsuario, "top:99.0px;left:18.0px;");

    // btnLogin
    btnLogin = new Button();
    btnLogin.setCaption("Login");
    btnLogin.setImmediate(true);
    btnLogin.setWidth("88px");
    btnLogin.setHeight("-1px");
    btnLogin.setTabIndex(7);
    absoluteLayout_1.addComponent(btnLogin, "top:99.0px;left:403.0px;");

    // embedded_1
    embedded_1 = new Embedded();
    embedded_1.setImmediate(false);
    embedded_1.setWidth("56px");
    embedded_1.setHeight("56px");
    embedded_1.setSource(new ThemeResource("security.png"));
    embedded_1.setType(1);
    embedded_1.setMimeType("image/png");
    absoluteLayout_1.addComponent(embedded_1, "top:18.0px;left:425.0px;");

    // label_1
    label_1 = new Label();
    label_1.setStyleName("login");
    label_1.setImmediate(false);
    label_1.setWidth("-1px");
    label_1.setHeight("-1px");
    label_1.setValue("<h2>Bienvenido a </h2>");
    label_1.setContentMode(ContentMode.HTML);
    absoluteLayout_1.addComponent(label_1, "top:18.0px;left:18.0px;");

    // embedded_2
    embedded_2 = new Embedded();
    embedded_2.setImmediate(false);
    embedded_2.setWidth("141px");
    embedded_2.setHeight("45px");
    embedded_2.setSource(new ThemeResource("cipres-header.png"));
    embedded_2.setType(1);
    embedded_2.setMimeType("image/png");
    absoluteLayout_1.addComponent(embedded_2, "top:25.0px;left:200.0px;");

    return absoluteLayout_1;
}

From source file:br.com.anteros.mobileserver.app.form.ConfigurationForm.java

License:Apache License

private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);/*from ww w .  jav a  2 s .c  o m*/
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100%");
    setHeight("100%");

    // cbDialect
    cbDialect = new ComboBox();
    cbDialect.setImmediate(false);
    cbDialect.setWidth("-1px");
    cbDialect.setHeight("-1px");
    cbDialect.addItem(MobileServerContext.H2);
    cbDialect.addItem(MobileServerContext.ORACLE);
    cbDialect.addItem(MobileServerContext.MYSQL);
    cbDialect.addItem(MobileServerContext.FIREBIRD);
    cbDialect.addItem(MobileServerContext.POSTGRESQL);

    // lblDialect
    lblDialect = new Label();
    lblDialect.setImmediate(false);
    lblDialect.setWidth("-1px");
    lblDialect.setHeight("-1px");
    lblDialect.setValue("Dialeto");

    // cbCharset
    cbCharset = new ComboBox();
    cbCharset.setImmediate(false);
    cbCharset.setWidth("-1px");
    cbCharset.setHeight("-1px");
    cbCharset.addItem(AnterosStandardsCharsets.ISO_8859_1.name());
    cbCharset.addItem(AnterosStandardsCharsets.US_ASCII.name());
    cbCharset.addItem(AnterosStandardsCharsets.UTF_16.name());
    cbCharset.addItem(AnterosStandardsCharsets.UTF_16BE.name());
    cbCharset.addItem(AnterosStandardsCharsets.UTF_16LE.name());
    cbCharset.addItem(AnterosStandardsCharsets.UTF_8.name());

    // lblCharset
    lblCharset = new Label();
    lblCharset.setImmediate(false);
    lblCharset.setWidth("-1px");
    lblCharset.setHeight("-1px");
    lblCharset.setValue("Charset");

    // fldURL
    fldURL = new TextField();
    fldURL.setImmediate(false);
    fldURL.setWidth("458px");
    fldURL.setHeight("-1px");

    // lblURL
    lblURL = new Label();
    lblURL.setImmediate(false);
    lblURL.setWidth("-1px");
    lblURL.setHeight("-1px");
    lblURL.setValue("Url conexo");

    // fldUser
    fldUser = new TextField();
    fldUser.setImmediate(false);
    fldUser.setWidth("157px");
    fldUser.setHeight("-1px");

    // lblUser
    lblUser = new Label();
    lblUser.setImmediate(false);
    lblUser.setWidth("-1px");
    lblUser.setHeight("-1px");
    lblUser.setValue("Usurio");

    // fldPassword
    fldPassword = new PasswordField();
    fldPassword.setImmediate(false);
    fldPassword.setWidth("157px");
    fldPassword.setHeight("-1px");

    // lblPassword
    lblPassword = new Label();
    lblPassword.setImmediate(false);
    lblPassword.setWidth("-1px");
    lblPassword.setHeight("-1px");
    lblPassword.setValue("Senha");

    // fldCatalog
    fldCatalog = new TextField();
    fldCatalog.setImmediate(false);
    fldCatalog.setWidth("157px");
    fldCatalog.setHeight("-1px");

    // lblCatalog
    lblCatalog = new Label();
    lblCatalog.setImmediate(false);
    lblCatalog.setWidth("-1px");
    lblCatalog.setHeight("-1px");
    lblCatalog.setValue("Catalog");

    // fldSchema
    fldSchema = new TextField();
    fldSchema.setImmediate(false);
    fldSchema.setWidth("157px");
    fldSchema.setHeight("-1px");

    // lblSchema
    lblSchema = new Label();
    lblSchema.setImmediate(false);
    lblSchema.setWidth("-1px");
    lblSchema.setHeight("-1px");
    lblSchema.setValue("Schema");

    // imgAnteros
    imgAnteros = new Embedded();
    imgAnteros.setImmediate(false);
    imgAnteros.setWidth("165px");
    imgAnteros.setHeight("45px");
    imgAnteros.setSource(new ThemeResource("images/anteros_mobile_server45.png"));
    imgAnteros.setType(1);
    imgAnteros.setMimeType("image/png");

    // fldInitPoolSize
    fldInitPoolSize = new TextField();
    fldInitPoolSize.setImmediate(false);
    fldInitPoolSize.setWidth("157px");
    fldInitPoolSize.setHeight("-1px");

    // lblPool
    lblPool = new Label();
    lblPool.setImmediate(false);
    lblPool.setWidth("-1px");
    lblPool.setHeight("-1px");
    lblPool.setValue("<b>Pool de conexes</b>");
    lblPool.setContentMode(3);

    // label_2
    label_2 = new Label();
    label_2.setImmediate(false);
    label_2.setWidth("-1px");
    label_2.setHeight("-1px");
    label_2.setValue("<b>Pool de conexes</b>");
    label_2.setContentMode(3);

    // lblInitialPoolSize
    lblInitialPoolSize = new Label();
    lblInitialPoolSize.setImmediate(false);
    lblInitialPoolSize.setWidth("-1px");
    lblInitialPoolSize.setHeight("-1px");
    lblInitialPoolSize.setValue("Tamanho inicial");

    // fldMinPoolSize
    fldMinPoolSize = new TextField();
    fldMinPoolSize.setImmediate(false);
    fldMinPoolSize.setWidth("157px");
    fldMinPoolSize.setHeight("-1px");

    // lblMinPoolSize
    lblMinPoolSize = new Label();
    lblMinPoolSize.setImmediate(false);
    lblMinPoolSize.setWidth("-1px");
    lblMinPoolSize.setHeight("-1px");
    lblMinPoolSize.setValue("Tamanho Mnimo");

    // lblMaxPoolSize
    lblMaxPoolSize = new Label();
    lblMaxPoolSize.setImmediate(false);
    lblMaxPoolSize.setWidth("-1px");
    lblMaxPoolSize.setHeight("-1px");
    lblMaxPoolSize.setValue("Tamanho Mximo");

    // fldMaxPoolSize
    fldMaxPoolSize = new TextField();
    fldMaxPoolSize.setImmediate(false);
    fldMaxPoolSize.setWidth("157px");
    fldMaxPoolSize.setHeight("-1px");

    // fldAcquireIncrement
    fldAcquireIncrement = new TextField();
    fldAcquireIncrement.setImmediate(false);
    fldAcquireIncrement.setWidth("157px");
    fldAcquireIncrement.setHeight("-1px");

    // lblAcquireIncrement
    lblAcquireIncrement = new Label();
    lblAcquireIncrement.setImmediate(false);
    lblAcquireIncrement.setWidth("-1px");
    lblAcquireIncrement.setHeight("-1px");
    lblAcquireIncrement.setValue("Incremento");

    // chShowSql
    chShowSql = new CheckBox();
    chShowSql.setCaption("Mostrar SQL's no log");
    chShowSql.setImmediate(false);
    chShowSql.setWidth("-1px");
    chShowSql.setHeight("-1px");

    // chFormatSql
    chFormatSql = new CheckBox();
    chFormatSql.setCaption("Formatar SQL's ");
    chFormatSql.setImmediate(false);
    chFormatSql.setWidth("-1px");
    chFormatSql.setHeight("-1px");

    // btnOk
    btnOk = new Button();
    btnOk.setCaption("Ok");
    btnOk.setIcon(new ThemeResource("icons/16/ok.png"));
    btnOk.setImmediate(true);
    btnOk.setWidth("-1px");
    btnOk.setHeight("-1px");

    // btnCancel
    btnCancel = new Button();
    btnCancel.setCaption("Cancela");
    btnCancel.setIcon(new ThemeResource("icons/16/cancel.png"));
    btnCancel.setImmediate(true);
    btnCancel.setWidth("-1px");
    btnCancel.setHeight("-1px");

    // imgConfiguration
    imgConfiguration = new Embedded();
    imgConfiguration.setImmediate(false);
    imgConfiguration.setWidth("48px");
    imgConfiguration.setHeight("48px");
    imgConfiguration.setSource(new ThemeResource("images/configuration.png"));
    imgConfiguration.setType(1);
    imgConfiguration.setMimeType("image/png");

    // lblAccessControl
    lblAccessControl = new Label();
    lblAccessControl.setImmediate(false);
    lblAccessControl.setWidth("-1px");
    lblAccessControl.setHeight("-1px");
    lblAccessControl.setValue("<b>Controle de acesso</b>");
    lblAccessControl.setContentMode(3);

    // lblAccessUser
    lblAccessUser = new Label();
    lblAccessUser.setImmediate(false);
    lblAccessUser.setWidth("-1px");
    lblAccessUser.setHeight("-1px");
    lblAccessUser.setValue("Usurio");

    // fldAccessUser
    fldAccessUser = new TextField();
    fldAccessUser.setImmediate(false);
    fldAccessUser.setWidth("157px");
    fldAccessUser.setHeight("-1px");

    // lblAccessPassword
    lblAccessPassword = new Label();
    lblAccessPassword.setImmediate(false);
    lblAccessPassword.setWidth("-1px");
    lblAccessPassword.setHeight("-1px");
    lblAccessPassword.setValue("Senha");

    // fldAccessPassword
    fldAccessPassword = new PasswordField();
    fldAccessPassword.setImmediate(false);
    fldAccessPassword.setWidth("157px");
    fldAccessPassword.setHeight("-1px");

    // cbTipoPool
    cbTipoPool = new ComboBox();
    cbTipoPool.setImmediate(false);
    cbTipoPool.setWidth("100.0%");
    cbTipoPool.setHeight("-1px");
    cbTipoPool.addItem(PoolDatasource.POOL_C3P0);
    cbTipoPool.addItem(PoolDatasource.POOL_TOMCAT);
    cbTipoPool.addItem(PoolDatasource.POOL_JNDI);
    cbTipoPool.addItem(PoolDatasource.JDBC_WITHOUT_PO0L);

    // lblTipoPool
    lblTipoPool = new Label();
    lblTipoPool.setImmediate(false);
    lblTipoPool.setWidth("103px");
    lblTipoPool.setHeight("-1px");
    lblTipoPool.setValue("Gerenciador pool");

    // fldJNDI
    fldJNDI = new TextField();
    fldJNDI.setImmediate(false);
    fldJNDI.setWidth("300px");
    fldJNDI.setHeight("-1");

    // lblJNDI
    lblJNDI = new Label();
    lblJNDI.setImmediate(false);
    lblJNDI.setWidth("-1px");
    lblJNDI.setHeight("-1px");
    lblJNDI.setValue("Recurso JNDI");

    // lblQueryTimeout
    lblQueryTimeout = new Label();
    lblQueryTimeout.setImmediate(false);
    lblQueryTimeout.setWidth("-1px");
    lblQueryTimeout.setHeight("-1px");
    lblQueryTimeout.setValue("Timeout query");

    // fldMaxPoolSize
    fldQueryTimeout = new TextField();
    fldQueryTimeout.setImmediate(false);
    fldQueryTimeout.setWidth("100px");
    fldQueryTimeout.setHeight("-1px");

    // lblQueryTimeoutSeconds
    lblQueryTimeoutSeconds = new Label();
    lblQueryTimeoutSeconds.setImmediate(false);
    lblQueryTimeoutSeconds.setWidth("-1px");
    lblQueryTimeoutSeconds.setHeight("-1px");
    lblQueryTimeoutSeconds.setValue("segundos");

    mainLayout.addComponent(cbDialect, "top:20.0px;left:269.0px;");
    mainLayout.addComponent(lblDialect, "top:17.0px;left:223.0px;");
    mainLayout.addComponent(cbCharset, "top:20.0px;left:569.0px;");
    mainLayout.addComponent(lblCharset, "top:17.0px;left:519.0px;");
    mainLayout.addComponent(fldURL, "top:44.0px;left:269.0px;");
    mainLayout.addComponent(lblURL, "top:41.0px;left:195.0px;");
    mainLayout.addComponent(fldUser, "top:69.0px;left:269.0px;");
    mainLayout.addComponent(lblUser, "top:69.0px;left:218.0px;");
    mainLayout.addComponent(fldPassword, "top:69.0px;left:571.0px;");
    mainLayout.addComponent(lblPassword, "top:69.0px;left:529.0px;");
    mainLayout.addComponent(fldCatalog, "top:94.0px;left:269.0px;");
    mainLayout.addComponent(lblCatalog, "top:94.0px;left:216.0px;");
    mainLayout.addComponent(fldSchema, "top:94.0px;left:571.0px;");
    mainLayout.addComponent(lblSchema, "top:93.0px;left:519.0px;");
    mainLayout.addComponent(imgAnteros, "top:5.0px;left:5.0px;");
    mainLayout.addComponent(cbTipoPool, "top:159.0px;right:230.0px;left:269.0px;");
    mainLayout.addComponent(lblTipoPool, "top:156.0px;left:165.0px;");
    mainLayout.addComponent(lblJNDI, "top:197.0px;left:184.0px;");
    mainLayout.addComponent(fldJNDI, "top:197.0px;left:269.0px;");
    mainLayout.addComponent(fldInitPoolSize, "top:221.0px;left:269.0px;");
    mainLayout.addComponent(lblPool, "top:130.0px;left:269.0px;");
    mainLayout.addComponent(label_2, "top:130.0px;left:269.0px;");
    mainLayout.addComponent(lblInitialPoolSize, "top:221.0px;left:172.0px;");
    mainLayout.addComponent(fldMinPoolSize, "top:246.0px;left:269.0px;");
    mainLayout.addComponent(lblMinPoolSize, "top:247.0px;left:164.0px;");
    mainLayout.addComponent(lblMaxPoolSize, "top:273.0px;left:162.0px;");
    mainLayout.addComponent(fldMaxPoolSize, "top:272.0px;left:269.0px;");
    mainLayout.addComponent(fldAcquireIncrement, "top:297.0px;left:269.0px;");
    mainLayout.addComponent(lblAcquireIncrement, "top:298.0px;left:200.0px;");
    mainLayout.addComponent(chShowSql, "top:234.0px;left:571.0px;");
    mainLayout.addComponent(chFormatSql, "top:250.0px;left:571.0px;");
    mainLayout.addComponent(lblQueryTimeout, "top:297.0px;left:480.0px;");
    mainLayout.addComponent(fldQueryTimeout, "top:298.0px;left:571.0px;");
    mainLayout.addComponent(lblQueryTimeoutSeconds, "top:297.0px;left:675.0px;");
    mainLayout.addComponent(imgConfiguration, "top:153.0px;left:30.0px;");
    mainLayout.addComponent(lblAccessControl, "top:328.0px;left:180.0px;");
    mainLayout.addComponent(lblAccessUser, "top:350.0px;left:220.0px;");
    mainLayout.addComponent(fldAccessUser, "top:350.0px;left:269.0px;");
    mainLayout.addComponent(lblAccessPassword, "top:349.0px;left:529.0px;");
    mainLayout.addComponent(fldAccessPassword, "top:348.0px;left:571.0px;");
    mainLayout.addComponent(btnOk, "top:394.0px;left:580.0px;");
    mainLayout.addComponent(btnCancel, "top:394.0px;left:648.0px;");

    return mainLayout;
}

From source file:br.com.anteros.mobileserver.app.form.UserLoginForm.java

License:Apache License

private HorizontalLayout buildHorizontalLayout_1() {
    horizontalLayout = new HorizontalLayout();
    horizontalLayout.setImmediate(false);
    horizontalLayout.setWidth("100.0%");
    horizontalLayout.setHeight("100.0%");
    horizontalLayout.setMargin(false);//w  w  w .j a  v a2  s.  c  o  m

    image = new Embedded();
    image.setImmediate(false);
    image.setWidth("64px");
    image.setHeight("64px");
    image.setSource(new ThemeResource("img/login.png"));
    image.setType(1);
    image.setMimeType("image/png");
    horizontalLayout.addComponent(image);
    horizontalLayout.setComponentAlignment(image, new Alignment(33));

    absoluteLayout = buildAbsoluteLayout();
    horizontalLayout.addComponent(absoluteLayout);
    horizontalLayout.setExpandRatio(absoluteLayout, 1.0f);

    return horizontalLayout;
}

From source file:com.esofthead.mycollab.community.view.NotPresentedView.java

License:Open Source License

public NotPresentedView() {
    this.setHeight("370px");
    this.setWidth("100%");
    VerticalLayout layoutWapper = new VerticalLayout();
    layoutWapper.setWidth("100%");

    VerticalLayout layout = new VerticalLayout();
    final Embedded titleIcon = new Embedded();
    titleIcon.setSource(MyCollabResource.newResource("icons/not_present.png"));
    layout.addComponent(titleIcon);/*from  ww  w .  j  a va 2s  .co  m*/
    layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_CENTER);

    Label label = new Label("Module is not presented for community edition");
    label.setStyleName("h2_community");
    layout.addComponent(label);
    layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);

    layoutWapper.addComponent(layout);
    layoutWapper.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);
    this.addComponent(layoutWapper);
    this.setComponentAlignment(layoutWapper, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.module.file.view.components.FileDownloadWindow.java

License:Open Source License

private void constructBody() {
    final MVerticalLayout layout = new MVerticalLayout();
    final Embedded iconEmbed = new Embedded();
    iconEmbed.setSource(MyCollabResource.newResource("icons/page_white.png"));
    layout.with(iconEmbed).withAlign(iconEmbed, Alignment.MIDDLE_CENTER);

    final GridFormLayoutHelper info = new GridFormLayoutHelper(1, 4, "100%", "80px", Alignment.TOP_LEFT);
    info.getLayout().setWidth("100%");
    info.getLayout().setMargin(new MarginInfo(false, true, false, true));
    info.getLayout().setSpacing(false);/*from   w w  w .j  a va  2 s .co m*/

    if (this.content.getDescription() != null) {
        final Label desvalue = new Label();
        if (!this.content.getDescription().equals("")) {
            desvalue.setData(this.content.getDescription());
        } else {
            desvalue.setValue("&nbsp;");
            desvalue.setContentMode(ContentMode.HTML);
        }
        info.addComponent(desvalue, "Description", 0, 0);
    }
    final Label author = new Label(this.content.getCreatedBy());
    info.addComponent(author, "Created by", 0, 1);

    final Label size = new Label(ResourceUtils.getVolumeDisplay(this.content.getSize()));
    info.addComponent(size, "Size", 0, 2);

    final Label dateCreate = new Label(AppContext.formatDate(this.content.getCreated().getTime()));
    info.addComponent(dateCreate, "Date created", 0, 3);

    layout.addComponent(info.getLayout());

    final MHorizontalLayout buttonControls = new MHorizontalLayout();
    buttonControls.setSpacing(true);
    buttonControls.setMargin(new MarginInfo(true, false, true, false));

    final Button downloadBtn = new Button("Download");
    List<Resource> resources = new ArrayList<Resource>();
    resources.add(content);

    StreamResource downloadResource = StreamDownloadResourceUtil.getStreamResourceSupportExtDrive(resources);

    FileDownloader fileDownloader = new FileDownloader(downloadResource);
    fileDownloader.extend(downloadBtn);

    downloadBtn.addStyleName(UIConstants.THEME_GREEN_LINK);

    buttonControls.with(downloadBtn).withAlign(downloadBtn, Alignment.MIDDLE_CENTER);

    final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    FileDownloadWindow.this.close();
                }
            });
    cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    buttonControls.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER);
    layout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_CENTER);
    this.setContent(layout);
}

From source file:com.esspl.datagen.DataGenApplication.java

License:Open Source License

private void buildMainLayout() {
    log.debug("DataGenApplication - buildMainLayout() start");
    VerticalLayout rootLayout = new VerticalLayout();
    final Window root = new Window("DATA Gen", rootLayout);
    root.setStyleName("tData");

    setMainWindow(root);//from  ww w . j ava2 s .c  o m

    rootLayout.setSizeFull();
    rootLayout.setMargin(false, true, false, true);

    // Top area, containing logo and header
    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    root.addComponent(top);

    // Create the placeholders for all the components in the top area
    HorizontalLayout header = new HorizontalLayout();

    // Add the components and align them properly
    top.addComponent(header);
    top.setComponentAlignment(header, Alignment.TOP_LEFT);

    top.setStyleName("top");
    top.setHeight("75px"); // Same as the background image height

    // header controls
    Embedded logo = new Embedded();
    logo.setSource(DataGenConstant.LOGO);
    logo.setWidth("100%");
    logo.setStyleName("logo");
    header.addComponent(logo);
    header.setSpacing(false);

    //Show which connection profile is connected
    connectedString = new Label("Connected to - Oracle");
    connectedString.setStyleName("connectedString");
    connectedString.setWidth("500px");
    connectedString.setVisible(false);
    top.addComponent(connectedString);

    //Toolbar
    toolbar = new ToolBar(this);
    top.addComponent(toolbar);
    top.setComponentAlignment(toolbar, Alignment.TOP_RIGHT);

    listing = new Table();
    listing.setHeight("240px");
    listing.setWidth("100%");
    listing.setStyleName("dataTable");
    listing.setImmediate(true);

    // turn on column reordering and collapsing
    listing.setColumnReorderingAllowed(true);
    listing.setColumnCollapsingAllowed(true);
    listing.setSortDisabled(true);

    // Add the table headers
    listing.addContainerProperty("Sl No.", Integer.class, null);
    listing.addContainerProperty("Column Name", TextField.class, null);
    listing.addContainerProperty("Data Type", Select.class, null);
    listing.addContainerProperty("Format", Select.class, null);
    listing.addContainerProperty("Examples", Label.class, null);
    listing.addContainerProperty("Additional Data", HorizontalLayout.class, null);
    listing.setColumnAlignments(new String[] { Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER,
            Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER });

    //From the starting create 5 rows
    addRow(5);

    //Add different style for IE browser
    WebApplicationContext context = ((WebApplicationContext) getMainWindow().getApplication().getContext());
    WebBrowser browser = context.getBrowser();

    //Create a TabSheet
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    if (!browser.isIE()) {
        tabSheet.setStyleName("tabSheet");
    }

    //Generator Tab content start
    generator = new VerticalLayout();
    generator.setMargin(true, true, false, true);

    generateTypeHl = new HorizontalLayout();
    generateTypeHl.setMargin(false, false, false, true);
    generateTypeHl.setSpacing(true);
    List<String> generateTypeList = Arrays.asList(new String[] { "Sql", "Excel", "XML", "CSV" });
    generateType = new OptionGroup("Generation Type", generateTypeList);
    generateType.setNullSelectionAllowed(false); // user can not 'unselect'
    generateType.select("Sql"); // select this by default
    generateType.setImmediate(true); // send the change to the server at once
    generateType.addListener(this); // react when the user selects something
    generateTypeHl.addComponent(generateType);

    //SQL Options
    sqlPanel = new Panel("SQL Options");
    sqlPanel.setHeight("180px");
    if (browser.isIE()) {
        sqlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        sqlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }
    VerticalLayout vl1 = new VerticalLayout();
    vl1.setMargin(false);
    Label lb1 = new Label("DataBase");
    database = new Select();
    database.addItem("Oracle");
    database.addItem("Sql Server");
    database.addItem("My Sql");
    database.addItem("Postgress Sql");
    database.addItem("H2");
    database.select("Oracle");
    database.setWidth("160px");
    database.setNullSelectionAllowed(false);
    HorizontalLayout dbBar = new HorizontalLayout();
    dbBar.setMargin(false, false, false, false);
    dbBar.setSpacing(true);
    dbBar.addComponent(lb1);
    dbBar.addComponent(database);
    vl1.addComponent(dbBar);

    Label tblLabel = new Label("Table Name");
    tblName = new TextField();
    tblName.setWidth("145px");
    tblName.setStyleName("mandatory");
    HorizontalLayout tableBar = new HorizontalLayout();
    tableBar.setMargin(true, false, false, false);
    tableBar.setSpacing(true);
    tableBar.addComponent(tblLabel);
    tableBar.addComponent(tblName);
    vl1.addComponent(tableBar);

    createQuery = new CheckBox("Include CREATE TABLE query");
    createQuery.setValue(true);
    HorizontalLayout createBar = new HorizontalLayout();
    createBar.setMargin(true, false, false, false);
    createBar.addComponent(createQuery);
    vl1.addComponent(createBar);
    sqlPanel.addComponent(vl1);

    generateTypeHl.addComponent(sqlPanel);
    generator.addComponent(generateTypeHl);

    //CSV Option
    csvPanel = new Panel("CSV Options");
    csvPanel.setHeight("130px");
    if (browser.isIE()) {
        csvPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        csvPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }
    Label delimiter = new Label("Delimiter Character(s)");
    VerticalLayout vl2 = new VerticalLayout();
    vl2.setMargin(false);
    csvDelimiter = new TextField();
    HorizontalLayout csvBar = new HorizontalLayout();
    csvBar.setMargin(true, false, false, false);
    csvBar.setSpacing(true);
    csvBar.addComponent(delimiter);
    csvBar.addComponent(csvDelimiter);
    vl2.addComponent(csvBar);
    csvPanel.addComponent(vl2);

    //XML Options
    xmlPanel = new Panel("XML Options");
    xmlPanel.setHeight("160px");
    if (browser.isIE()) {
        xmlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        xmlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }

    VerticalLayout vl3 = new VerticalLayout();
    vl3.setMargin(false);
    Label lb4 = new Label("Root node name");
    rootNode = new TextField();
    rootNode.setWidth("125px");
    rootNode.setStyleName("mandatory");
    HorizontalLayout nodeBar = new HorizontalLayout();
    nodeBar.setMargin(true, false, false, false);
    nodeBar.setSpacing(true);
    nodeBar.addComponent(lb4);
    nodeBar.addComponent(rootNode);
    vl3.addComponent(nodeBar);

    Label lb5 = new Label("Record node name");
    recordNode = new TextField();
    recordNode.setWidth("112px");
    recordNode.setStyleName("mandatory");
    HorizontalLayout recordBar = new HorizontalLayout();
    recordBar.setMargin(true, false, false, false);
    recordBar.setSpacing(true);
    recordBar.addComponent(lb5);
    recordBar.addComponent(recordNode);
    vl3.addComponent(recordBar);
    xmlPanel.addComponent(vl3);

    HorizontalLayout noOfRowHl = new HorizontalLayout();
    noOfRowHl.setSpacing(true);
    noOfRowHl.setMargin(true, false, false, true);
    noOfRowHl.addComponent(new Label("Number of Results"));
    resultNum = new TextField();
    resultNum.setImmediate(true);
    resultNum.setNullSettingAllowed(false);
    resultNum.setStyleName("mandatory");
    resultNum.addValidator(new IntegerValidator("Number of Results must be an Integer"));
    resultNum.setWidth("5em");
    resultNum.setMaxLength(5);
    resultNum.setValue(50);
    noOfRowHl.addComponent(resultNum);
    generator.addComponent(noOfRowHl);

    HorizontalLayout addRowHl = new HorizontalLayout();
    addRowHl.setMargin(true, false, true, true);
    addRowHl.setSpacing(true);
    addRowHl.addComponent(new Label("Add"));
    rowNum = new TextField();
    rowNum.setImmediate(true);
    rowNum.setNullSettingAllowed(true);
    rowNum.addValidator(new IntegerValidator("Row number must be an Integer"));
    rowNum.setWidth("4em");
    rowNum.setMaxLength(2);
    rowNum.setValue(1);
    addRowHl.addComponent(rowNum);
    rowsBttn = new Button("Row(s)");
    rowsBttn.setIcon(DataGenConstant.ADD);
    rowsBttn.addListener(ClickEvent.class, this, "addRowButtonClick"); // react to clicks
    addRowHl.addComponent(rowsBttn);
    generator.addComponent(addRowHl);

    //Add the Grid
    generator.addComponent(listing);

    //Generate Button
    Button bttn = new Button("Generate");
    bttn.setDescription("Generate Gata");
    bttn.addListener(ClickEvent.class, this, "generateButtonClick"); // react to clicks
    bttn.setIcon(DataGenConstant.VIEW);
    bttn.setStyleName("generate");
    generator.addComponent(bttn);
    //Generator Tab content end

    //Executer Tab content start - new class created to separate execution logic
    executor = new ExecutorView(this);
    //Executer Tab content end

    //Explorer Tab content start - new class created to separate execution logic
    explorer = new ExplorerView(this, databaseSessionManager);
    //explorer.setMargin(true);
    //Explorer Tab content end

    //About Tab content start
    VerticalLayout about = new VerticalLayout();
    about.setMargin(true);
    Label aboutRichText = new Label(DataGenConstant.ABOUT_CONTENT);
    aboutRichText.setContentMode(Label.CONTENT_XHTML);
    about.addComponent(aboutRichText);
    //About Tab content end

    //Help Tab content start
    VerticalLayout help = new VerticalLayout();
    help.setMargin(true);
    Label helpText = new Label(DataGenConstant.HELP_CONTENT);
    helpText.setContentMode(Label.CONTENT_XHTML);
    help.addComponent(helpText);

    Embedded helpScreen = new Embedded();
    helpScreen.setSource(DataGenConstant.HELP_SCREEN);
    help.addComponent(helpScreen);

    Label helpStepsText = new Label(DataGenConstant.HELP_CONTENT_STEPS);
    helpStepsText.setContentMode(Label.CONTENT_XHTML);
    help.addComponent(helpStepsText);
    //Help Tab content end

    //Add the respective contents to the tab sheet
    tabSheet.addTab(generator, "Generator", DataGenConstant.HOME_ICON);
    executorTab = tabSheet.addTab(executor, "Executor", DataGenConstant.EXECUTOR_ICON);
    explorerTab = tabSheet.addTab(explorer, "Explorer", DataGenConstant.EXPLORER_ICON);
    tabSheet.addTab(about, "About", DataGenConstant.ABOUT_ICON);
    tabSheet.addTab(help, "Help", DataGenConstant.HELP_ICON);

    HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();
    content.addComponent(tabSheet);

    rootLayout.addComponent(content);
    rootLayout.setExpandRatio(content, 1);
    log.debug("DataGenApplication - buildMainLayout() end");
}

From source file:com.etest.pdfgenerator.TQViewer.java

public TQViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    //        setSizeFull();
    setWidth("900px");
    setHeight("600px");
    center();//from   ww w.j  a v  a 2 s  .c  o  m

    StreamResource resource = new StreamResource(new TQCoveragePDF(getTQCoverageId()), "TQ.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.ItemAnalysisOfSubjectReportViewer.java

public ItemAnalysisOfSubjectReportViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    setWidth("900px");
    setHeight("600px");
    center();/*from   www .j  a va 2s. c o  m*/

    StreamResource resource = new StreamResource(new ItemAnalysisOfSubjectReportPDF(getTQCoverageId()),
            "ItemAnalysis.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.ItemAnalysisReportViewer.java

public ItemAnalysisReportViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    setWidth("900px");
    setHeight("600px");
    center();/*from w  ww  .  j  a  v a  2s  .  co m*/

    StreamResource resource = new StreamResource(new ItemAnalysisReportPDF(getTqCoverageId()),
            "ItemAnalysis.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}