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

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

Introduction

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

Prototype

public Hyperlink(String text, DirectionEstimator directionEstimator, String targetHistoryToken) 

Source Link

Document

Creates a hyperlink with its text and target history token specified.

Usage

From source file:asquare.gwt.tkdemo.client.demos.DialogPanel.java

License:Apache License

private Widget createDoc() {
    String content = "<H2>ModalDialog</H2>" + "<h4>Features</h4>" + "<ul>"
            + "<li>automatic centering in browser's main viewport</li>"
            + "<li>light box effect (using <span id='glassPanelRef'></span>)</li>"
            + "<li>caption allows child widgets</li>" + "<li>caption prevents text selection</li>"
            + "<li>focus management and containment (internal tab cycle)</li>"
            + "<li>can focus a widget upon dismissal</li>"
            + "<li>minimim size enforcement for content panel (optional, default is 200 x 75 px)</li>" + "</ul>"
            + "<H2>AlertDialog</H2>" + "<h4>Features</h4>" + "<ul>"
            + "<li>icon in the caption indicates severity</li>"
            + "<li>default button is automatically focused</li>" + "<li>cancel button is mapped to Esc key</li>"
            + "<li>button hot keys + Esc + Enter</li>" + "<li>focus cycle traversable with arrow keys</li>"
            + "</ul>";
    HTMLPanel description = new HTMLPanel(content);
    Hyperlink glassPanelLink = new Hyperlink("GlassPanel", false, GlassPanelDemo.NAME);
    DomUtil.setStyleAttribute(glassPanelLink, "display", "inline");
    description.add(glassPanelLink, "glassPanelRef");
    description.setStyleName("description division");
    return description;
}

From source file:com.edgenius.wiki.gwt.client.render.PageRender.java

License:Open Source License

/**
 * @param spaceUname /*from   ww w  . j  a v  a2s  . c om*/
 * @param panel
 * @param model
 * @param pieces: could be pageContent, or side bar content 
 * @param isPreivew: if this render is for preview window
 */
