Example usage for com.google.gwt.user.client.ui HorizontalPanel add

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

Introduction

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

Prototype

@Override
    public void add(Widget w) 

Source Link

Usage

From source file:com.apress.progwt.client.college.gui.MyRankings.java

License:Apache License

public MyRankings(ServiceCache serviceCache) {

    this.serviceCache = serviceCache;

    VerticalPanel mainPanel = new VerticalPanel();
    rankPanelPanel = new VerticalPanel();

    entryDragController = new PickupDragController(RootPanel.get(), false);

    IndexedDropController rankDropController = new IndexedDropController(rankPanelPanel);
    entryDragController.registerDropController(rankDropController);

    entryDragController.addDragHandler(this);

    HorizontalPanel completerP = new HorizontalPanel();
    completer = new SchoolCompleter(serviceCache, new CompleteListener<School>() {
        public void completed(School result) {
            addSchool(result);/*from   w  w w .  ja  v  a2 s. c  o  m*/
        }
    });
    completeB = new Button("Add School");
    completeB.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            completer.complete();
        }
    });
    completerP.add(completer);
    completerP.add(completeB);

    completeB.setEnabled(false);

    mainPanel.add(rankPanelPanel);
    mainPanel.add(completerP);

    initWidget(mainPanel);

}

From source file:com.apress.progwt.client.college.gui.ProConDispPanel.java

License:Apache License

public ProConDispPanel(String string, List<String> list, CollegeEntry collegeEntry) {
    this.collegeEntry = collegeEntry;
    mainPanel = new VerticalPanel();
    mainPanel.add(new Label(string));
    for (String str : list) {
        addRow(str);/*from   ww  w  .  j  a  va  2  s.  c  o m*/
    }

    mainPanel.setStylePrimaryName("ProConPanel");
    mainPanel.addStyleDependentName(string);

    HorizontalPanel addP = new HorizontalPanel();
    addTextBox = new TextBox();
    Button addB = new Button("Add");
    addB.addClickListener(this);
    addP.add(addTextBox);
    addP.add(addB);
    mainPanel.add(addP);

    initWidget(mainPanel);

}

From source file:com.apress.progwt.client.college.gui.ProConPanel.java

License:Apache License

public ProConPanel(User thisUser, Application application, CollegeEntry collegeEntry) {

    HorizontalPanel mainPanel = new HorizontalPanel();

    pros = new ProConDispPanel("Pro", application.getPros(), collegeEntry);
    cons = new ProConDispPanel("Con", application.getCons(), collegeEntry);

    mainPanel.add(pros);
    mainPanel.add(cons);//from w  ww. j  ava 2 s . c  om

    initWidget(mainPanel);

}

From source file:com.apress.progwt.client.college.gui.SchoolRanks.java

License:Apache License

public void load(User user) {
    thisUser = user;/*from  w  w w  . ja v a 2s  . c o m*/
    rankPanel.clear();
    int i = 1;
    for (ApplicationAndScore aas : thisUser.getPrioritizedRankings()) {

        double pct = aas.getScore() / (double) aas.getTotal();

        SchoolLink link = new SchoolLink(aas.getApplication().getSchool());

        Label pctL = new Label(pctFormat.format(pct));

        HorizontalPanel hP = new HorizontalPanel();
        hP.setStyleName("TC-DecisionRanked");
        if (i % 2 == 0) {
            hP.addStyleName("TC-DecisionRanked-Even");
        }

        Label rankL = new Label(i + "");
        rankL.addStyleName("TC-DecisionRanked-Rank");
        pctL.addStyleName("TC-DecisionRanked-Pct");

        hP.add(rankL);
        hP.add(link);
        hP.add(pctL);

        rankPanel.add(hP);
        i++;
    }
}

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 .ja v a 2s  . co  m
    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 ForumControlPanel(ForumTopic topic, PostsList result, int start, int maxperpage) {
    HorizontalPanel mainP = new HorizontalPanel();

    nav = new HorizontalPanel();
    nav.setStylePrimaryName("ForumControl");
    mainP.add(nav);

    initWidget(mainP);/*from  w w w. j  a v  a2  s.  c om*/
    setControls(topic, start, maxperpage, result.getTotalCount());
}

From source file:com.apress.progwt.client.gui.timeline.TLOWrapper.java

License:Apache License

public TLOWrapper(ZoomableTimeline<T> timeline, final TimeLineObj<T> tlo, Image dragImage, Widget mainWidget,
        Label mainLabel) {//  ww  w. j a v a  2  s.c  om
    this.tlo = tlo;
    this.top = 0;
    this.dragImage = dragImage;
    this.mainWidget = mainWidget;

    HorizontalPanel panel = new HorizontalPanel();

    if (mainLabel == null) {
        label = new Label("", false);
    } else {
        label = mainLabel;
    }

    TLORangeEdge edge = new TLORangeEdge(timeline, tlo, this, true, dragImage);

    panel.add(edge);
    panel.add(label);
    if (mainWidget != null) {
        panel.add(mainWidget);
    }

    addClickListener(timeline);
    addDblClickListener(timeline);

    setWidget(panel);

    label.setStyleName("H-TLOWrapper");

    JSUtil.disableSelect(getElement());
}

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

License:Apache License

