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:com.apress.progwt.client.college.gui.timeline.ProcessTimeline.java

License:Apache License

public void showStatus(TimeLineObj<ProcessTimeLineEntry> tlo) {

    ProcessTimeLineEntry pte = tlo.getObject();

    timeline.showStatus(new Label(pte.getProcessType().getName()));

}

From source file:com.apress.progwt.client.college.ToCollegeApp.java

License:Apache License

protected void error(Exception e) {

    Log.error("e: " + e);

    e.printStackTrace();//from  w w w.  j  av  a 2 s.c  o  m

    VerticalPanel panel = new VerticalPanel();

    panel.add(new Label("Error"));
    panel.add(new Label(e.getMessage()));

    RootPanel.get(getPreLoadID()).setVisible(false);
    RootPanel.get(getLoadID()).add(panel);
}

From source file:com.apress.progwt.client.forum.CreatePostWidget.java

License:Apache License

public CreatePostWidget(final ForumApp app, boolean isReply, final CreatePostDialog createPostDialog,
        final User author, String selection) {

    VerticalPanel mainP = new VerticalPanel();

    titleBox = new TextBox();

    textArea = new RichTextArea();

    textArea.setSize("35em", "15em");
    RichTextToolbar toolbar = new RichTextToolbar(textArea);

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(new Label("Title:"));
    hp.add(titleBox);//from w ww  .j a va 2s . c om
    mainP.add(hp);

    mainP.add(toolbar);
    mainP.add(textArea);

    Button cancelB = new Button("Cancel");
    Button submitB = new Button("Create Thread");
    if (isReply) {
        submitB.setText("Post Reply");
    }

    submitB.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            app.create(author, titleBox.getText(), textArea.getHTML());
            createPostDialog.hide();
        }

    });
    cancelB.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            createPostDialog.hide();
        }
    });

    mainP.add(cancelB);
    mainP.add(submitB);

    initWidget(mainP);

    setHTML(makeReplyFromString(selection));
}

From source file:com.apress.progwt.client.forum.ForumControlPanel.java

License:Apache License

public void setControls(ForumTopic topic, int start, int maxperpage, int totalCount) {

    nav.clear();//from  w  ww.j a va2 s. c om
    int i = 0;
    while (9 == 9) {
        int pageS = (i) * maxperpage;

        if (pageS >= totalCount) {
            break;
        }

        if (start == pageS) {
            nav.add(new Label(" (" + (i + 1) + ")"));
        } else {
            nav.add(new Hyperlink(" " + (i + 1), getID(topic, i, maxperpage)));
        }

        // Log.debug(pageS + " pageS:tc " + totalCount);
        i++;
    }

}

From source file:com.apress.progwt.client.forum.ForumDisplay.java

License:Apache License

public void load(int start, PostsList result, ForumTopic original, ForumTopic topic, boolean isReply,
        int maxPerPage) {

    allPosts.clear();// ww w. j a v a2 s .  c  o  m

    Log.debug("ORIGINAL " + original);

    if (original != null) {
        Hyperlink originalL = new Hyperlink("Forum: " + original.getUniqueForumID(),
                original.getUniqueForumID());
        allPosts.add(originalL);
    }

    if (topic.doThreadListView()) {
        for (ForumPost post : result.getPosts()) {
            allPosts.add(new PostDisplay(post));
        }
    } else {
        TableWithHeaders table = new TableWithHeaders(result.getPosts().size(), "Thread", "Replies", "Date",
                "Author");
        int row = 0;
        for (ForumPost post : result.getPosts()) {
            addShortDisplay(table, row, post);
            row++;
        }
        table.getColumnFormatter().setStyleName(0, "title");
        table.getColumnFormatter().setStyleName(1, "replies");
        table.getColumnFormatter().setStyleName(3, "author");
        allPosts.add(table);
    }

    if (result.getPosts().size() == 0) {
        allPosts.add(new Label("No Posts Yet"));
    }

    // no reply button when we're just browsing 'recent forum posts'
    if (original != null) {
        createB = new CreatePostButton(forumApp, isReply, topic);
        allPosts.add(createB);
    }

    ForumControlPanel fcb = new ForumControlPanel(topic, result, start, maxPerPage);
    allPosts.add(fcb);

}

