com.google.gwt.user.client.ui.DockPanel Java Examples

The following examples show how to use com.google.gwt.user.client.ui.DockPanel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GwtMockitoWidgetBaseClassesTest.java    From gwtmockito with Apache License 2.0 6 votes vote down vote up
@Test
public void testPanels() throws Exception {
  invokeAllAccessibleMethods(new AbsolutePanel() {});
  invokeAllAccessibleMethods(new CellPanel() {});
  invokeAllAccessibleMethods(new ComplexPanel() {});
  invokeAllAccessibleMethods(new DeckLayoutPanel() {});
  invokeAllAccessibleMethods(new DeckPanel() {});
  invokeAllAccessibleMethods(new DecoratorPanel() {});
  invokeAllAccessibleMethods(new DockLayoutPanel(Unit.PX) {});
  invokeAllAccessibleMethods(new DockPanel() {});
  invokeAllAccessibleMethods(new FlowPanel() {});
  invokeAllAccessibleMethods(new FocusPanel() {});
  invokeAllAccessibleMethods(new HorizontalPanel() {});
  invokeAllAccessibleMethods(new HTMLPanel("") {});
  invokeAllAccessibleMethods(new LayoutPanel() {});
  invokeAllAccessibleMethods(new PopupPanel() {});
  invokeAllAccessibleMethods(new RenderablePanel("") {});
  invokeAllAccessibleMethods(new ResizeLayoutPanel() {});
  invokeAllAccessibleMethods(new SimpleLayoutPanel() {});
  invokeAllAccessibleMethods(new SimplePanel() {});
  invokeAllAccessibleMethods(new SplitLayoutPanel() {});
  invokeAllAccessibleMethods(new StackPanel() {});
  invokeAllAccessibleMethods(new VerticalPanel() {});
}
 
Example #2
Source File: VCalendar.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
/**
     * Re-renders the whole week view
     *
     * @param scroll
     *            The amount of pixels to scroll the week view
     * @param today
     *            Todays date
     * @param firstDayOfWeek
     *            The first day of the week
     * @param events
     *            The items to render
     */
    public void updateWeekView(int scroll, Date today,int firstDayOfWeek,
                               Collection<CalendarItem> events, List<CalendarDay> days) {

        while (outer.getWidgetCount() > 0) {
            outer.remove(0);
        }

        monthGrid = null;

        String[] realDayNames = new String[getDayNames().length];
        int j = 0;

//        if (firstDayOfWeek == 2) {
            for (int i = 1; i < getDayNames().length; i++) {
                realDayNames[j++] = getDayNames()[i];
            }
            realDayNames[j] = getDayNames()[0];
//        } else {
//            for (int i = 0; i < getDayNames().length; i++) {
//                realDayNames[j++] = getDayNames()[i];
//            }
//        }

        weeklyLongEvents = new WeeklyLongItems(this);
        if (weekGrid == null) {
            weekGrid = new WeekGrid(this, is24HFormat());
        }

        updateWeekGrid(days, today, realDayNames);
        updateItemsToWeekGrid(sortItems(events));

        outer.add(dayToolbar, DockPanel.NORTH);
        outer.add(weeklyLongEvents, DockPanel.NORTH);
        outer.add(weekGrid, DockPanel.SOUTH);

        weekGrid.setVerticalScrollPosition(scroll);
    }
 
Example #3
Source File: MockForm.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
PhoneBar() {
  phoneBarImage = new Image(images.phonebar());

  bar = new DockPanel();
  bar.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
  bar.add(phoneBarImage, DockPanel.EAST);

  initWidget(bar);

  setStylePrimaryName("ode-SimpleMockFormPhoneBar");
  setSize("100%", HEIGHT + "px");
}
 
Example #4
Source File: VCalendar.java    From calendar-component with Apache License 2.0 4 votes vote down vote up
/**
 * Re-renders the whole month view
 *
 * @param firstDayOfWeek
 *            The first day of the week
 * @param today
 *            Todays date
 * @param daysInMonth
 *            Amount of days in the month
 * @param events
 *            The items to render
 * @param days
 *            The day information
 */