public void renderContent(final String spaceUname, PageModel page, List<RenderPiece> pieces,
        boolean isPreivew) {
    //most stuff only need renderPiece, except PageAuthorPanel at moment
    widgetRenderContent = new StringBuffer();
    widgetCounter.clear();
    widgetContainer.clear();

    panel.clear();

    if (pieces != null) {
        int size = pieces.size();
        for (int idx = 0; idx < size; idx++) {
            Object piece = pieces.get(idx);
            if (piece instanceof LinkModel) {
                LinkModel ln = (LinkModel) piece;
                if (listeners != null) {
                    fireRenderEvent(ln.getView());
                }
                final String anchorTxt = StringUtil.isBlank(ln.getAnchor()) ? ""
                        : (EscapeUtil.escapeToken(ln.getAnchor().trim()));
                if (anchorTxt.length() != 0 && StringUtil.isBlank(ln.getLink())) {
                    //[view>#anchor] style: will only redirect to anchor in same page
                    ClickLink link = new ClickLink(ln.getView(), true);
                    link.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
                            GwtClientUtils.gotoAnchor(anchorTxt);
                        }
                    });
                    panel.add(link);
                } else if (ln.getType() == LinkModel.LINK_TO_CLIENT_CLICK_LINK) {
                    final String[] token = LinkUtil.parseCLinkParamters(ln.getLink());
                    if (token != null && token.length > 0) {
                        //If it has anchor field, it will be treated as hyper link.Otherwise, ClickLink
                        if (!StringUtil.isEmpty(ln.getAnchor())) {
                            //now it only support user popup - so need to consolidate if want to more functions 
                            EventfulHyperLink link = new EventfulHyperLink(ln.getView(), ln.getAnchor());
                            String method = token[0];
                            String[] params = null;
                            if (token.length > 1) {
                                params = new String[token.length - 1];
                                for (int idx1 = 1; idx1 < token.length; idx1++) {
                                    params[idx1 - 1] = token[idx1];
                                }
                            }
                            JavascriptExposer.run(method, params, link);
                            panel.add(link);
                        } else {
                            //click link
                            ClickLink link = new ClickLink(ln.getView(), true);
                            link.addClickHandler(new ClickHandler() {
                                public void onClick(ClickEvent event) {
                                    String method = token[0];
                                    String[] params = null;
                                    if (token.length > 1) {
                                        params = new String[token.length - 1];
                                        for (int idx = 1; idx < token.length; idx++) {
                                            params[idx - 1] = token[idx];
                                        }
                                    }
                                    JavascriptExposer.run(method, params, (Widget) event.getSource());
                                }
                            });
                            panel.add(link);
                        }
                    } else {
                        panel.add(new HTML(ln.getView()));
                        Log.error("Unable pasre link with type 'client click link':" + ln.getLink());
                    }
                } else if (ln.getType() == LinkModel.LINK_TO_SERVER_CLICK_LINK) {

                } else {
                    if (isPreivew) {
                        ClickLink link = new ClickLink(ln.getView(), true);
                        link.addClickHandler(new ClickHandler() {
                            public void onClick(ClickEvent event) {
                                Window.alert(Msg.consts.preview_disable_link());
                            }
                        });
                        panel.add(link);
                    } else {
                        String tokenName = ln.getLink();

                        String linkSpaceUname = ln.getSpaceUname();
                        //extspace or current space,  if null(failure tolerance) use current spaceUname as value
                        linkSpaceUname = (linkSpaceUname == null || linkSpaceUname.trim().length() == 0)
                                ? spaceUname
                                : linkSpaceUname;
                        if (ln.getType() == LinkModel.LINK_TO_CREATE_FLAG) {
                            //$CREATE ,for link to non-exist page, or for "PAGE_NOT_FOUND" case
                            tokenName = GwtUtils.buildToken(PageMain.TOKEN_CREATE, linkSpaceUname, tokenName);
                        } else if (ln.getType() == LinkModel.LINK_TO_CREATE_HOME_FLAG) {
                            tokenName = GwtUtils.buildToken(PageMain.TOKEN_CREATE_HOME, linkSpaceUname,
                                    tokenName);
                        } else if (ln.getType() == LinkModel.LINK_TO_OPEN_NEW_WIN) {
                            //no use so far
                            tokenName = GwtUtils.buildToken(PageMain.TOKEN_OPEN_NEW_WINDOW, linkSpaceUname,
                                    tokenName);
                        } else if (ln.getType() == LinkModel.LINK_TO_HYPER_TOKEN) {
                            //keep token unchanged - nothing to do here.
                        } else
                            tokenName = GwtUtils.getSpacePageToken(linkSpaceUname, tokenName);

                        tokenName += (anchorTxt == "" ? "" : "#" + anchorTxt);
                        Hyperlink link = new Hyperlink(ln.getView(), true, tokenName);
                        panel.add(link);
                    }
                }
            } else if (piece instanceof MacroModel) {
                MacroModel rs = (MacroModel) piece;
                if (rs != null) {

                    if (rs.macroName.equalsIgnoreCase(SharedConstants.MACRO_SPACE_ADMIN)) {
                        SpaceAdminRenderWidget adminPanel = new SpaceAdminRenderWidget(spaceUname);
                        panel.add(adminPanel);
                        widgetContainer.add(adminPanel);
                        adminPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);

                    } else if (rs.macroName.equalsIgnoreCase(SharedConstants.MACRO_NOTIFY_SYSADMIN)) {
                        SendingNotifyRenderWidget adminPanel = new SendingNotifyRenderWidget();
                        panel.add(adminPanel);
                        widgetContainer.add(adminPanel);
                        adminPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_TAG_CLOUD)) {
                        TagCloudRenderWidget macroPanel = new TagCloudRenderWidget(spaceUname);
                        panel.add(macroPanel);
                        widgetContainer.add(macroPanel);
                        macroPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_TEMPLATE_LIST)) {
                        TemplateListRenderWidget macroPanel = new TemplateListRenderWidget(spaceUname);
                        panel.add(macroPanel);
                        widgetContainer.add(macroPanel);
                        macroPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_SEARCH)) {
                        String keyword = (String) rs.values.get(NameConstants.KEYWORD);
                        SearchRenderWidget macroPanel = new SearchRenderWidget(keyword);
                        panel.add(macroPanel);
                        widgetContainer.add(macroPanel);
                        macroPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_USER_PROFILE)) {
                        String username = rs.values.get(NameConstants.USERNAME);
                        UserProfileRenderWidget macroPanel = new UserProfileRenderWidget(username);
                        panel.add(macroPanel);
                        widgetContainer.add(macroPanel);
                        macroPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);

                    } else if (rs.macroName.equals(SharedConstants.MACRO_INCLUDE)) {
                        String src = rs.values.get(NameConstants.SRC);

                        LinkModel link = LinkUtil.parseMarkup(src);
                        if (StringUtil.isBlank(link.getSpaceUname())) {
                            //if @space is blank, treat as current space 
                            link.setSpaceUname(spaceUname);
                        }
                        IncludeRenderWidget includePanel = new IncludeRenderWidget(link);
                        panel.add(includePanel);
                        widgetContainer.add(includePanel);
                        includePanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);

                    } else if (rs.macroName.equals(SharedConstants.MACRO_COMMENT)) {
                        String title = (String) rs.values.get(NameConstants.TITLE);
                        ClickLink comment = new ClickLink(title);
                        comment.addClickHandler(new ClickHandler() {
                            public void onClick(ClickEvent event) {
                                if (BaseEntryPoint.I != null && BaseEntryPoint.I instanceof PageMain) {
                                    PageMain main = ((PageMain) BaseEntryPoint.I);
                                    if (main.getVisiblePanelIndex() == PageMain.VIEW_PANEL) {
                                        main.viewPanel.tabPanel.newComment();
                                        return;
                                    }
                                }
                                Window.alert(Msg.consts.not_available_mode());
                            }
                        });
                        widgetRenderContent.append(title);
                        panel.add(comment);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_PORTAL)) {
                        boolean show = BooleanUtil.toBooleanTrue(rs.values.get(NameConstants.SHOWLOGO));
                        int column = NumberUtil.toInt(rs.values.get(NameConstants.COLUMNS), -1);
                        if (column == -1) {
                            //this is just for makes this macro can tolerance spell error - colunm or columns
                            column = NumberUtil.toInt(rs.values.get(NameConstants.COLUMN), -1);
                        }
                        if (column == -1) {
                            column = SharedConstants.DEFAULT_PORTAL_COLUMNS;
                        }
                        if (visitor == null) {
                            //default portal visitor - don't use InstancePortalVisitor as it is dangerous to change default dashboard
                            visitor = new HomePortalVisitor();
                        }
                        Portal portal = new Portal(visitor, column, show);
                        panel.add(portal);
                        widgetContainer.add(portal);
                        portal.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_FEEDBACK)) {
                        String imgOn = rs.values.get(NameConstants.IMAGE);
                        HasClickHandlers btn;
                        if (StringUtil.isBlank(imgOn)) {
                            //text base link
                            String title = (String) rs.values.get(NameConstants.TITLE);
                            btn = new ClickLink(title);
                        } else {
                            btn = new Image(imgOn);
                        }
                        btn.addClickHandler(new ClickHandler() {
                            public void onClick(ClickEvent event) {
                                FeedbackDialog dialog = new FeedbackDialog();
                                dialog.showbox();
                            }
                        });

                        //for hide welcome message
                        widgetRenderContent.append("feedback");//NON-I18N
                        panel.add((Widget) btn);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_SIGNUP)) {
                        String imgOn = rs.values.get(NameConstants.IMAGE);
                        HasClickHandlers btn;
                        if (StringUtil.isBlank(imgOn)) {
                            //text base link
                            String title = (String) rs.values.get(NameConstants.TITLE);
                            btn = new ClickLink(title);
                        } else {
                            btn = new Image(imgOn);
                        }
                        btn.addClickHandler(new ClickHandler() {
                            public void onClick(ClickEvent event) {
                                LoginDialog dialogue = new LoginDialog(LoginDialog.SINGUP);
                                dialogue.showbox();
                            }
                        });

                        //for hide welcome message
                        widgetRenderContent.append("signup");//NON-I18N
                        panel.add((Widget) btn);
                    }
                }
            } else if (piece instanceof TextModel) {
                String text = ((TextModel) piece).toString();
                panel.add(text);
                if (listeners != null) {
                    fireRenderEvent(text);
                }
            }
        }
    }

    panel.submit();

    if (listeners != null) {
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            public void execute() {
                attemptFireRenderEnd();
            }

        });
    }
}

