Package org.gwt.mosaic.ui.client.layout

Examples of org.gwt.mosaic.ui.client.layout.LayoutPanel


  public Caption(String text) {
    this(text, false);
  }

  public Caption(String text, boolean asHTML) {
    final LayoutPanel layoutPanel = getLayoutPanel();
    layoutPanel.setLayout(new BoxLayout());
    layoutPanel.setPadding(0);
    layoutPanel.setWidgetSpacing(0);

    layoutPanel.add(caption, new BoxLayoutData(FillStyle.BOTH));

    caption.setStyleName(DEFAULT_STYLENAME + "-text");

    if (asHTML) {
      setHTML(text);
View Full Code Here


  public CaptionLayoutPanel(final String text) {
    this(text, false);
  }

  public CaptionLayoutPanel(final String text, boolean asHTML) {
    final LayoutPanel layoutPanel = getLayoutPanel();
    layoutPanel.setLayout(new BoxLayout(Orientation.VERTICAL));
    layoutPanel.setWidgetSpacing(0);

    caption = new Caption(text, asHTML);
    layoutPanel.add(caption, new BoxLayoutData(FillStyle.HORIZONTAL));

    body = new LayoutPanel();
    body.addStyleName("Body");
    layoutPanel.add(body, new BoxLayoutData(FillStyle.BOTH));

    setStyleName(DEFAULT_STYLENAME);
  }
View Full Code Here

  }

  public ScrollTabBar(boolean decorated, boolean atBottom) {
    super(new BoxLayout(atBottom?Alignment.START:Alignment.END));

    final LayoutPanel layoutPanel = getLayoutPanel();
    layoutPanel.setPadding(0);
    layoutPanel.setWidgetSpacing(0);

    if (decorated) {
      if (atBottom) {
        tabBar = new DecoratedBottomTabBar() {
          @Override
          protected void insertTabWidget(Widget widget, int beforeIndex) {
            super.insertTabWidget(widget, beforeIndex);
            tabs.add(beforeIndex, widget);
          }

          @Override
          public void removeTab(int index) {
            super.removeTab(index);
            tabs.remove(index);
          }
        };
      } else {
        tabBar = new DecoratedTabBar() {
          @Override
          protected void insertTabWidget(Widget widget, int beforeIndex) {
            super.insertTabWidget(widget, beforeIndex);
            tabs.add(beforeIndex, widget);
          }

          @Override
          public void removeTab(int index) {
            super.removeTab(index);
            tabs.remove(index);
          }
        };
      }
    } else {
      tabBar = new TabBar() {
        @Override
        protected void insertTabWidget(Widget widget, int beforeIndex) {
          super.insertTabWidget(widget, beforeIndex);
          tabs.add(beforeIndex, widget);
        }

        @Override
        public void removeTab(int index) {
          super.removeTab(index);
          tabs.remove(index);
        }
      };
    }

    tabBar.addSelectionHandler(new SelectionHandler<Integer>() {
      public void onSelection(final SelectionEvent<Integer> event) {
        DeferredCommand.addCommand(new Command() {
          public void execute() {
            invalidate();
            scrollTabIntoView();
          }
        });
      }
    });

    tabBarWrapper = createWrapper("tabBarWrapper");
    tabBarWrapper.add(tabBar);

    navBar = new HorizontalPanel();
    navBar.addStyleName(DEFAULT_STYLENAME + "-NavBar");
    navBar.setVisible(false);
    scrollLeftBtn = new Button(Caption.IMAGES.toolArrowLeft().getHTML(),
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            createScrollAnimation();
            scrollAnimation.scrollTabBar(ScrollTabBar.this, -1 * SCROLL_OFFSET,
                isAnimationEnabled);
          }
        });
    scrollLeftBtn.addMouseDownHandler(new MouseDownHandler() {
      public void onMouseDown(MouseDownEvent event) {
        scrollLeftBtnDown = true;
        scrollLeftBtnTimer.scheduleRepeating(CoreConstants.DEFAULT_DELAY_MILLIS);
      }
    });
    scrollLeftBtn.addMouseUpHandler(new MouseUpHandler() {
      public void onMouseUp(MouseUpEvent event) {
        scrollLeftBtnDown = false;
        scrollLeftBtnTimer.cancel();
      }
    });
    navBar.add(scrollLeftBtn);

    scrollRightBtn = new Button(Caption.IMAGES.toolArrowRight().getHTML(),
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            createScrollAnimation();
            scrollAnimation.scrollTabBar(ScrollTabBar.this, SCROLL_OFFSET,
                isAnimationEnabled);
          }
        });
    scrollRightBtn.addMouseDownHandler(new MouseDownHandler() {
      public void onMouseDown(MouseDownEvent event) {
        scrollRightBtnDown = true;
        scrollRightBtnTimer.scheduleRepeating(CoreConstants.DEFAULT_DELAY_MILLIS);
      }
    });
    scrollRightBtn.addMouseUpHandler(new MouseUpHandler() {
      public void onMouseUp(MouseUpEvent event) {
        scrollRightBtnDown = false;
        scrollRightBtnTimer.cancel();
      }
    });
    navBar.add(scrollRightBtn);

    tabBarMenuBtn = new Button(Caption.IMAGES.toolArrowDown().getHTML(),
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            final PopupMenu menu = new PopupMenu();
            menu.addItem(tabBar.getTabHTML(tabBar.getSelectedTab()), true,
                new Command() {
                  public void execute() {
                    tabBar.selectTab(tabBar.getSelectedTab());
                  }
                });
            menu.addSeparator();
            for (int i = 0, n = tabBar.getTabCount(); i < n; i++) {
              final int index = i;
              if (index != tabBar.getSelectedTab()) {
                menu.addItem(tabBar.getTabHTML(i), true, new Command() {
                  public void execute() {
                    tabBar.selectTab(index);
                  }
                });
              }
            }
            menu.setPopupPositionAndShow(new PositionCallback() {
              public void setPosition(int offsetWidth, int offsetHeight) {
                final Dimension box = WidgetHelper.getOffsetSize(tabBarMenuBtn);
                int left = DOM.getAbsoluteLeft(tabBarMenuBtn.getElement());
                if (left + offsetWidth > Window.getClientWidth()) {
                  left += box.width - offsetWidth;
                }
                final int top = DOM.getAbsoluteTop(tabBarMenuBtn.getElement())
                    + box.height;
                menu.setPopupPosition(left, top);
              }
            });
          }
        });
    navBar.add(tabBarMenuBtn);

    layoutPanel.add(tabBarWrapper, new BoxLayoutData(FillStyle.HORIZONTAL));
    layoutPanel.add(navBar);

    DOM.setStyleAttribute(tabBarWrapper.getElement(), "overflow", "hidden");

    addStyleName(DEFAULT_STYLENAME);
  }
