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

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

Introduction

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

Prototype

public Anchor() 

Source Link

Document

Creates an empty anchor.

Usage

From source file:at.ait.dme.yuma.client.image.annotation.ImageAnnotationTreeNode.java

License:EUPL

/**
 * adds the header information: user, date and rates
 *///w  w  w  .j a v a 2 s  .  c  om
public void addHeader() {
    headerPanel.setStyleName("imageAnnotation-header");

    if (annotation.getScope() == ImageAnnotation.Scope.PRIVATE) {
        privateAnnotation.setStyleName("imageAnnotation-private-annotation-image");
        headerPanel.add(privateAnnotation);
    }

    headerUser.setText(annotation.getCreatedBy());
    headerUser.setStyleName("imageAnnotation-header-user");
    headerPanel.add(headerUser);

    if (annotation.getCreated() != null) {
        headerDate
                .setText("(" + DateTimeFormat.getShortDateTimeFormat().format(annotation.getModified()) + ")");
        headerDate.setStyleName("imageAnnotation-header-date");
    }
    headerPanel.add(headerDate);

    if (annotation.hasFragment()) {
        fragment.setStyleName("imageAnnotation-header-fragment");
        headerPanel.add(fragment);
    }

    if (annotation.hasFragment() && (Application.getBbox() != null || Application.isInTileMode())) {
        mapAnnotation.setStyleName("imageAnnotation-header-map");
        mapAnnotation.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(550, 300, 500, 300);
                window.setWidget(new GoogleMapsComposite(annotation));
                window.show();
            }
        });
        headerPanel.add(mapAnnotation);
    }

    // rate information not yet implemented
    /*
     * if(annotation.getRate()==null || annotation.getRate()==0)
     * rateValue.setStyleName("imageAnnotation-header-rate"); else
     * if(annotation.getRate()>0)
     * rateValue.setStyleName("imageAnnotation-header-rate-plus"); else
     * rateValue.setStyleName("imageAnnotation-header-rate-minus");
     */
    rateValue.setStyleName("imageAnnotation-header-rate");
    rateValue.setText("+0");
    annotationRatePanel.add(rateValue);

    rateMinus.setStyleName("imageAnnotation-header-rate-image-minus");
    annotationRatePanel.add(rateMinus);
    ratePlus.setStyleName("imageAnnotation-header-rate-image-plus");
    annotationRatePanel.add(ratePlus);

    if (Application.getFlaggedId() != null && Application.getFlaggedId().equals(annotation.getId())) {
        flag.setStyleName("imageAnnotation-header-flag-red-image");
        flagged = true;
    } else {
        flag.setStyleName("imageAnnotation-header-flag-blue-image");
    }
    Anchor flagAnchor = new Anchor();
    flagAnchor.setHref(createFlagLink());
    flagAnchor.setTarget("_blank");
    flagAnchor.getElement().appendChild(flag.getElement());
    annotationRatePanel.add(flagAnchor);

    headerPanel.add(annotationRatePanel);
    annotationPanel.add(headerPanel);

    // Init CSS style
    deselect();
}

From source file:burrito.client.widgets.panels.table.PageController.java

License:Apache License

private Anchor createCurrentPageAnchor() {
    Anchor a = new Anchor();
    a.addClickHandler(new ClickHandler() {

        @Override/*from w  w  w.j  a va 2s.c  o  m*/
        public void onClick(ClickEvent event) {
            for (PageControllerHandler handler : handlers) {
                handler.loadPage(currentPageZeroIndexed);
            }
        }
    });
    a.addStyleName("k5-PageController-link");
    return a;
}

From source file:cc.kune.core.client.ws.entheader.EntityHeaderPanel.java

License:GNU Affero Public License

/**
 * Instantiates a new entity header panel.
 *
 * @param downloadProvider//from w  w  w  .  ja  v a 2  s.  c o m
 *          the download provider
 * @param images
 *          the images
 * @param bindings
 *          the bindings
 * @param armor
 *          the armor
 * @param entityTextLogo
 *          the entity text logo
 * @param i18n
 *          the i18n
 */