From source file:com.edgenius.wiki.gwt.client.render.UserProfileRenderWidget.java

License:Open Source License

private void refreshUserProfile(UserProfileModel model) {
    final UserModel user = model.profile;
    portrait.setWidget(GwtClientUtils.createUserPortrait(user.getPortrait()));
    fullname.setText(user.getFullname());
    loginname.setText(user.getLoginname());

    contacts.setUser(user);/*from   ww  w. j  av  a 2 s. co m*/

    actionP.clear();

    if (user.getFollowing() >= 0) {
        //don't allow send or follow anonymous to someone, or some to anonymous, or login and viewing user are same user
        ClickLink sendMsg = new ClickLink(Msg.consts.send_message());
        sendMsg.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                SendMessageDialog dlg = new SendMessageDialog(user.getLoginname());
                dlg.showbox();
            }
        });
        actionP.add(sendMsg);

        //don't allow follow anonymous
        actionP.add(new FollowLink(user.getFollowing(), user.getLoginname()));
    }

    status.setStyleName(Css.STATUS);
    status.setText(StringUtil.trimToEmpty(user.getStatus()));

    //following and followers
    int row = followingP.getRowCount();
    for (int idx = row - 1; idx >= 0; idx--) {
        followingP.removeRow(idx);
    }
    followingP.setWidget(0, 0, new Label(Msg.consts.following()));
    followingP.getFlexCellFormatter().setColSpan(0, 0, 3);
    followingP.getFlexCellFormatter().setStyleName(0, 0, Css.HEADER);

    row = followerP.getRowCount();
    for (int idx = row - 1; idx >= 0; idx--) {
        followerP.removeRow(idx);
    }
    followerP.setWidget(0, 0, new Label(Msg.consts.followers()));
    followerP.getFlexCellFormatter().setColSpan(0, 0, 3);
    followerP.getFlexCellFormatter().setStyleName(0, 0, Css.HEADER);

    row = 1;
    int col = 0;
    if (model.following.size() > 0) {
        for (UserModel fer : model.following) {
            Hyperlink link = new Hyperlink(
                    GwtUtils.getUserPortraitHTML(fer.getPortrait(), fer.getFullname(), 55), true,
                    GwtUtils.buildToken(GwtUtils.getCPageToken(SharedConstants.CPAGE_USER_PROFILE),
                            fer.getLoginname()));
            followingP.setWidget(row, col, link);
            if (++col > 2) {
                row++;
                col = 0;
            }
        }
        if (row == 1 && col < 3) {
            //append blank
            for (int idx = col; idx < 3; idx++) {
                followingP.setWidget(row, idx, new HTML("&nbsp;"));
            }
        }
        followingP.getFlexCellFormatter().setWidth(1, 0, "33%");
        followingP.getFlexCellFormatter().setWidth(1, 1, "33%");
        followingP.getFlexCellFormatter().setWidth(1, 2, "33%");
    } else {
        followingP.setWidget(row, 0, new Label(Msg.consts.none()));
    }

    row = 1;
    col = 0;
    if (model.followers.size() > 0) {
        for (UserModel fer : model.followers) {
            Hyperlink link = new Hyperlink(
                    GwtUtils.getUserPortraitHTML(fer.getPortrait(), fer.getFullname(), 55), true,
                    GwtUtils.buildToken(GwtUtils.getCPageToken(SharedConstants.CPAGE_USER_PROFILE),
                            fer.getLoginname()));
            followerP.setWidget(row, col, link);
            if (++col > 2) {
                row++;
                col = 0;
            }
        }
        if (row == 1 && col < 3) {
            //append blank
            for (int idx = col; idx < 3; idx++) {
                followerP.setWidget(row, idx, new HTML("&nbsp;"));
            }
        }
        followerP.getFlexCellFormatter().setWidth(1, 0, "33%");
        followerP.getFlexCellFormatter().setWidth(1, 1, "33%");
        followerP.getFlexCellFormatter().setWidth(1, 2, "33%");

    } else {
        followerP.setWidget(row, 0, new Label(Msg.consts.none()));
    }

}

