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

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

Introduction

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

Prototype

public InlineLabel() 

Source Link

Document

Creates an empty label.

Usage

From source file:cc.alcina.framework.gwt.client.ide.widget.ActionProgress.java

License:Apache License

public ActionProgress(final String id, AsyncCallback<JobTracker> completionCallback) {
    this.id = id;
    this.completionCallback = completionCallback;
    this.fp = new FlowPanel();
    fp.setStyleName("alcina-ActionProgress");
    grid = new Grid(4, 2);
    jobName = new InlineLabel();
    FlowPanel jobNCancel = new FlowPanel();
    jobNCancel.add(jobName);//from w  w w  .j a  va2 s.c o m
    jobName.setStyleName("pad-right-5");
    this.cancelLink = new Link("(Cancel)", new ClickHandler() {
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            cancelJob();
        }
    });
    jobNCancel.add(cancelLink);
    cancellingStatusMessage = new InlineLabel();
    cancellingStatusMessage.setVisible(false);
    jobNCancel.add(cancellingStatusMessage);
    addToGrid("Job", jobNCancel);
    times = new HTML();
    addToGrid("Time", times);
    message = new Label();
    message.setStyleName("message");
    addToGrid("Status", message);
    progress = new FlowPanel();
    progress.setStyleName("progress");
    bar = new FlowPanel();
    bar.setStyleName("bar");
    bar.add(progress);
    addToGrid("Progress", bar);
    grid.setCellSpacing(2);
    fp.add(grid);
    initWidget(fp);
    updateProgress();
    timer = new Timer() {
        boolean checking = false;

        @Override
        public void run() {
            AsyncCallback<JobTracker> callback = new AsyncCallback<JobTracker>() {
                public void onFailure(Throwable caught) {
                    checking = false;
                    if (maxConnectionFailure-- <= 0) {
                        stopTimer();
                        if (ActionProgress.this.completionCallback != null) {
                            ActionProgress.this.completionCallback.onFailure(caught);
                        }
                        throw new WrappedRuntimeException(caught);
                    }
                }

                public void onSuccess(JobTracker info) {
                    checking = false;
                    if (info == null) {
                        info = new JobTrackerImpl();
                        info.setJobName("Unknown job");
                        info.setComplete(true);
                        info.setProgressMessage("---");
                    }
                    if (info.isComplete()) {
                        stopTimer();
                        if (ActionProgress.this.completionCallback != null) {
                            ActionProgress.this.completionCallback.onSuccess(info);
                        }
                    }
                    setJobInfo(info);
                    fireNullPropertyChange("Updated");
                }
            };
            if (!checking) {
                ClientBase.getCommonRemoteServiceAsyncInstance().pollJobStatus(id, false, callback);
                checking = true;
            }
        }
    };
}

From source file:cc.kune.gspace.client.actions.AbstractStandaloneMenu.java

License:GNU Affero Public License

/**
 * Instantiates a new abstract standalone menu.
 *
 * @param rightsManager/*from   www . j  a va 2  s.  c om*/
 *          the rights manager
 */
@Inject
public AbstractStandaloneMenu(final AccessRightsClientManager rightsManager) {
    setStandalone(true);
    // We set a dummy widget
    setWidget(new InlineLabel());
    this.withStyles(ActionStyles.MENU_BTN_STYLE_LEFT);
    rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
        @Override
        public void onAccessRightsChanged(final AccessRightsChangedEvent event) {
            AbstractStandaloneMenu.this.setVisible(event.getCurrentRights().isEditable());
        }
    });

}

From source file:cc.kune.gspace.client.i18n.AbstractLanguageSelectorPanel.java

License:GNU Affero Public License

/**
 * Instantiates a new abstract language selector panel.
 *
 * @param i18n/*from  w  w  w .  jav a 2 s  .  c o m*/
 *          the i18n
 * @param session
 *          the session
 * @param type
 *          the type
 */
public AbstractLanguageSelectorPanel(final I18nTranslationService i18n, final Session session,
        final LanguageSelectorType type) {
    super();
    this.i18n = i18n;
    this.session = session;

    createLangChoose(type);
    titlePanel = new FlowPanel();
    fieldTitle = new InlineLabel();
    fieldSep = new InlineLabel();
    fieldTitle.addStyleName("k-fl");
    fieldTitle.addStyleName("x-form-item-label");
    fieldTitle.addStyleName("k-white-nowrap");
    fieldSep.addStyleName("k-fl");
    fieldSep.addStyleName("x-form-item-label");
    langChoose.addStyleName("k-fl");
    titlePanel.addStyleName("k-fl");
    titlePanel.addStyleName("kune-Margin-10-r");
    // fieldTitle.setWidth("140px");
    titlePanel.add(fieldTitle);
    titlePanel.add(fieldSep);
    super.add(titlePanel);
    super.add(langChoose);
    super.addStyleName("k-clean");
}