@Inject
public EntityHeaderPanel(final EventBus eventBus, final Provider<ClientFileDownloadUtils> downloadProvider,
        final GuiProvider bindings, final GSpaceArmor armor, final I18nTranslationService i18n,
        final MediumAvatarDecorator decorator) {
    this.downloadProvider = downloadProvider;
    this.decorator = decorator;
    toolbar = armor.getHeaderActionsTopToolbar();

    logo = armor.getGroupLogo();
    logo.removeFromParent();
    final WrappedFlowPanel groupNamePanel = armor.getGroupName();
    groupLongName = new Text();
    groupNamePanel.add(groupLongName);
    logoShadow = armor.getLogoShadow();
    final WrappedFlowPanel shorNamePanel = armor.getGroupShortName();
    shortNameAnchor = new Anchor();
    shorNamePanel.add(shortNameAnchor);
    decorator.setWidget(logo);
    logoShadow.appendChild(((Widget) decorator).getElement());
    followersBtn = (PaperButton) armor.getFollowersButton();
    eventBus.addHandler(GroupMembersUpdatedEvent.getType(),
            new GroupMembersUpdatedEvent.GroupMembersUpdatedHandler() {
                @Override
                public void onGroupMembersUpdated(final GroupMembersUpdatedEvent event) {
                    final int members = event.getMembers();
                    followersBtn.setText(I18n.t(members == 1 ? "[%d] member" : "[%d] members", members));
                }
            });
    eventBus.addHandler(UserFollowersUpdatedEvent.getType(),
            new UserFollowersUpdatedEvent.UserFollowersUpdatedHandler() {
                @Override
                public void onUserFollowersUpdated(final UserFollowersUpdatedEvent event) {
                    final int followers = event.getFollowers();
                    // followersBtn.setText(I18n.t(followers == 1 ? "One follower" :
                    // "[%d] followers", followers));
                    followersBtn.setText(I18n.t(followers == 1 ? "One buddy" : "[%d] buddies", followers));
                }
            });
}

From source file:com.agnie.gwt.common.client.widget.WizardBar.java

License:Open Source License

/**
 * Adds a new Step in wizard with specified text.
 * /*  w w w. j a v  a  2  s  .  c  om*/
 * @param text
 *            the new Step's text
 */
public void addStep(String label, String text) {
    StringBuffer html = new StringBuffer();
    if (label != null) {
        html.append("<em>" + processMacro(label) + "</em>");
    } else {
        html.append("<em>" + (getStepCount() + 1) + "</em>");
    }
    html.append("<span>" + text + "</span>");

    Anchor anchor = new Anchor();
    anchor.setHTML(html.toString());
    addStep(anchor);
}

From source file:com.chinarewards.gwt.license.client.breadCrumbs.view.BreadCrumbsWidget.java

@Override
public void setTitleText(List<MenuBreadVo> menuBreadVo) {
    titleText.clear();//from   w  w w .  j a v a 2 s  .  c  om
    for (int i = 0; i < menuBreadVo.size(); i++) {
        final MenuBreadVo menu = menuBreadVo.get(i);
        if (menu.getMenuUrl() != null) {
            Anchor a = new Anchor();
            a.setText(menu.getMenuName());
            a.setStyleName("breadcrumbsAnchor");
            a.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    menu.getMenuUrl().execute();

                }
            });
            titleText.add(a);
        } else {
            Span s = new Span();
            s.setText(menu.getMenuName());
            s.setStyleName("breadcrumbsSpan");
            titleText.add(s);
        }
        if (i != menuBreadVo.size() - 1) {
            HTML h = new HTML("-");
            h.setStyleName("breadcrumbsdiv");
            titleText.add(h);
        }

    }

}

