Example usage for com.google.gwt.user.client.ui Label Label

List of usage examples for com.google.gwt.user.client.ui Label Label

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Label Label.

Prototype

protected Label(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:au.com.gworks.gwt.petstore.client.StoreSearchBar.java

License:Apache License

public StoreSearchBar() {
    container = new EastWestHorizPanels();
    initWidget(container);// ww w. j a v  a 2s  .co m
    setStyleName("ps-StoreSearchBar");

    Image logoImg = new Image("splash.gif");
    logoImg.setStyleName("ps-StoreSearchBar-logo");
    container.getWest().add(logoImg);

    Label applName = new Label("gwt-Petstore");
    container.getWest().add(applName);
    applName.setStyleName("ps-StoreSearchBar-title");

    searchBar = new SearchBar();
    container.getEast().add(searchBar);
}

From source file:au.com.gworks.gwt.petstore.client.StoreSearchView.java

License:Apache License

private void buildFrame() {
    groupBarContainer = new EastWestHorizPanels();
    container.add(groupBarContainer);//from ww w . jav  a2  s  . com
    groupBarContainer.setStyleName("ps-ewp-mainGroupSections");

    Label title = new Label("Store search");
    groupBarContainer.getWest().add(title);
    title.setStyleName("ps-ewp-mainGroupSections-txt");

    container.add(items, "std-client-width");
    container.add(emptyCartLbl);
}

From source file:au.com.gworks.gwt.petstore.client.StoreView.java

License:Apache License

public void updateLoginStatus(boolean isLogin, AccountInfo info) {
    storeLinkBar.getEastLinks().clear();
    if (!isLogin) {
        Hyperlink hl1 = new Hyperlink("Help", "shopping" + HistoryUtils.QUERY_TOK + "item-id=EST-27&test=one");
        Hyperlink hl2 = new Hyperlink("Sign in", "sign-in");
        storeLinkBar.getEastLinks().addHyperLink(hl1);
        storeLinkBar.getEastLinks().addHyperLink(hl2);
    } else {/*  w w w .  j  a v a 2 s.c  o  m*/
        Label l1 = new Label(info.email);
        storeLinkBar.getEastLinks().addLabel(l1);
        Hyperlink hl1 = new Hyperlink("Help", "shopping" + HistoryUtils.QUERY_TOK + "item-id=EST-27&test=one");
        Hyperlink hl2 = new Hyperlink("Account", "account");
        Hyperlink hl3 = new Hyperlink("Sign Out", "sign-in" + HistoryUtils.QUERY_TOK + "out=ok");
        storeLinkBar.getEastLinks().addHyperLink(hl1);
        storeLinkBar.getEastLinks().addHyperLink(hl2);
        storeLinkBar.getEastLinks().addHyperLink(hl3);
    }
}

From source file:au.com.gworks.gwt.petstore.client.WelcomeView.java

License:Apache License

public WelcomeView() {
    container = new VerticalPanel();
    initWidget(container);//from  w  w  w .j a v a2s .  c  om

    groupBarContainer = new EastWestHorizPanels();
    container.add(groupBarContainer);
    groupBarContainer.setStyleName("ps-ewp-mainGroupSections");

    Label title = new Label("Welcome");
    groupBarContainer.getWest().add(title);
    title.setStyleName("ps-ewp-mainGroupSections-txt");

    welcomeLabel = new Label("gwt-Petstore");
    welcomeLabel.setStyleName("ps-text-large");
    container.add(welcomeLabel);

    authorLabel = new Label("by Ashin Wimalajeewa & Dimax Pradi");
    authorLabel.setStyleName("ps-text-medium");
    container.add(authorLabel);

    descLabel = new HTML();
    container.add(descLabel);

    poweredByLabel = new Label("Powered by");
    poweredByLabel.setStyleName("ps-text-large");
    container.add(poweredByLabel);

    gwtLibs = new HorizontalPanel();
    container.add(gwtLibs);
    Label gems = new Label("javaongems");
    gems.setStyleName("ps-text-large");
    Label gwtSl = new Label("gwt-widgets Server Library");
    gwtSl.setStyleName("ps-text-large");
    gwtLibs.add(gems);
    gwtLibs.add(gwtSl);

    mainLibs = new HorizontalPanel();
    mainLibs.setVisible(false);
    container.add(mainLibs);
    gwtImg = new Image();
    mainLibs.add(gwtImg);
    gwtImg.setUrl("powerByGwt.png");

    springImg = new Image();
    mainLibs.add(springImg);
    springImg.setUrl("poweredBySpring.gif");

    ibatisImg = new Image();
    mainLibs.add(ibatisImg);
    ibatisImg.setUrl("poweredByIBatis.gif");
}

From source file:br.org.olimpiabarbacena.client.Controle.java

License:Apache License

@UiHandler("buttonMidia")
void onButtonMidiaClick(ClickEvent event) {
    String value = comboMidia.getValue(comboMidia.getSelectedIndex());

    if (value.equals("LIVRO")) {
        dialogo = new DialogBox(false);
        dialogo.setWidth("464px");
        dialogo.setHeight("417px");

        livro = new Livro(principal, dialogo);
        livro.buttonEmprestar.setVisible(false);
        livro.buttonFechar.setText("Cancelar");

        dialogo.setWidget(livro);/*ww w.jav a  2 s . c  om*/
        dialogo.center();
    } else if (value.equals("CD") || value.equals("DVD")) {
        dialogo = new DialogBox(false);
        dialogo.setWidth("462px");
        dialogo.setHeight("261px");

        cd = new CD(principal, dialogo, (value.equals("CD") ? Tipo.CD : Tipo.DVD));
        cd.buttonEmprestar.setVisible(false);
        cd.buttonFechar.setText("Cancelar");

        dialogo.setWidget(cd);
        dialogo.center();
    } else if (value.equals("JORNAL") || value.equals("REVISTA")) {
        dialogo = new DialogBox(false);
        dialogo.setWidth("460px");
        dialogo.setHeight("359px");

        jornal = new Jornal(principal, dialogo, (value.equals("JORNAL") ? Tipo.JORNAL : Tipo.REVISTA));
        jornal.buttonEmprestar.setVisible(false);
        jornal.buttonFechar.setText("Cancelar");

        dialogo.setWidget(jornal);
        dialogo.center();
    } else {
        // Cria o dilogo
        dialogo = new DialogBox(false);

        // Cria uma ncora para aceitar os eventos de clique
        final Anchor dialogoAvisoFechar = new Anchor("X");

        // Adiciona um "handler" para ncora
        dialogoAvisoFechar.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogo.hide();
            }
        });

        // Create dialog
        dialogo.setHTML(
                "Aviso                                 ");

        // Get caption element
        final HTML caption = ((HTML) dialogo.getCaption());

        // Add anchor to caption
        caption.getElement().appendChild(dialogoAvisoFechar.getElement());

        // Add click handler to caption
        caption.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                // Get x,y caption click relative to the anchor
                final int x = event.getRelativeX(dialogoAvisoFechar.getElement());
                final int y = event.getRelativeY(dialogoAvisoFechar.getElement());

                // Check click was within bounds of anchor
                if (x >= 0 && y >= 0 && x <= dialogoAvisoFechar.getOffsetWidth()
                        && y <= dialogoAvisoFechar.getOffsetHeight()) {
                    // Raise event on anchor
                    dialogoAvisoFechar.fireEvent(event);
                }
            }
        });

        final Label labelAviso = new Label("Selecione um tipo de mdia.");
        dialogo.setWidget(labelAviso);

        // Show the dialog
        dialogo.show();
        dialogo.center();
    }
}