From source file:com.example.jumpnote.web.client.JumpNoteWeb.java

License:Apache License

public void loadData(final Runnable callback) {
    List<Call> calls = new ArrayList<Call>();

    // Get and populate login information
    JSONObject userInfoParams = new JSONObject();
    userInfoParams.put(JumpNoteProtocol.UserInfo.ARG_LOGIN_CONTINUE, new JSONString(Window.Location.getHref()));

    final RootPanel loginPanel = RootPanel.get("loginPanel");
    calls.add(new Call(JumpNoteProtocol.UserInfo.METHOD, userInfoParams));
    calls.add(new Call(JumpNoteProtocol.NotesList.METHOD, null));

    sJsonRpcClient.callBatch(calls, new JsonRpcClient.BatchCallback() {
        public void onData(Object[] data) {
            // Process userInfo RPC call results
            JSONObject userInfoJson = (JSONObject) data[0];
            if (userInfoJson.containsKey(JumpNoteProtocol.UserInfo.RET_USER)) {
                JumpNoteWeb.sUserInfo = (ModelJso.UserInfo) userInfoJson.get(JumpNoteProtocol.UserInfo.RET_USER)
                        .isObject().getJavaScriptObject();
                InlineLabel label = new InlineLabel();
                label.getElement().setId("userNameLabel");
                label.setText(sUserInfo.getEmail());
                loginPanel.add(label);/*  w w w .ja va  2  s .  c  om*/

                loginPanel.add(new InlineLabel(" | "));

                Anchor anchor = new Anchor("Sign out",
                        userInfoJson.get(JumpNoteProtocol.UserInfo.RET_LOGOUT_URL).isString().stringValue());
                loginPanel.add(anchor);
            } else {
                sLoginUrl = userInfoJson.get(JumpNoteProtocol.UserInfo.RET_LOGIN_URL).isString().stringValue();
                Anchor anchor = new Anchor("Sign in", sLoginUrl);
                loginPanel.add(anchor);
            }

            // Process notesList RPC call results
            JSONObject notesListJson = (JSONObject) data[1];
            if (notesListJson != null) {
                JSONArray notesJson = notesListJson.get(JumpNoteProtocol.NotesList.RET_NOTES).isArray();
                for (int i = 0; i < notesJson.size(); i++) {
                    ModelJso.Note note = (ModelJso.Note) notesJson.get(i).isObject().getJavaScriptObject();
                    sNotes.put(note.getId(), note);
                }
            }

            callback.run();
        }

        public void onError(int callIndex, JsonRpcException caught) {
            // Don't show an error if the notes.list call failed with 403 forbidden, since
            // that's normal in the case of a user not yet logging in.
            if (callIndex == 1 && caught.getHttpCode() == 403)
                return;

            showMessage("Error: " + caught.getMessage(), false);
        }
    });
}

From source file:com.google.appinventor.client.editor.simple.components.Mockmicomponente.java

License:Open Source License

/**
 * Creates a new Mockmicomponente component.
 *
 * @param editor editor of source file the component belongs to
 *//*from w w  w  . j a va  2 s.co m*/
public Mockmicomponente(SimpleEditor editor) {
    super(editor, TYPE, images.micomponente());

    // Initialize mock label UI
    labelWidget = new InlineLabel();
    labelWidget.setText("Label prueba");
    labelWidget.setStylePrimaryName("ode-SimpleMockComponent");
    //   initComponent(labelWidget);

    image = new Image();
    image.addErrorHandler(new ErrorHandler() {
        @Override
        public void onError(ErrorEvent event) {
            if (picturePropValue != null && !picturePropValue.isEmpty()) {
                OdeLog.elog("Error occurred while loading image " + picturePropValue);
            }
            refreshForm();
        }
    });
    image.addLoadHandler(new LoadHandler() {
        @Override
        public void onLoad(LoadEvent event) {
            refreshForm();
        }
    });
    VerticalPanel panel = new VerticalPanel();
    panel.setStylePrimaryName("ode-SimpleMockComponent");
    panel.addStyleName("imageComponentCenterPanel");
    panel.add(labelWidget);
    panel.add(image);
    initComponent(panel);
    //    refreshForm();
}