From source file:com.qqtem.LoginManager.client.QqTem.java

License:Open Source License

public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get();
    rootPanel.setSize("100%", "100%");

    Window.setTitle("qqTem - Login");

    FlexTable flexTable = new FlexTable();
    rootPanel.add(flexTable, 0, 0);/*ww  w.j  av  a2s  .  c o m*/
    flexTable.setWidth("100%");

    Image logo = new Image("logo.png");
    flexTable.setWidget(0, 0, logo);

    logout = new Hyperlink("Logout", false, "newHistoryToken");
    logout.setVisible(false);
    logout.setWidth("45px");

    logout.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            QqTem.realizaLogout();
        }
    });
    flexTable.setWidget(1, 0, logout);

    verticalPanel = new VerticalPanel();
    flexTable.setWidget(2, 0, verticalPanel);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    verticalPanel.setSize("100px", "100px");

    horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);

    Login login = new Login();
    horizontalPanel.add(login);

    flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
    flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    flexTable.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.getCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);
}

From source file:com.qut.middleware.esoemanager.client.ui.panels.ServiceCreationPanel.java

License:Apache License

private void createCompletedInterface() {
    this.createdPanel = new VerticalPanel();
    this.createdPanel.setVisible(false);

    Label serviceCreated = new Label("The service has been successfully created");
    Hyperlink serviceLink = new Hyperlink("View service details", false, null);
    Hyperlink createLink = new Hyperlink("Create another service", false, null);

    serviceLink.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            ShowServiceDetailsEvent event = new ShowServiceDetailsEvent(EventConstants.showServiceDetails,
                    lastCreatedServiceID);
            EventController.executeEvent(event);
        }//w ww .  ja va  2 s  . c om
    });

    createLink.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            createdPanel.setVisible(false);
            createPanel.setVisible(true);
        }
    });

    this.createdPanel.add(serviceCreated);
    this.createdPanel.add(serviceLink);
    this.createdPanel.add(createLink);
}