View Full Code Here

    this(DEFAULT_STYLENAME);
  }

  protected ComboBoxBase(String styleName) {
    super();
    final LayoutPanel layoutPanel = getLayoutPanel();
    layoutPanel.setLayout(new BoxLayout(Orientation.HORIZONTAL));
    layoutPanel.setPadding(0);
    layoutPanel.setWidgetSpacing(0);

    sinkEvents(Event.KEYEVENTS);

    input = new TextBox();
    layoutPanel.add(input, new BoxLayoutData(FillStyle.BOTH));
    input.addKeyDownHandler(new KeyDownHandler() {
      public void onKeyDown(KeyDownEvent event) {
        if (!isPopupVisible()) {
          showPopupTimer.schedule(CoreConstants.MIN_DELAY_MILLIS);
        }
      }
    });
    input.addKeyUpHandler(new KeyUpHandler() {
      public void onKeyUp(KeyUpEvent event) {
        switch (event.getNativeKeyCode()) {
          case KeyCodes.KEY_ENTER:
          case KeyCodes.KEY_TAB:
            updateInput();
            hidePopup();
            break;
          case KeyCodes.KEY_ESCAPE:
            hidePopup();
            break;
        }
      }
    });

    button = new Button();
    button.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        showPopupTimer.schedule(CoreConstants.MIN_DELAY_MILLIS);
      }
    });
    layoutPanel.add(button, new BoxLayoutData(FillStyle.VERTICAL));

    popup = new DropDownPanel();
    popup.addCloseHandler(new CloseHandler<PopupPanel>() {
      public void onClose(CloseEvent<PopupPanel> event) {
        if (!event.isAutoClosed()) {
View Full Code Here

    this(text, Separator.ALIGN_LEFT);
  }

  public Separator(String text, HorizontalAlignmentConstant align) {
    this.align = checkHorizontalAlignment(align);
    final LayoutPanel layoutPanel = getLayoutPanel();
    layoutPanel.setLayout(new BoxLayout(Alignment.CENTER));
    layoutPanel.setPadding(0);
    layoutPanel.setWidgetSpacing(8);

    final TextLabel l = new TextLabel(text);
    l.setWordWrap(false);

    final Widget hr = new HTMLLabel("<hr width='100%'></hr>");

    if (this.align == Separator.ALIGN_LEFT) {
      layoutPanel.add(l);
      layoutPanel.add(hr, new BoxLayoutData(FillStyle.HORIZONTAL));
    } else {
      layoutPanel.add(hr, new BoxLayoutData(FillStyle.HORIZONTAL));
      layoutPanel.add(l);
    }
    setStyleName(DEFAULT_STYLENAME);
  }
View Full Code Here

   * {@inheritDoc}
   *
   * @see com.google.gwt.user.client.ui.HasWidgets#add(com.google.gwt.user.client.ui.Widget)
   */
  public void add(Widget w) {
    final LayoutPanel layoutPanel = getLayoutPanel();
    final BoxLayout boxLayoutMgr = (BoxLayout) layoutPanel.getLayout();
    if (w instanceof ToolBarSpring) {
      layoutPanel.add(w, new BoxLayoutData(FillStyle.BOTH));
    } else if (boxLayoutMgr.getOrientation() == Orientation.HORIZONTAL) {
      final String width = getWidgetWidth(w);
      layoutPanel.add(w, new BoxLayoutData(FillStyle.VERTICAL, width, null));
    } else {
      final String height = getWidgetHeight(w);
      getLayoutPanel().add(w, new BoxLayoutData(FillStyle.BOTH, null, height));
    }
  }
View Full Code Here

    prompt.setAnimationEnabled(true);
    int preferredWidth = Window.getClientWidth();
    preferredWidth = Math.max(preferredWidth / 3, 256);
    prompt.setWidth(preferredWidth + "px");

    final LayoutPanel panel = new LayoutPanel(new BoxLayout(
        Orientation.VERTICAL));
    panel.setPadding(0);
    panel.add(new HTML(message), new BoxLayoutData(FillStyle.HORIZONTAL));
    panel.add(input, new BoxLayoutData(FillStyle.HORIZONTAL));

    Button buttonOK = new Button("OK");
    buttonOK.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        prompt.onClose(true);
View Full Code Here

  }

  public MessageBox(MessageBoxType type, String text, boolean autoHide) {
    super(text, false, autoHide);

    final LayoutPanel layoutPanel = new LayoutPanel(new BorderLayout());
    super.setWidget(layoutPanel);
    layoutPanel.setWidgetSpacing(10);

    // (ggeorg) this is a workaround for the infamous Firefox cursor bug
    if (UserAgent.isGecko()) {
      DOM.setStyleAttribute(getLayoutPanel().getElement(), "overflow", "auto");
    }
View Full Code Here

      setWidget(new HTML(html));
    }
  }

  public void setImage(Image image) {
    final LayoutPanel layoutPanel = (LayoutPanel) super.getWidget();
    if (this.image != image) {
      if (imageWrapper != null) {
        layoutPanel.remove(imageWrapper);
      }
      this.image = image;
      imageWrapper = new WidgetWrapper(image);
      layoutPanel.add(imageWrapper, new BorderLayoutData(Region.WEST));
    }
  }
View Full Code Here

  public void setWidget(Widget w) {
    setWidget(w, -1);
  }

  public void setWidget(Widget w, final int padding) {
    final LayoutPanel layoutPanel = (LayoutPanel) super.getWidget();
    if (padding > -1) {
      layoutPanel.setPadding(padding);
    }
    if (widget != w) {
      if (widget != null) {
        layoutPanel.remove(widget);
      }
      widget = w;
      layoutPanel.add(widget);
    }
  }
View Full Code Here

TOP

Related Classes of org.gwt.mosaic.ui.client.layout.LayoutPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.