From source file:com.apress.progwt.client.forum.ForumDisplay.java

License:Apache License

private void addShortDisplay(TableWithHeaders table, int row, ForumPost post) {

    Hyperlink postT = new Hyperlink(post.getPostTitle(), post.getUniqueForumID());

    Label replies = new Label("" + post.getReplyCount());

    UserLink author = new UserLink(post.getAuthor());

    Label date = new Label(df.format(post.getDate()));
    date.setStylePrimaryName("date");

    table.setWidget(row, 0, postT);/*from   w w  w.  j a v  a2  s.co m*/
    table.setWidget(row, 1, replies);
    table.setWidget(row, 2, date);
    table.setWidget(row, 3, author);

    if (row % 2 == 1) {
        table.getRowFormatter().setStyleName(row, "Odd");
    }

}

From source file:com.apress.progwt.client.GWTApp.java

License:Apache License

protected void loadError(Exception e) {

    Log.error("e: " + e);

    e.printStackTrace();/*from ww w. j a  v  a 2 s.  c  o  m*/

    VerticalPanel panel = new VerticalPanel();

    panel.add(new Label("Error"));
    panel.add(new Label(e.getMessage()));

    RootPanel.get(getPreLoadID()).setVisible(false);
    RootPanel.get(getLoadID()).add(panel);
}

From source file:com.apress.progwt.client.Interactive.java

License:Apache License

/**
 * Real EntryPoint. Dispatch based on javascript dictionary that tells
 * us what we should load.//from  ww  w . j  av  a 2 s  .  c o m
 * 
 * <script language="JavaScript"> var Vars = { page: "MyMindscape" };
 * </script>
 * 
 */
public void onModuleLoad2() {
    try {

        Dictionary dictionary = Dictionary.getDictionary("Vars");

        String widgetCountStr = dictionary.get("widgetCount");
        int widgetCount = Integer.parseInt(widgetCountStr);

        for (int currentWidget = 1; currentWidget <= widgetCount; currentWidget++) {
            String widget = dictionary.get("widget_" + currentWidget);
            Log.info("Do " + widget);
            if (widget.equals("Calculator")) {
                CalculatorApp m = new CalculatorApp(currentWidget);
            } else if (widget.equals("MyPage")) {
                ToCollegeApp c = new ToCollegeApp(currentWidget);
            } else if (widget.equals("CollegeMap")) {
                CollegeMapApp c = new CollegeMapApp(currentWidget);
            } else if (widget.equals("Forum")) {
                ForumApp c = new ForumApp(currentWidget);
            } else if (widget.equals("VerticalLabel")) {
                VerticalLabelApp c = new VerticalLabelApp(currentWidget);
            } else if (widget.equals("ImageBundle")) {
                ImageBundleApp c = new ImageBundleApp(currentWidget);
            } else {
                throw new Exception("Vars['widget_" + currentWidget + "] => " + widget + " null or no match.");
            }
        }

    } catch (Exception e) {
        Log.error("e: " + e);

        e.printStackTrace();

        VerticalPanel panel = new VerticalPanel();

        panel.add(new Label("Error"));
        panel.add(new Label(e.getMessage()));

        GWTApp.show(1, panel);

    }

}

From source file:com.apress.progwt.client.SampleApp.java

License:Apache License

public void onModuleLoad2() {
    try {//ww  w .j  a  va  2s  . c om

        RootPanel.get("loading").setVisible(false);
        RootPanel.get("slot1").add(new Calculator());

    } catch (Exception e) {

        e.printStackTrace();

        VerticalPanel panel = new VerticalPanel();

        panel.add(new Label("Error"));
        panel.add(new Label(e.getMessage()));

        RootPanel.get("slot1").add(panel);
    }

}

From source file:com.apress.progwt.client.widget.datepicker.TodayPanel.java

License:Apache License

public void init() {
    Label todayLink = new Label("Today");
    todayLink.addClickListener(this);
    this.add(todayLink);
    this.setWidth(100 + "%");
    this.setHeight(16 + "px");
    this.setStyleName("todayPanel");
}