From source file:n3phele.client.BasePanel.java

License:Open Source License

public void enableDecorations(List<MenuItem> initMainMenu) {
    if (!gotDecorations) {
        gotDecorations = true;/*w ww  .j  a  v  a2 s  . co  m*/
        this.lhs.clear();
        this.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER,
                HasVerticalAlignment.ALIGN_TOP);
        layout = new LayoutPanel();
        layout.setWidth("200px");
        setLeftHandIcon(null);

        //         int scaledHeight = 109;
        //         int scaledFacebookHeight = N3phele.n3pheleResource.facebook().getHeight()*32/N3phele.n3pheleResource.facebook().getWidth();
        //         ImageAnchor facebook = new ImageAnchor();
        //         facebook.setResource(N3phele.n3pheleResource.facebook(), 32, scaledFacebookHeight);
        //         facebook.setHref("http://www.facebook.com/pages/N3phele/180516518659652");
        ////         Image facebook = new Image(N3phele.n3pheleResource.facebook().getURL());
        ////         facebook.setPixelSize(32,scaledFacebookHeight );
        //         layout.add(facebook);
        //         layout.setWidgetTopHeight(facebook, scaledHeight+10.0, Unit.PX, scaledFacebookHeight, Unit.PX);
        layout.setHeight(100 + "px");
        this.lhs.add(layout);

        if (initMainMenu != null) {
            for (MenuItem item : initMainMenu) {
                menuMap.put(item.getPlaceClass(), item);
            }
        }
        menuModel = new MainMenuTreeViewModel(initMainMenu);
        Resources res = GWT.create(MenuTreeResource.class);
        navigation = new CellTree(menuModel, null, res);
        navigation.setAnimationEnabled(true);

        this.lhs.add(new HTML("<hr align=left width=100%>"));
        this.lhs.add(navigation);
        this.lhs.add(new HTML("<hr align=left width=100%>"));

        VerticalPanel stack = new VerticalPanel();
        this.username = new HTML();
        this.username.addStyleName(N3phele.n3pheleResource.css().gwtHTMLBasePanelUsername());
        updateUser(AuthenticatedRequestFactory.getUser());
        stack.add(this.username);

        this.hprlnkEditProfile = new Hyperlink("edit profile", false, "user:");
        this.hprlnkEditProfile.addStyleName(N3phele.n3pheleResource.css().gwtHyperlinkBasePanelEditProfile());
        stack.add(this.hprlnkEditProfile);
        stack.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
        this.menu.add(stack);
        this.menu.setCellHorizontalAlignment(stack, HasHorizontalAlignment.ALIGN_RIGHT);

    }

}