From source file:burrito.client.crud.CrudEntityIndex.java

License:Apache License

public CrudEntityIndex(final String entityName) {
    search.addStyleName("k5-CrudEntityIndex-searchPanel");
    tablePlaceHolder.setWidget(new Label(labels.loading()));
    description.addStyleName("k5-CrudEntityIndex-description");
    underscoreEntityName = entityName.replace('.', '_');
    description.setText(CrudLabelHelper.getString(underscoreEntityName + "_desc"));
    wrapper.add(description);/*from  ww  w  .ja  v a2 s.  c  o  m*/
    Hyperlink newLink = new Hyperlink(CrudLabelHelper.getString(underscoreEntityName + "_new"),
            entityName + "/-1");
    newLink.addStyleName("k5-CrudEntityIndex-newLink");
    wrapper.add(newLink);
    wrapper.add(new VerticalSpacer(10));
    search.setVisible(false);
    wrapper.add(search);

    initWidget(wrapper);
    addStyleName("k5-CrudEntityIndex-" + underscoreEntityName);
    wrapper.add(tablePlaceHolder);
    service.getEntityHeaders(entityName, new AsyncCallback<CrudEntityDescription>() {

        public void onSuccess(CrudEntityDescription result) {
            if (result.isSearchable()) {
                search.setVisible(true);
            }
            loadTable(entityName, result);
        }

        public void onFailure(Throwable caught) {
            throw new RuntimeException("Failed to get entity description for " + entityName, caught);
        }
    });
    addStyleName("k5-CrudEntityIndex");
}