From source file:com.chinarewards.gwt.license.client.core.ui.impl.ButtonMenuProcessor.java

/**
 * //from  w  w w. j a v a 2  s  . co  m
 * 
 * @param parent
 * @param node
 */
private Widget createButtonMenuWidget(String name) {
    breadCrumbsMenu.cleanBreadCrumbsItemAll();
    grid = new VerticalPanel();
    grid.setWidth("100%");
    // int i = 0;
    for (MenuNode node : root.getChildren()) {
        final Anchor button = new Anchor();
        final MenuItem menuItem = node.getValue();
        if (name != null) {
            List<String> items = getMenuItemName(name);
            if (!items.contains(menuItem.getMenuId()))
                continue;
        } else {
            break;
        }

        button.setText(menuItem.getTitle());
        button.setStyleName("menu-link");

        // ?
        String menuId = menuItem.getMenuId();
        if (menuId.equals(LicenseConstants.MENU_LICENSE_LIST)) {

            button.setStyleName("menu-link menu-selected");
            breadCrumbsMenu.cleanBreadCrumbsItemTop();
            if (menuId.equals(LicenseConstants.MENU_LICENSE_LIST)) {
                breadCrumbsMenu.addBreadCrumbsItemTop("?", null);
            }
            // else if
            // (menuId.equals(StaffListConstants.MENU_STAFFLIST_SEARCH))
            // breadCrumbsMenu.addBreadCrumbsItemTop("?", null);
            // else if
            // (menuId.equals(EnterpriseConstants.MENU_ENTERPRISE_EDIT))
            // breadCrumbsMenu.addBreadCrumbsItemTop("", null);
        }

        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent paramClickEvent) {
                button.setStyleName("menu-link menu-selected");
                breadCrumbsMenu.cleanBreadCrumbsItem();
                breadCrumbsMenu.addBreadCrumbsItem(menuItem.getTitle(), menuItem);
                eventBus.fireEvent(new MenuClickEvent(menuItem));
                for (int i = 0; i < grid.getWidgetCount(); i++) {
                    if (grid.getWidget(i) instanceof Anchor) {
                        if (!button.getText().equals(((Anchor) grid.getWidget(i)).getText())) {
                            grid.getWidget(i).setStyleName("menu-link");
                        }
                    }
                }
            }
        });
        grid.add(button);
        // i++;
    }

    return grid;
}

From source file:com.edgenius.wiki.gwt.client.page.PageMain.java

License:Open Source License