From source file:n3phele.client.widgets.WorkspaceVerticalPanel.java

License:Open Source License

protected Hyperlink createHyperlink(MenuItem m) {
    String html = "<img style='border:none; vertical-align:bottom; margin:-2px; padding-right:2px;' width=20 height=20 src='"
            + m.getUrl() + "'/>" + m.getText();
    Hyperlink h = new Hyperlink(html, true, m.getPlaceToken());
    return h;/*w w  w  . j  av a 2s  .c om*/
}

From source file:org.apache.hupa.widgets.ui.EnableHyperlink.java

License:Apache License

public EnableHyperlink(String text, boolean asHTML, String historyToken) {

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1950a39b60x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1950a39b60x1_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1950a39b6_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1950a39b60x2");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1899456750x20x00x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1899456750x2_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1899456750x1_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a189945675_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1899456750x20x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1899456750x0");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14f0aa52d0x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14f0aa52d0x2_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14f0aa52d0x1_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14f0aa52d");
    InstrumentationLoggerProvider.get()//w w w .  ja  va  2 s.c om
            .instrument("org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a1");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x3_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x4_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x2_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x10x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x20x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x30x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x1_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x00x00x00x10x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x00x00x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x00x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x00x00x00x1_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x00x00x00x2_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x00x00x00x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x00x00x00x20x0");
    link = historyToken != null ? new Hyperlink(text, asHTML, historyToken) : new Anchor(text);
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x10x00x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x10x00x00x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x1_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x10x0");
    html = new HTML();

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x2_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x20x0");
    panel.setStyleName(WidgetsCSS.C_hyperlink);
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x30x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x3_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x30x00x0");
    html.setStyleName(link.getStyleName());
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x40x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x4");
    html.addStyleDependentName("disabled");

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x5_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x50x0");
    if (asHTML) {
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x50x00x00x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x50x00x0");
        html.setHTML(text);
    } else {
        InstrumentationLoggerProvider.get()
                .instrument("org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x50x1");
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x50x10x0_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x50x10x00x0");
        html.setText(text);
    }

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x6_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x60x0");
    panel.setWidget(link);
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x7_____org_apache_hupa_widgets_ui_EnableHyperlink_java0x028fba2a14b03927a0x40x70x0");
    initWidget(panel);
}

From source file:org.dataconservancy.dcs.access.client.model.JsFile.java