From source file:com.google.gerrit.client.auth.openid.OpenIdSignInDialog.java

License:Apache License

private void createErrorBox() {
    errorLine = new FlowPanel();
    DOM.setStyleAttribute(errorLine.getElement(), "visibility", "hidden");
    errorLine.setStyleName(OpenIdResources.I.css().error());

    errorMsg = new InlineLabel();
    errorLine.add(errorMsg);//  w ww .j  a v  a 2s  . c  o  m
    formBody.add(errorLine);
}

From source file:com.google.gerrit.client.auth.userpass.UserPassSignInDialog.java

License:Apache License

private void createErrorBox() {
    errorLine = new FlowPanel();
    DOM.setStyleAttribute(errorLine.getElement(), "visibility", "hidden");
    errorLine.setStyleName(UserPassResources.I.css().error());

    errorMsg = new InlineLabel();
    errorLine.add(errorMsg);/*from  www. j  a  v  a2 s.com*/
    formBody.add(errorLine);
}

From source file:com.google.gerrit.client.changes.ChangeSetComplexDisclosurePanel.java

License:Apache License

private void displayDownload() {
    final Project.NameKey projectKey = topicDetail.getTopic().getProject();
    final String projectName = projectKey.get();
    final CopyableLabel copyLabel = new CopyableLabel("");
    final DownloadCommandPanel commands = new DownloadCommandPanel();
    final DownloadUrlPanel urls = new DownloadUrlPanel(commands);
    final Set<DownloadScheme> allowedSchemes = Gerrit.getConfig().getDownloadSchemes();

    copyLabel.setStyleName(Gerrit.RESOURCES.css().downloadLinkCopyLabel());

    if (topicDetail.isAllowsAnonymous() && Gerrit.getConfig().getGitDaemonUrl() != null
            && (allowedSchemes.contains(DownloadScheme.ANON_GIT)
                    || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
        StringBuilder r = new StringBuilder();
        r.append(Gerrit.getConfig().getGitDaemonUrl());
        r.append(projectName);//from  w w  w  .j  a v a  2 s.  c o m
        r.append(" ");
        r.append(changeSet.getRefName());
        urls.add(new DownloadUrlLink(DownloadScheme.ANON_GIT, Util.M.anonymousDownload("Git"), r.toString()));
    }

    if (topicDetail.isAllowsAnonymous() && (allowedSchemes.contains(DownloadScheme.ANON_HTTP)
            || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
        StringBuilder r = new StringBuilder();
        r.append(GWT.getHostPageBaseURL());
        r.append("p/");
        r.append(projectName);
        r.append(" ");
        r.append(changeSet.getRefName());
        urls.add(new DownloadUrlLink(DownloadScheme.ANON_HTTP, Util.M.anonymousDownload("HTTP"), r.toString()));
    }

    if (Gerrit.getConfig().getSshdAddress() != null && Gerrit.isSignedIn()
            && Gerrit.getUserAccount().getUserName() != null
            && Gerrit.getUserAccount().getUserName().length() > 0
            && (allowedSchemes.contains(DownloadScheme.SSH)
                    || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
        String sshAddr = Gerrit.getConfig().getSshdAddress();
        final StringBuilder r = new StringBuilder();
        r.append("ssh://");
        r.append(Gerrit.getUserAccount().getUserName());
        r.append("@");
        if (sshAddr.startsWith("*:") || "".equals(sshAddr)) {
            r.append(Window.Location.getHostName());
        }
        if (sshAddr.startsWith("*")) {
            sshAddr = sshAddr.substring(1);
        }
        r.append(sshAddr);
        r.append("/");
        r.append(projectName);
        r.append(" ");
        r.append(changeSet.getRefName());
        urls.add(new DownloadUrlLink(DownloadScheme.SSH, "SSH", r.toString()));
    }

    if (Gerrit.isSignedIn() && Gerrit.getUserAccount().getUserName() != null
            && Gerrit.getUserAccount().getUserName().length() > 0
            && (allowedSchemes.contains(DownloadScheme.HTTP)
                    || allowedSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS))) {
        String base = GWT.getHostPageBaseURL();
        int p = base.indexOf("://");
        int s = base.indexOf('/', p + 3);
        if (s < 0) {
            s = base.length();
        }
        String host = base.substring(p + 3, s);
        if (host.contains("@")) {
            host = host.substring(host.indexOf('@') + 1);
        }

        final StringBuilder r = new StringBuilder();
        r.append(base.substring(0, p + 3));
        r.append(Gerrit.getUserAccount().getUserName());
        r.append('@');
        r.append(host);
        r.append(base.substring(s));
        r.append("p/");
        r.append(projectName);
        r.append(" ");
        r.append(changeSet.getRefName());
        urls.add(new DownloadUrlLink(DownloadScheme.HTTP, "HTTP", r.toString()));
    }

    if (allowedSchemes.contains(DownloadScheme.REPO_DOWNLOAD)) {
        // This site prefers usage of the 'repo' tool, so suggest
        // that for easy fetch.
        //
        final StringBuilder r = new StringBuilder();
        r.append("repo download ");
        r.append(projectName);
        r.append(" ");
        r.append(topicDetail.getTopic().getTopicId());
        r.append("/");
        r.append(changeSet.getChangeSetId());
        final String cmd = r.toString();
        commands.add(new DownloadCommandLink(DownloadCommand.REPO_DOWNLOAD, "repo download") {
            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(false);
                copyLabel.setText(cmd);
            }
        });
    }

    if (!urls.isEmpty()) {
        commands.add(new DownloadCommandLink(DownloadCommand.CHECKOUT, "checkout") {
            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(true);
                copyLabel.setText("git fetch " + link.urlData + " && git checkout FETCH_HEAD");
            }
        });
        commands.add(new DownloadCommandLink(DownloadCommand.PULL, "pull") {
            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(true);
                copyLabel.setText("git pull " + link.urlData);
            }
        });
        commands.add(new DownloadCommandLink(DownloadCommand.CHERRY_PICK, "cherry-pick") {
            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(true);
                copyLabel.setText("git fetch " + link.urlData + " && git cherry-pick FETCH_HEAD");
            }
        });
        commands.add(new DownloadCommandLink(DownloadCommand.FORMAT_PATCH, "patch") {
            @Override
            void setCurrentUrl(DownloadUrlLink link) {
                urls.setVisible(true);
                copyLabel.setText("git fetch " + link.urlData + " && git format-patch -1 --stdout FETCH_HEAD");
            }
        });
    }

    final FlowPanel fp = new FlowPanel();
    if (!commands.isEmpty()) {
        final AccountGeneralPreferences pref;
        if (Gerrit.isSignedIn()) {
            pref = Gerrit.getUserAccount().getGeneralPreferences();
        } else {
            pref = new AccountGeneralPreferences();
            pref.resetToDefaults();
        }
        commands.select(pref.getDownloadCommand());
        urls.select(pref.getDownloadUrl());

        FlowPanel p = new FlowPanel();
        p.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeader());
        p.add(commands);
        final InlineLabel glue = new InlineLabel();
        glue.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeaderGap());
        p.add(glue);
        p.add(urls);

        fp.add(p);
        fp.add(copyLabel);
    }
    infoTable.setWidget(R_DOWNLOAD, 1, fp);
}