public void initContentPanel() {
    //clean navbar
    List<NavItem> linkList = new ArrayList<NavItem>();
    linkList.add(new NavItem(Msg.consts.dashboard(), "", null));
    refreshNavbar(linkList);/*from w  w  w  .j  a  v  a2s.  c  om*/

    //location
    location = new LocationButton(this, false);
    printBtn = new PrintButton(this, false);

    Anchor topAnchor = new Anchor();
    topAnchor.setName(PAGE_TOP_ANCHOR_NAME);
    addBeforeNav(topAnchor);

    addBeforeNav(location);
    printSep = addAfterLogin(printBtn);
    //this will be reset when page filled: according to PageAttribute.NO_PRINT
    setPrintBtnVisible(false);

    History.addValueChangeHandler(this);

    downloadFrm.setVisible(false);
    downloadFrm.setSize("0px", "0px");
    DOM.setStyleAttribute(downloadFrm.getElement(), "border", "0px");
    DOM.setStyleAttribute(downloadFrm.getElement(), "position", "absolute");

    loadingPanel.addWidget(downloadFrm);
    deck.insert(loadingPanel, LOADING_PANEL);
    deck.insert(viewPanel, VIEW_PANEL);
    deck.insert(editPanel, EDIT_PANEL);
    deck.insert(previewPanel, PREVIEW_PANEL);
    deck.insert(dashboardPanel, DASHBOARD_PANEL);
    deck.insert(editSidebarPanel, EDIT_SIDEBAR_PANEL);
    deck.insert(editTemplatePanel, EDIT_TEMPLATE_PANEL);

    this.setSideMenuPanel(ClientConstants.RIGHT, sidebar);

    deck.setStyleName(Css.MAIN_PANEL);

    RootPanel.get(CONTENT_PANEL).add(deck);

    exposeJSMethods();
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped */
public static Widget elementToWidget(Element e, String typ) {
    Widget result = null;//from   www  .j a  va 2 s  .  com
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped  */
public static Widget elementToWidget(String elementName, String typ) {
    Widget result = null;//w w w. j  a  v a 2s  .co m
    Element e = DOM.getElementById(elementName);
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.google.appinventor.client.explorer.youngandroid.GalleryPage.java

License:Open Source License

/**
 * Helper method called by constructor to initialize the app's meta fields
 * @param container   The container that date fields reside
 *//*ww w.j av a2 s.c o m*/
private void initAppMeta(Panel container) {
    Date createdDate = new Date();
    Date changedDate = new Date();
    if (editStatus == NEWAPP) {
    } else {
        createdDate = new Date(app.getCreationDate());
        changedDate = new Date(app.getUpdateDate());
    }
    DateTimeFormat dateFormat = DateTimeFormat.getFormat("yyyy/MM/dd");

    Label appCreatedLabel = new Label(MESSAGES.galleryCreatedDateLabel());
    appCreatedLabel.addStyleName("app-meta-label");
    container.add(appCreatedLabel);
    appCreated.setText(dateFormat.format(createdDate));
    container.add(appCreated);

    Label appChangedLabel = new Label(MESSAGES.galleryChangedDateLabel());
    appChangedLabel.addStyleName("app-meta-label");
    container.add(appChangedLabel);
    appChanged.setText(dateFormat.format(changedDate));
    container.add(appChanged);

    if (newOrUpdateApp()) {
        // GUI for editable title container
        // Set the placeholders of textarea
        moreInfoText.getElement().setPropertyString("placeholder", MESSAGES.galleryMoreInfoHint());
        creditText.getElement().setPropertyString("placeholder", MESSAGES.galleryCreditHint());

        if (editStatus == NEWAPP) {
            // If it's a new app, it will show the placeholder hint
        } else if (editStatus == UPDATEAPP) {
            // If it's not new, just set whatever's in the data field already
            moreInfoText.setText(app.getMoreInfo());
            creditText.setText(app.getCredit());
        }

        moreInfoText.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(ValueChangeEvent<String> event) {
                app.setMoreInfo(moreInfoText.getText());
            }
        });
        creditText.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(ValueChangeEvent<String> event) {
                app.setCredit(creditText.getText());
            }
        });

        moreInfoText.addStyleName("app-desc-textarea");
        creditText.addStyleName("app-desc-textarea");
        container.add(moreInfoText);
        container.add(creditText);

    } else { // Public app view
        String linktext = makeValidLink(app.getMoreInfo());
        if (linktext != null) {
            Label moreInfoLabel = new Label(MESSAGES.galleryMoreInfoLabel());
            moreInfoLabel.addStyleName("app-meta-label");
            container.add(moreInfoLabel);

            Anchor userLinkDisplay = new Anchor();
            userLinkDisplay.setText(linktext);
            userLinkDisplay.setHref(linktext);
            userLinkDisplay.setTarget("_blank");
            container.add(userLinkDisplay);
        }
        //"remixed from" field
        container.add(initRemixFromButton());

        //"credits" field
        if (app.getCredit() != null && app.getCredit().length() > 0) {
            Label creditLabel = new Label(MESSAGES.galleryCreditLabel());
            creditLabel.addStyleName("app-meta-label");
            container.add(creditLabel);

            Label creditText = new Label(app.getCredit());
            container.add(creditText);
        }
    }

    container.addStyleName("app-meta");
}