License:Apache License

public Widget display() {
    FlowPanel panel = new FlowPanel();

    if (!getSource().isEmpty()) {

        Button b = new Button("Download");
        panel.add(b);/*from  w  w w.  j  a  va2 s.  c  o m*/

        b.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String source = SeadApp.datastreamURLnoEncoding(getId().replace(":", "%3A"));

                String strWindowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
                Window.open(source, "_blank", strWindowFeatures);
            }
        });

        //panel.add(new Anchor("Download", false, getSource(), "_blank"));
    }

    final FlexTable table = Util.createTable(//"Id",
            "Entity type", "Name", "Appears in Collections", "Size", "Valid", "Extant", "Metadata refs",
            "Alternate Ids", "Primary Location", "ACR Location");

    Util.addColumn(table,
            // null,
            "File", getName(), null, "" + getSizeBytes() + " bytes",
            getValid() == null ? "Unknown" : "" + getValid(), "" + isExtant());

    // table.setWidget(0, 1, Util.entityLink(getId()));

    JsonpRequestBuilder rb = new JsonpRequestBuilder();
    String parentdu = SeadApp.accessurl + SeadApp.queryPath + "?q=" + "id:(\"" + getParent() + "\")"
            + "&offset=0&max=200";
    rb.requestObject(parentdu, new AsyncCallback<JsSearchResult>() {

        public void onFailure(Throwable caught) {
            Window.alert("Failed");
        }

        public void onSuccess(JsSearchResult dus) {

            FlowPanel desc = new FlowPanel();

            for (int i = 0; i < dus.matches().length(); i++) {
                JsMatch m = dus.matches().get(i);

                JsDeliverableUnit entity = (JsDeliverableUnit) m.getEntity();

                //System.out.println("Title="+entity.getCoreMd().getTitle());
                desc.add(new Hyperlink(" " + entity.getCoreMd().getTitle(), true,
                        SeadState.ENTITY.toToken(entity.getId())));
            }
            table.setWidget(2, 1, desc);
        }
    });

    if (getMetadataRefs() != null) {
        table.setWidget(6, 1, Util.entityLinks(getMetadataRefs()));
    }

    FlowPanel primaryLocPanel = new FlowPanel();

    if (getPrimaryDataLocation() != null)
        primaryLocPanel.add(getPrimaryDataLocation().display());

    if (getAlternateIds() != null) {
        final JsArray<JsAlternateId> altIds = getAlternateIds();
        FlowPanel altIdPanel = new FlowPanel();
        final FlowPanel altLocPanel = new FlowPanel();

        for (int i = 0; i < altIds.length(); i++) {

            final String type = altIds.get(i).getTypeId();
            final String value = altIds.get(i).getIdValue();
            AsyncCallback<List<MediciInstance>> callback = new AsyncCallback<List<MediciInstance>>() {

                @Override
                public void onSuccess(List<MediciInstance> result) {
                    for (MediciInstance instance : result) {
                        if (instance.getType().equalsIgnoreCase(type)) {
                            final String finalLink = instance.getUrl() + "/#dataset?id=" + value;
                            String altIdStr = getName();

                            Label altIdLabel = Util.label(altIdStr, "Hyperlink");
                            altIdLabel.addClickHandler(new ClickHandler() {
                                @Override
                                public void onClick(ClickEvent event) {
                                    Window.open(finalLink, "_blank", "");

                                }
                            });
                            altLocPanel.add(altIdLabel);
                            break;
                        }

                    }

                }

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                }
            };
            MediciIngestPresenter.mediciService.getAcrInstances(callback);

        }
        table.setWidget(7, 1, altIdPanel);
        table.setWidget(8, 1, primaryLocPanel);
        table.setWidget(9, 1, altLocPanel);
    }

    //belongs to dataset
    panel.add(table);

    if (getFormats() != null && getFormats().length() > 0) {
        panel.add(Util.label("Formats", "SubSectionHeader"));
        JsFormat.display(panel, getFormats());
    }

    if (getMetadata() != null && getMetadata().length() > 0) {
        panel.add(Util.label("Additional metadata", "SubSectionHeader"));
        JsMetadata.display(panel, getMetadata());
    }

    if (getFixity() != null && getFixity().length() > 0) {
        panel.add(Util.label("Fixity", "SubSectionHeader"));
        JsFixity.display(panel, getFixity());
    }

    return panel;
}

