Java 类com.google.gwt.user.client.ui.RequiresResize 实例源码

项目:che    文件:PerspectiveViewImpl.java   
/** {@inheritDoc} */
@Override
public void onResize() {
  editorPanel.onResize();
  super.onResize();
  Widget widget = infoPanel.getWidget();
  if (widget instanceof RequiresResize) {
    ((RequiresResize) widget).onResize();
  }

  int width = getOffsetWidth();
  int height = getOffsetHeight();

  if (delegate != null) {
    delegate.onResize(width, height);
  }
}
项目:firefly    文件:BaseDialog.java   
public void setVisible(boolean visible, PopupPane.Align alignAt, int xOffset, int yOffset) {

        if (_firstTime && visible)  deferredBuild();
        setContainerVisible(visible, alignAt, xOffset, yOffset);
        if ( visible) {
            final boolean first= _firstTime;
            DeferredCommand.addCommand(new Command() {
                public void execute() {
                    if (first) {
                        onFirstVisible();
                        if (_theWidget instanceof RequiresResize && !_sizeSet)  {
                            int maxW= Math.max(_theWidget.getOffsetHeight(),_buttons.getOffsetHeight());
                            setDefaultContentSize(maxW, _theWidget.getOffsetHeight()+_buttons.getOffsetHeight());
                        }
                    }
                    onVisible();
                }
            });
        _firstTime= false;
        }
    }