private void init() {
    this.setHeight(18 + "px");
    drawTitle();/*from ww w  . j  a va2 s.  c om*/

    this.prevMonth.setWidth(23 + "px");
    this.nextMonth.setWidth(23 + "px");

    DOM.setAttribute(prevMonth.getElement(), "title", "Previous Month");
    DOM.setAttribute(prevYear.getElement(), "title", "Previous Year");
    DOM.setAttribute(nextMonth.getElement(), "title", "Next Month");
    DOM.setAttribute(nextYear.getElement(), "title", "Next Year");

    HorizontalPanel prevButtons = new HorizontalPanel();
    prevMonth.setStyleName("monthYearTraversorBtn");
    prevYear.setStyleName("monthYearTraversorBtn");
    prevButtons.add(prevYear);
    prevButtons.add(prevMonth);

    HorizontalPanel nextButtons = new HorizontalPanel();
    nextMonth.setStyleName("monthYearTraversorBtn");
    nextYear.setStyleName("monthYearTraversorBtn");
    nextButtons.add(nextMonth);
    nextButtons.add(nextYear);

    this.add(prevButtons, DockPanel.WEST);
    this.setCellHorizontalAlignment(prevButtons, DockPanel.ALIGN_LEFT);
    this.add(nextButtons, DockPanel.EAST);
    this.setCellHorizontalAlignment(nextButtons, DockPanel.ALIGN_RIGHT);
    this.add(monthYearDesc, DockPanel.CENTER);
    this.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
    this.setCellHorizontalAlignment(this.monthYearDesc, HasAlignment.ALIGN_CENTER);
    this.setCellVerticalAlignment(this.monthYearDesc, HasAlignment.ALIGN_MIDDLE);
    this.setCellWidth(monthYearDesc, "100%");
    monthYearDesc.setStyleName("monthYearTraversor");

    this.setStyleName("monthYearTraversor");
}

From source file:com.areahomeschoolers.baconbits.client.content.calendar.monthview.MonthView.java

License:Open Source License

/**
 * Configures a single day in the month grid of this <code>MonthView</code>.
 * //from   ww w .  java2s .c  o m
 * @param row
 *            The row in the grid on which the day will be set
 * @param col
 *            The col in the grid on which the day will be set
 * @param date
 *            The Date in the grid
 * @param isToday
 *            Indicates whether the day corresponds to today in the month view
 * @param notInCurrentMonth
 *            Indicates whether the day is in the current visualized month or belongs to any of the two adjacent months of the current month
 * @param weekNumber
 *            The weekNumber to show in the cell, only appears in the first col.
 */
private void configureDayInGrid(int row, int col, Date date, boolean isToday, boolean notInCurrentMonth,
        int weekNumber) {
    HorizontalPanel panel = new HorizontalPanel();
    String text = Integer.toString(ClientDateUtils.getDayInMonth(date));
    Label label = new Label(text);

    StringBuilder headerStyle = new StringBuilder(CELL_HEADER_STYLE);
    StringBuilder cellStyle = new StringBuilder(CELL_STYLE);

    for (Date day : getSettings().getHolidays()) {
        if (DateUtils.areOnTheSameDay(day, date)) {
            headerStyle.append("-holiday");
            cellStyle.append("-holiday");
            break;
        }
    }

    if (isToday) {
        headerStyle.append("-today");
        cellStyle.append("-today");
    }

    label.setStyleName(headerStyle.toString());
    if (notInCurrentMonth) {
        label.addStyleName("fadedText");
    }
    addDayClickHandler(label, (Date) date.clone());

    if (col == 0 && getSettings().isShowingWeekNumbers()) {
        Label weekLabel = new Label(String.valueOf(weekNumber));
        weekLabel.setStyleName(WEEKNUMBER_LABEL_STYLE);

        panel.add(weekLabel);
        panel.setCellWidth(weekLabel, "25px");
        DOM.setStyleAttribute(label.getElement(), "paddingLeft", "5px");
        addWeekClickHandler(weekLabel, (Date) date.clone());
    }
    panel.add(label);

    appointmentCanvas.add(panel);
    dayLabels.add(label);
    dayPanels.add(panel);

    monthCalendarGrid.getCellFormatter().setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_TOP);
    monthCalendarGrid.getCellFormatter().setStyleName(row, col, cellStyle.toString());
}

From source file:com.arondor.common.reflection.gwt.client.view.ReflectionDesignerMenuView.java

License:Apache License

public ReflectionDesignerMenuView() {
    if (false) {//from  w w  w. j  a  va2  s .  c  o  m
        loadConfigContext.setText(
                "file:///home/francois/ARender-Rendition-2.2.0/conf/arender-rendition-alterdocumentcontent.xml");
        loadLibsContext.setText("/home/francois/ARender-Rendition-2.2.0/lib");
    }
    loadConfigContext.setWidth("300px");
    loadLibsContext.setWidth("300px");
    VerticalPanel verticalPanel = new VerticalPanel();
    {
        HorizontalPanel hz = new HorizontalPanel();
        hz.add(loadLibsContext);
        hz.add(loadLibsButton);
        verticalPanel.add(hz);
    }
    {
        HorizontalPanel hz = new HorizontalPanel();
        hz.add(loadConfigContext);
        hz.add(loadConfigButton);
        verticalPanel.add(hz);
    }
    verticalPanel.add(saveConfigButton);
    initWidget(verticalPanel);
}