From source file:org.dataconservancy.dcs.access.client.presenter.FacetedSearchPresenter.java

License:Apache License

private void displaySearchResults(String query, JsSearchResult result, String facets, SearchInput searchInput,
        boolean isAdvanced) {

    content.add(Util.label("Total matches: " + result.total(), "SectionHeader"));

    int numpages = (int) result.total() / Constants.MAX_SEARCH_RESULTS;

    if (result.total() % Constants.MAX_SEARCH_RESULTS != 0) {
        numpages++;//w  ww .j  a va2 s  .  c o  m
    }

    int page = result.offset() / Constants.MAX_SEARCH_RESULTS;

    content.add(new ResultNavigationWidget(page, numpages, searchInput, result.total(), isAdvanced));

    Grid grid = new Grid(Constants.MAX_SEARCH_RESULTS, 1);

    if (result.total() > 0) {
        grid.setStylePrimaryName("FacetedResults");
        //              grid.setWidget(0, 0, Util.label("Dataset Name","SubSectionHeader"));
    }

    for (int i = 0; i < result.matches().length(); i++) {
        JsMatch m = result.matches().get(i);

        int resultrow = (i + 1) % Constants.MAX_SEARCH_RESULTS;

        JsEntity entity = m.getEntity();
        FlowPanel desc = new FlowPanel();
        desc.setStyleName("SearchTable");
        grid.setWidget(resultrow, 0, desc);
        grid.getCellFormatter().addStyleName(resultrow, 0, "SearchRow");

        if (i % 2 == 0) {
            grid.getCellFormatter().addStyleName(resultrow, 0, "SearchRow");
        } else {
            grid.getCellFormatter().addStyleName(resultrow, 0, "SearchRowAlt");
        }

        Hyperlink title;

        if (m.getEntityType().equals("file"))
            title = new Hyperlink(m.getSummaryStr(), true,
                    SeadState.ENTITY.toToken(((JsFile) m.getEntity()).getParent()));
        else
            title = new Hyperlink(m.getSummaryStr(), true, SeadState.ENTITY.toToken(entity.getId()));

        title.setStyleName("my-HyperLink");
        desc.add(title);

        if (m.getEntityType().equals("deliverableUnit")) {
            JsArray<JsCreator> creators = ((JsDeliverableUnit) m.getEntity()).getCreators();
            if (creators.length() > 0) {
                String authors = "";
                for (int j = 0; j < creators.length(); j++)
                    authors += creators.get(j).getCreatorName();
                desc.add(new HTML("<span class='ResultSnippet'>Author(s):</span>" + authors));
                desc.add(new HTML("<br> "));
            }
        }

        if (entity.getAbstract() != null) {
            int len = 250;
            if (entity.getAbstract().length() < len)
                len = entity.getAbstract().length();
            if (entity.getAbstract().length() > 0) {
                desc.add(new HTML("<span class='ResultSnippet'>About:</span>"
                        + entity.getAbstract().substring(0, len) + ".."));
                desc.add(new HTML("<br> "));
            }
        }

        if (!m.getContext().isEmpty()) {
            String context = m.getContext().replaceAll("\\w+\\:|\\'\\[|\\]\\'", " ");
            context = context.substring(0, context.indexOf("FacetCategory"));
            desc.add(new HTML("<span class='ResultSnippet'>" + "Appears in:</span>" + context));
            desc.add(new HTML("<br> "));
        }
    }

    grid.setWidth("100%");
    content.add(grid);
    //panel.add(new ResultNavigationWidget(page, numpages,query,facets));
}