项目:firefly    文件:XYPlotJSInterface.java   
public static void addXYPlot(JscriptRequest jspr, String div) {
    Map<String,String> paramMap= jspr.asMap();
    WidgetFactory factory= Application.getInstance().getWidgetFactory();
    TablePreview xyPrev= factory.createObserverUI(WidgetFactory.XYPLOT,paramMap);
    xyPrev.bind(FFToolEnv.getHub());

    SimplePanel panel= makeCenter();
    panel.add(xyPrev.getDisplay());
    FFToolEnv.addToPanel(div, panel, "XY Plot");

    if (xyPrev.getDisplay() instanceof RequiresResize) {
        final RequiresResize resizer= (RequiresResize)xyPrev.getDisplay();
        Window.addResizeHandler(new ResizeHandler() {
            public void onResize(ResizeEvent event) {
                resizer.onResize();
            }
        });
    }
}
项目:appformer    文件:ListBarWidgetImpl.java   
@Override
public void onResize() {
    if (!isAttached()) {
        return;
    }

    super.onResize();

    // FIXME only need to do this for the one visible part .. need to call onResize() when switching parts anyway
    for (int i = 0; i < content.getWidgetCount(); i++) {
        final FlowPanel container = (FlowPanel) content.getWidget(i);
        final Widget containedWidget = container.getWidget(0);
        if (containedWidget instanceof RequiresResize) {
            ((RequiresResize) containedWidget).onResize();
        }
    }
}
项目:appformer    文件:WorkbenchLayoutImpl.java   
private void updateMaximizedPanelSizes() {
    for (Widget w : maximizedWidgetOriginalStyles.keySet()) {
        Style style = w.getElement().getStyle();
        style.setTop(perspectiveRootContainer.getAbsoluteTop(),
                     Unit.PX);
        style.setLeft(perspectiveRootContainer.getAbsoluteLeft(),
                      Unit.PX);
        style.setWidth(perspectiveRootContainer.getOffsetWidth(),
                       Unit.PX);
        style.setHeight(perspectiveRootContainer.getOffsetHeight(),
                        Unit.PX);

        if (w instanceof RequiresResize) {
            ((RequiresResize) w).onResize();
        }
    }
}
项目:appformer    文件:WorkbenchLayoutImplTest.java   
@Before
public void setup() {
    workbenchLayout = new WorkbenchLayoutImpl(iocManager,
                                              root,
                                              dndManager,
                                              uberfireDocksContainer,
                                              dragController,
                                              headerPanel,
                                              footerPanel) {
        @Override
        ElementWrapperWidget<?> createWidgetFrom(HTMLElement h) {
            return mock(ElementWrapperWidget.class);
        }
    };
    widget = mock(Widget.class,
                  withSettings().extraInterfaces(RequiresResize.class));
    final Element element = mock(Element.class);
    when(element.getStyle()).thenReturn(mock(Style.class));
    when(widget.getElement()).thenReturn(element);

    header1 = mock(Header.class);
    header2 = mock(Header.class);

    footer1 = mock(Footer.class);
    footer2 = mock(Footer.class);
}
项目:appformer    文件:WorkbenchLayoutImplTest.java   
@Test
public void testCollapseAnimationWithCallback() {
    final HashMap<Widget, WorkbenchLayoutImpl.OriginalStyleInfo> maximizedWidgetOriginalStyles = Maps.newHashMap();
    maximizedWidgetOriginalStyles.put(widget,
                                      new WorkbenchLayoutImpl.OriginalStyleInfo(widget));
    final Command callback = mock(Command.class);
    final WorkbenchLayoutImpl.CollapseAnimation collapseAnimation = new WorkbenchLayoutImpl.CollapseAnimation(
            widget,
            maximizedWidgetOriginalStyles,
            callback);

    collapseAnimation.onComplete();

    verify(((RequiresResize) widget)).onResize();
    verify(callback).execute();
}
项目:platypus-js    文件:Grid.java   
@Override
public void onResize() {
    if (isAttached()) {
        hive.setSize("100%", "100%");//(getElement().getClientWidth() + "px", getElement().getClientHeight() + "px");
        propagateHeaderWidth();
        onColumnsResize();
        propagateHeightButScrollable();
        // columnsChevron.setHeight(Math.max(headerLeftContainer.getOffsetHeight(),
        // headerRightContainer.getOffsetHeight()) + "px");
        for (Widget child : new Widget[] { headerLeftContainer, headerRightContainer, frozenLeftContainer,
                frozenRightContainer, scrollableLeftContainer, scrollableRightContainer }) {
            if (child instanceof RequiresResize) {
                ((RequiresResize) child).onResize();
            }
        }
    }
}
项目:platypus-js    文件:GridPanel.java   
@Override
public void onResize() {
    for (int i = 0; i < grid.length; i++) {
        for (int j = 0; j < grid[i].length; j++) {
            Widget cell = grid[i][j];
            if(cell != null){
                cell.getElement().getStyle().setWidth(100 / grid[i].length, Style.Unit.PCT);
                cell.getElement().getStyle().setHeight(100 / grid.length, Style.Unit.PCT);
            }
        }
    }
    for (int i = 0; i < grid.length; i++) {
        for (int j = 0; j < grid[i].length; j++) {
            Widget w = getWidget(i, j);
            if (w instanceof RequiresResize) {
                ((RequiresResize) w).onResize();
            }
        }
    }
}
项目:hexa.tools    文件:DialogBoxBuilder.java   
public static DialogBox create( String title, IsWidget content )
{
    if( content == null )
        return null;

    Widget w = content.asWidget();
    if( w == null )
        return null;

    DialogBox db = null;
    if( w instanceof RequiresResize )
        db = new DialogBoxForLayoutWidget( title, w );
    else
        db = new DialogBoxForNormalWidget( title, w );

    return db;
}
项目:Wiab.pro    文件:FramedPanel.java   
@Override
public void onResize() {
  Iterator<Widget> it = iterator();
  while (it.hasNext()) {
    Widget widget = it.next();
    if (widget instanceof RequiresResize) {
      ((RequiresResize) widget).onResize();
    }
  }
}
项目:Wiab.pro    文件:ImplPanel.java   
@Override
public void onResize() {
  Iterator<Widget> it = iterator();
  while (it.hasNext()) {
    Widget widget = it.next();
    if (widget instanceof RequiresResize) {
      ((RequiresResize) widget).onResize();
    }
  }
  for (Listener l : listeners) {
    l.onResize();
  }
}
项目:che    文件:ProcessesPanelViewImpl.java   
@Override
public void onResize() {
  for (WidgetToShow widgetToShow : widget2Panels.keySet()) {
    final IsWidget widget = widgetToShow.getWidget();
    if (widget instanceof RequiresResize) {
      ((RequiresResize) widget).onResize();
    }
  }

  for (SubPanel panel : widget2Panels.values()) {
    if (panel.getView() instanceof RequiresResize) {
      ((RequiresResize) panel.getView()).onResize();
    }
  }
}
项目:che    文件:SubPanelViewImpl.java   
@Override
public void onResize() {
  for (WidgetToShow widgetToShow : widgets2Tabs.keySet()) {
    if (widgetToShow.getWidget() instanceof RequiresResize) {
      ((RequiresResize) widgetToShow.getWidget()).onResize();
    }
  }

  // reset timer and schedule it again
  ensureActiveTabVisibleTimer.cancel();
  ensureActiveTabVisibleTimer.schedule(200);
}
项目:firefly    文件:PopupPane.java   
/**
 * resize the popup when the browser area is smaller then the popup size
 */