From source file:burrito.client.crud.CrudIndexPanel.java

License:Apache License

protected void init(List<CrudEntityInfo> result) {
    Label descLabel;/*from  w w  w . j  av a2 s.  c  o m*/
    wrapper.add((descLabel = new Label(messages.chooseEntity())));
    if (result.isEmpty()) {
        wrapper.add((descLabel = new Label(messages.noEntitiesToEdit())));
        wrapper.add(new VerticalSpacer(10));
    }
    descLabel.addStyleName("k5-CrudPanel-indexDesc");
    for (CrudEntityInfo crudEntityInfo : result) {
        HorizontalPanel fp = new HorizontalPanel();
        String underscore = crudEntityInfo.getEntityName().replace('.', '_');
        Hyperlink entityName = new Hyperlink(CrudLabelHelper.getString(underscore),
                crudEntityInfo.getEntityName());
        entityName.addStyleName("k5-CrudPanel-entityName");
        fp.add(entityName);
        String desc = CrudLabelHelper.getNullableString(underscore + "_desc");
        if (desc != null) {
            HTML descHtml = new HTML("&nbsp;-&nbsp;" + desc);
            descHtml.addStyleName("k5-CrudPanel-entityDesc");
            fp.add(descHtml);
        }
        wrapper.add(fp);
        wrapper.add(new VerticalSpacer(10));
    }

    wrapper.add(new VerticalSpacer(30));
    wrapper.add(new Label(messages.administrativeTasksHeader()));

    wrapper.add(new VerticalSpacer(10));
    wrapper.add(new Hyperlink(messages.reindex(), "reindex"));

}

From source file:burrito.client.crud.CrudPanel.java

License:Apache License

private Widget getPanelBasedOnHistoryToken(String token) {
    if (token == null || token.isEmpty()) {
        top.update(null, null);/*ww w. j  av  a2  s  .c o  m*/
        return new CrudIndexPanel();
    }
    if ("reindex".equals(token)) {
        return new ReindexPanel();
    }

    String[] split = token.split("/");
    final String entityName = split[0];
    if (split.length == 1) {
        top.update(entityName, null);

        CrudCustomEntityIndexHandler customHandler = customEntityIndexHandlers.get(entityName);
        if (customHandler != null) {
            return customHandler.createEntityIndex();
        } else {
            CrudEntityIndex index = loadedIndexPanels.get(entityName);
            if (index == null) {
                index = new CrudEntityIndex(entityName);
                loadedIndexPanels.put(entityName, index);
            } else {
                index.reload();
            }
            return index;
        }
    }
    if (split.length >= 2) {
        String strId = split[1];
        Long id = Long.parseLong(strId);
        Long copyFromId = null;
        if (split.length == 3) {
            copyFromId = Long.parseLong(split[2]);
        }

        top.update(entityName, null);
        return createEditForm(entityName, id, copyFromId);
    }
    return new Label("Failed to parse token");
}

From source file:burrito.client.crud.CrudPanelTop.java

License:Apache License

public void update(String entityName, String entityDisplayString) {
    String entityNameDisplay = null;
    if (entityName == null) {
        breadCrumbs.clear();//from w  ww  .  jav a2 s  .  c om
        breadCrumbs.setVisible(false);
        return;
    }
    entityNameDisplay = CrudLabelHelper.getString(entityName.replace('.', '_'));
    breadCrumbs.clear();
    breadCrumbs.add(new Hyperlink(messages.admin(), ""));
    breadCrumbs.add(new HTML("&nbsp;>&nbsp;"));
    if (entityDisplayString != null) {
        breadCrumbs.add(new Hyperlink(entityNameDisplay, entityName));
        breadCrumbs.add(new HTML("&nbsp;>&nbsp;"));
        breadCrumbs.add(new Label(entityDisplayString));
    } else {
        breadCrumbs.add(new Label(entityNameDisplay));
    }
    breadCrumbs.setVisible(true);
}

From source file:burrito.client.crud.input.DateCrudInputField.java

License:Apache License

public DateCrudInputField(DateField field) {
    this.field = field;
    Date value = (Date) field.getValue();
    if (field.isReadOnly()) {
        label = new Label(value != null ? value.toString() : "(Not set)");
        label.addStyleName("readOnly");
    } else {//from w  w  w  .j av  a 2 s  .com
        datePicker = new DateTimePickerWidget(field.isRequired());
        load(value);
    }
}