public void updateMonthView(int firstDayOfWeek, Date today, int daysInMonth,
                            Collection<CalendarItem> events, List<CalendarDay> days) {

    // Remove all week numbers from bar
    while (outer.getWidgetCount() > 0) {
        outer.remove(0);
    }

    int firstDay = getFirstDayNumber();
    int lastDay = getLastDayNumber();
    int daysPerWeek = lastDay - firstDay + 1;
    int j = 0;

    String[] dayNames = getDayNames();
    String[] realDayNames = new String[daysPerWeek];

    if (firstDayOfWeek == 2) {
        for (int i = firstDay; i < lastDay + 1; i++) {
            if (i == 7) {
                realDayNames[j++] = dayNames[0];
            } else {
                realDayNames[j++] = dayNames[i];
            }
        }
    } else {
        for (int i = firstDay - 1; i < lastDay; i++) {
            realDayNames[j++] = dayNames[i];
        }
    }

    nameToolbar.setDayNames(realDayNames);

    weeklyLongEvents = null;
    weekGrid = null;

    updateMonthGrid(daysInMonth, days, today);

    outer.add(nameToolbar, DockPanel.NORTH);
    outer.add(weekToolbar, DockPanel.WEST);
    weekToolbar.updateCellHeights();
    outer.add(monthGrid, DockPanel.CENTER);

    updateItemsToMonthGrid(events, false);
}
 
Example #5
Source File: GwtMockitoTestRunner.java    From gwtmockito with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a collection of classes whose non-abstract methods should always be replaced with
 * no-ops. By default, this list includes {@link Composite}, {@link DOM} {@link UIObject},
 * {@link Widget}, {@link Image}, and most subclasses of {@link Panel}. It will also include any
 * classes specified via the {@link WithClassesToStub} annotation on the test class. This makes
 * it much safer to test code that uses or extends these types.
 * <p>
 * This list can be customized via {@link WithClassesToStub} or by defining a new test runner
 * extending {@link GwtMockitoTestRunner} and overriding this method. This allows users to
 * explicitly stub out particular classes that are causing problems in tests. If you override this
 * method, you will probably want to retain the classes that are stubbed here by doing something
 * like this:
 *
 * <pre>
 * &#064;Override
 * protected Collection&lt;Class&lt;?&gt;&gt; getClassesToStub() {
 *   Collection&lt;Class&lt;?&gt;&gt; classes = super.getClassesToStub();
 *   classes.add(MyBaseWidget.class);
 *   return classes;
 * }
 * </pre>
 *
 * @return a collection of classes whose methods should be stubbed with no-ops while running tests
 */
protected Collection<Class<?>> getClassesToStub() {
  Collection<Class<?>> classes = new LinkedList<Class<?>>();
  classes.add(Composite.class);
  classes.add(DOM.class);
  classes.add(UIObject.class);
  classes.add(Widget.class);

  classes.add(DataGrid.class);
  classes.add(HTMLTable.class);
  classes.add(Image.class);

  classes.add(AbsolutePanel.class);
  classes.add(CellList.class);
  classes.add(CellPanel.class);
  classes.add(CellTable.class);
  classes.add(ComplexPanel.class);
  classes.add(DeckLayoutPanel.class);
  classes.add(DeckPanel.class);
  classes.add(DecoratorPanel.class);
  classes.add(DockLayoutPanel.class);
  classes.add(DockPanel.class);
  classes.add(FlowPanel.class);
  classes.add(FocusPanel.class);
  classes.add(HorizontalPanel.class);
  classes.add(HTMLPanel.class);
  classes.add(LayoutPanel.class);
  classes.add(Panel.class);
  classes.add(PopupPanel.class);
  classes.add(RenderablePanel.class);
  classes.add(ResizeLayoutPanel.class);
  classes.add(SimpleLayoutPanel.class);
  classes.add(SimplePanel.class);
  classes.add(SplitLayoutPanel.class);
  classes.add(StackPanel.class);
  classes.add(VerticalPanel.class);
  classes.add(ValueListBox.class);

  WithClassesToStub annotation = unitTestClass.getAnnotation(WithClassesToStub.class);
  if (annotation != null) {
    classes.addAll(Arrays.asList(annotation.value()));
  }

  return classes;
}