From source file:com.google.gerrit.client.download.DownloadPanel.java

License:Apache License

protected void setupWidgets() {
    if (!commands.isEmpty()) {
        final AccountGeneralPreferences pref;
        if (Gerrit.isSignedIn()) {
            pref = Gerrit.getUserAccount().getGeneralPreferences();
        } else {//from www .j a  va 2 s . c  om
            pref = new AccountGeneralPreferences();
            pref.resetToDefaults();
        }
        commands.select(pref.getDownloadCommand());
        urls.select(pref.getDownloadUrl());

        FlowPanel p = new FlowPanel();
        p.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeader());
        p.add(commands);
        final InlineLabel glue = new InlineLabel();
        glue.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeaderGap());
        p.add(glue);
        p.add(urls);

        add(p);
        add(copyLabel);
    }
}

From source file:com.google.gerrit.client.RpcStatus.java

License:Apache License

RpcStatus(final Panel p) {
    final FlowPanel r = new FlowPanel();
    r.setStyleName(Gerrit.RESOURCES.css().rpcStatusPanel());
    p.add(r);//from ww w  .  j a  v a 2s .  c o m

    loading = new InlineLabel();
    loading.setText(Gerrit.C.rpcStatusWorking());
    loading.setStyleName(Gerrit.RESOURCES.css().rpcStatus());
    loading.addStyleName(Gerrit.RESOURCES.css().rpcStatusLoading());
    loading.setVisible(false);
    r.add(loading);
}