private void adjustResizable() {
    if (_expandW!=null && optimalWidth>0 && optimalHeight>0) {
        int width= content.getOffsetWidth();
        int height= content.getOffsetHeight();

        if (width> Window.getClientWidth()) {
            width= Window.getClientWidth()-20;
        }
        else if (width<optimalWidth) {
            width= Math.min(optimalWidth, Window.getClientWidth()-20);
        }

        if (height> Window.getClientHeight()) {
            height= Window.getClientHeight()-35;
        }
        else if (height<optimalHeight) {
            height= Math.min(optimalHeight, Window.getClientHeight()-35);
        }

        if (width<minWidth) {
            width = minWidth;
            _doAlign= false; //turn off the automatic align, the dialog will jump around when users scrolls
        }
        if (height<minHeight) {
            height= minHeight;
            _doAlign= false; //turn off the automatic align, the dialog will jump around when users scrolls
        }

        if (height!=content.getOffsetHeight() || width!=content.getOffsetWidth()) {
            content.getWidget().setSize(width+"px", height+"px");
            ((RequiresResize)_expandW).onResize();
        }

    }
}
项目:firefly    文件:PopupPane.java   
private void performResize(Widget w, int width, int height) {
    if (w instanceof RequiresResize) {
        w.setPixelSize(width,height);
        ((RequiresResize)w).onResize();
    }
    else {
        WebAssert.argTst(false, "This should not happen, w must be an instance of RequiresResize");
    }

}
项目:firefly    文件:ToolbarDropdown.java   
private void ensureSize() {
    Dimension dim = getDropDownSize();
    mainPanel.setSize("100%", dim.getHeight() - 10 + "px");

    if (content.getContent() instanceof RequiresResize) {
        dim = getAvailContentSize();
        content.getContent().setPixelSize(dim.getWidth(), dim.getHeight()-20);
        ((RequiresResize) content.getContent()).onResize();
    }

}
项目:firefly    文件:TablePanel.java   
public void onResize() {
    for (View view : getViews()) {
        if (view != null && view.getDisplay() instanceof RequiresResize) {
            ((RequiresResize) view.getDisplay()).onResize();
        }
    }
}
项目:firefly    文件:PopupContainerForStandAlone.java   
private void ensureSize() {
    Widget tlExpRoot= _popout.getToplevelExpandRoot();
    if (_popout.isExpanded() && GwtUtil.isOnDisplay(tlExpRoot)) {
        _topBackground.setHeight(Window.getClientHeight()+"px");
        Dimension dim= getAvailableSize();
        tlExpRoot.setPixelSize(dim.getWidth(), dim.getHeight());
        if (tlExpRoot instanceof RequiresResize) {
            ((RequiresResize)tlExpRoot).onResize();
        }
    }
}
项目:appformer    文件:ResizeTabPanel.java   
@Override
public void onResize() {
    final Widget parent = this.getParent();

    int width = parent.getOffsetWidth();
    int height = parent.getOffsetHeight();

    if (width == 0 && height == 0) {
        //it's `invisible` = makes no sense try to resize
        return;
    }

    height = height - getTabBarHeight();
    Layouts.setToFillParent(this);

    // TabContent is just a container for all the TabPane divs, one of which is made visible at a time.
    // For compatibility with GWT LayoutPanel, we have to set both layers of children to fill their parents.
    // We do it in onResize() to get to the TabPanes no matter how they were added.
    for (Widget child : tabContent) {
        child.setPixelSize(width,
                           height);
        Layouts.setToFillParent(child);
        if (child instanceof TabPane) {
            final TabPane tabPane = (TabPane) child;
            if (tabPane.isActive()) {
                for (int i = 0; i < tabPane.getWidgetCount(); i++) {
                    final Widget tabChild = tabPane.getWidget(i);
                    tabChild.setPixelSize(width,
                                          height);
                    Layouts.setToFillParent(tabChild);
                    if (tabChild instanceof RequiresResize) {
                        ((RequiresResize) tabChild).onResize();
                    }
                }
            }
        }
    }
}
项目:appformer    文件:AbstractSimpleWorkbenchPanelView.java   
@Override
public void onResize() {
    if (isAttached()) {
        presenter.onResize(getOffsetWidth(),
                           getOffsetHeight());
    }

    // this will always be true in real life, but during GwtMockito tests it is not
    if (getWidget() instanceof RequiresResize) {
        super.onResize();
    }
}
项目:appformer    文件:TemplatedWorkbenchPanelView.java   
@Override
public void onResize() {
    Widget root = asWidget();
    if (root instanceof RequiresResize) {
        ((RequiresResize) root).onResize();
    }
}
项目:appformer    文件:AbstractDockingWorkbenchPanelView.java   
private static void scheduleResize(final RequiresResize widget) {
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            widget.onResize();
        }
    });
}
项目:appformer    文件:RequiresResizeFlowPanel.java   
@Override
public void onResize() {
    for (int i = 0; i < getWidgetCount(); i++) {
        final Widget activeWidget = getWidget(i);
        if (activeWidget instanceof RequiresResize) {
            ((RequiresResize) activeWidget).onResize();
        }
    }
}
项目:appformer    文件:ResizeFlowPanel.java   
@Override
public void onResize() {
    for (Widget child : this) {
        if (child instanceof RequiresResize) {
            ((RequiresResize) child).onResize();
        }
    }
}
项目:appformer    文件:WorkbenchLayoutImplTest.java   
@Test
public void testMaximize() {
    workbenchLayout.maximize(widget);

    verify(widget).addStyleName(WorkbenchLayoutImpl.UF_MAXIMIZED_PANEL);

    verify(((RequiresResize) widget),
           never()).onResize();
}
项目:appformer    文件:WorkbenchLayoutImplTest.java   
@Test
public void testExpandAnimation() {
    final WorkbenchLayoutImpl.ExpandAnimation expandAnimation = new WorkbenchLayoutImpl.ExpandAnimation(widget,
                                                                                                        Maps.<Widget, WorkbenchLayoutImpl.OriginalStyleInfo>newHashMap(),
                                                                                                        mock(SimpleLayoutPanel.class),
                                                                                                        null);

    expandAnimation.onComplete();

    verify(((RequiresResize) widget)).onResize();
}
项目:appformer    文件:WorkbenchLayoutImplTest.java   
@Test
public void testExpandAnimationWithCallback() {
    final Command callback = mock(Command.class);
    final WorkbenchLayoutImpl.ExpandAnimation expandAnimation = new WorkbenchLayoutImpl.ExpandAnimation(widget,
                                                                                                        Maps.<Widget, WorkbenchLayoutImpl.OriginalStyleInfo>newHashMap(),
                                                                                                        mock(SimpleLayoutPanel.class),
                                                                                                        callback);

    expandAnimation.onComplete();

    verify(((RequiresResize) widget)).onResize();
    verify(callback).execute();
}
项目:appformer    文件:WorkbenchLayoutImplTest.java   
@Test
public void testUnMaximize() {
    workbenchLayout.maximize(widget);
    workbenchLayout.unmaximize(widget);

    verify(widget).addStyleName(WorkbenchLayoutImpl.UF_MAXIMIZED_PANEL);
    verify(widget).removeStyleName(WorkbenchLayoutImpl.UF_MAXIMIZED_PANEL);

    verify(((RequiresResize) widget),
           never()).onResize();
}
项目:appformer    文件:WorkbenchLayoutImplTest.java   
@Test
public void testCollapseAnimation() {
    final HashMap<Widget, WorkbenchLayoutImpl.OriginalStyleInfo> maximizedWidgetOriginalStyles = Maps.newHashMap();
    maximizedWidgetOriginalStyles.put(widget,
                                      new WorkbenchLayoutImpl.OriginalStyleInfo(widget));
    final WorkbenchLayoutImpl.CollapseAnimation collapseAnimation = new WorkbenchLayoutImpl.CollapseAnimation(
            widget,
            maximizedWidgetOriginalStyles,
            null);

    collapseAnimation.onComplete();

    verify(((RequiresResize) widget)).onResize();
}
项目:appformer    文件:MultiListWorkbenchPanelViewTest.java   
@Test
public void shouldPropagateOnResize() {
    view.onResize();
    RequiresResize viewChild = (RequiresResize) view.getWidget();
    verify(viewChild,
           times(1)).onResize();
}
项目:mvp4g-examples    文件:FlowLayoutPanel.java   
@Override
public void onResize() {
  for (Widget widget : getChildren()) {
    if (widget instanceof RequiresResize) {
      ((RequiresResize) widget).onResize();
    }
  }
}
项目:mvp4g-examples    文件:FlowLayoutPanel.java   
@Override
public void onResize() {
  for (Widget widget : getChildren()) {
    if (widget instanceof RequiresResize) {
      ((RequiresResize) widget).onResize();
    }
  }
}
项目:mvp4g-examples    文件:FlowLayoutPanel.java   
@Override
public void onResize() {
  for (Widget widget : getChildren()) {
    if (widget instanceof RequiresResize) {
      ((RequiresResize) widget).onResize();
    }
  }
}
项目:platypus-js    文件:StandaloneRootPanel.java   
@Override
public void onResize() {
    Widget child = getWidget();
    if (child instanceof RequiresResize) {
        ((RequiresResize) child).onResize();
    }
}
项目:platypus-js    文件:BoxPanel.java   
public void ajustDisplay(Widget child) {
    if (child.getParent() == this) {
        boolean visible = !child.getElement().hasAttribute("aria-hidden");
        if (orientation == Orientation.HORIZONTAL) {
            child.getElement().getStyle().setDisplay(visible ? Style.Display.INLINE_BLOCK : Style.Display.NONE);
        } else {
            child.getElement().getStyle().setDisplay(visible ? Style.Display.BLOCK : Style.Display.NONE);
        }
        if (child instanceof RequiresResize)
            ((RequiresResize) child).onResize();
    }
}
项目:platypus-js    文件:CardsPanel.java   
/**
  * Shows the widget at the specified index. This causes the currently-
  * visible widget to be hidden.
  *
  * @param toBeShown the widget to be shown
  */
 public void showWidget(Widget toBeShown) {
     Widget oldWidget = visibleWidget;
     visibleWidget = toBeShown;

     if (visibleWidget != oldWidget) {
         Element oldContainer = oldWidget != null ? oldWidget.getElement().getParentElement() : null;
         Element newContainer = visibleWidget.getElement().getParentElement();

         UIObject.setVisible(newContainer, true);
         newContainer.getStyle().setDisplay(Style.Display.INLINE_BLOCK);
         visibleWidget.setVisible(true);

         if (oldContainer != null) {
             oldContainer.removeClassName("card-shown");
             oldContainer.addClassName("card-hidden");
         }
         newContainer.removeClassName("card-hidden");
         newContainer.addClassName("card-shown");

         if (oldWidget != null) {
             UIObject.setVisible(oldContainer, false);
             oldWidget.setVisible(false);
         }
         //checkButtonWidth();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {

    @Override
    public void execute() {
           if (visibleWidget instanceof RequiresResize) {
               ((RequiresResize) visibleWidget).onResize();
           }
    }

});
     }
 }
项目:platypus-js    文件:CardsPanel.java   
@Override
public void onResize() {
    //checkButtonWidth();
    for (Widget child : getChildren()) {
        if (child instanceof RequiresResize) {
            ((RequiresResize) child).onResize();
        }
    }
}
项目:platypus-js    文件:AnchorsPanel.java   
public void ajustDisplay(Widget child) {
    if (child.getParent() == this) {
        Element el = getWidgetContainerElement(child);
        boolean visible = !child.getElement().hasAttribute("aria-hidden");
        if (visible){
            el.getStyle().clearDisplay();
            if(child instanceof RequiresResize){
                ((RequiresResize)child).onResize();
            }
        } else {
            el.getStyle().setDisplay(Style.Display.NONE);
        }
    }
}
项目:platypus-js    文件:GridPanel.java   
public void setWidget(int row, int column, Widget widget) {
    Widget oldWidget = getWidget(row, column);
    if (oldWidget != null) {
        remove(oldWidget);
    }
    grid[row][column] = new SimplePanel(widget);
    super.add(grid[row][column]);
    formatCell(row, column);
    if (widget instanceof RequiresResize) {
        ((RequiresResize) widget).onResize();
    }
}