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

项目:unitimes    文件:PeriodPreferencesWidget.java   
public PeriodPreferencesWidget(boolean editable) {
    iEditable = editable;

    iPanel = new AbsolutePanel();

    iHorizontal = new CheckBox(MESSAGES.periodPreferenceHorizontal());
    iHorizontal.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            RoomCookie.getInstance().setHorizontal(iHorizontal.getValue());
            render();
        }
    });

    initWidget(iPanel);
}
项目:appinventor-extensions    文件:WorkAreaPanel.java   
/**
 * Creates a new work area.
 *
 * @param boxRegistry  box registry for creating boxes
 * @param layout  initial layout for work area
 */
public WorkAreaPanel(BoxRegistry boxRegistry, Layout layout) {
  this.boxRegistry = boxRegistry;
  this.layout = layout;

  layouts = new HashMap<String, Layout>();
  layouts.put(layout.getName(), layout);

  boundaryPanel = new AbsolutePanel();
  boundaryPanel.setSize("100%", "100%");
  setWidget(boundaryPanel);
  setSize("100%", "100%");

  widgetDragController = new PickupDragController(boundaryPanel, false);
  widgetDragController.setBehaviorMultipleSelection(false);

  switchLayout(layout.getName());
}
项目:WebConsole    文件:ConsoleDisplay.java   
public ConsoleDisplay() {
    super(new AbsolutePanel(), CLASS_NAME);
    getElement().setId("consoleDisplayWrapper");

    // Create display panel where screen is actually loaded
    display = new AbsolutePanel();
    display.addStyleName("portrait");
    display.getElement().setId("consoleDisplay");

    // Add display to the wrapper
    ((AbsolutePanel)getWidget()).add(display, 0, 0);

    // Add move handlers which are only used on this display component
    if(BrowserUtils.isMobile) {
        this.addDomHandler(this, TouchMoveEvent.getType());
    } else {
        this.addDomHandler(this, MouseMoveEvent.getType());
        this.addDomHandler(this, MouseOutEvent.getType());
    }
}
项目:WebConsole    文件:ImageComponent.java   
public void setInitialImage(String src) {
        String url = WebConsole.getConsoleUnit().getControllerService().getController().getResourcesUrl();
        url += src;
        initialImage = WebConsole.getConsoleUnit().getImageFromCache(url);
        initialImage.addCallback(loadedCallback);
//      initialImage.setUrl(url);
//      initialImage.getImage().addLoadHandler(new LoadHandler() {
//          @Override
//          public void onLoad(LoadEvent event) {
//              initialImage.setExists(true);
//              initialImage.setVisible(true);
//          }
//      });
        if (initialImage != null) {
            ((AbsolutePanel)getWidget()).add(initialImage.getImage(), 0, 0);
        }
    }
项目:che    文件:MenuLockLayer.java   
public MenuLockLayer(CloseMenuHandler closeMenuCallback, int topOffset) {
  this.closeMenuCallback = closeMenuCallback;
  this.topOffset = topOffset;

  getElement().setId("menu-lock-layer-id");
  RootPanel.get().add(this, 0, topOffset);
  getElement().getStyle().setProperty("right", "0px");
  getElement().getStyle().setProperty("bottom", "0px");
  getElement().getStyle().setProperty("zIndex", (Integer.MAX_VALUE - 5) + "");

  AbsolutePanel blockMouseEventsPanel = new LockLayer();
  blockMouseEventsPanel.setStyleName("exo-lockLayer");
  blockMouseEventsPanel.getElement().getStyle().setProperty("position", "absolute");
  blockMouseEventsPanel.getElement().getStyle().setProperty("left", "0px");
  blockMouseEventsPanel.getElement().getStyle().setProperty("top", "0px");
  blockMouseEventsPanel.getElement().getStyle().setProperty("right", "0px");
  blockMouseEventsPanel.getElement().getStyle().setProperty("bottom", "0px");
  add(blockMouseEventsPanel);
}
项目:onecmdb    文件:DragControl.java   
public void onMouseMove(Widget source, int x, int y) {
    if (dragging) {
        // System.out.println("MOUSE MOVE:" + x + "," + y);

        AbsolutePanel rootPanel = getAbsoluteWidgetPanel(dragWidget);


        int newX = x + dragWidget.getAbsoluteLeft() - xOffset;
        int newY = y + dragWidget.getAbsoluteTop() - yOffset;




        int rootOffsetY = newY - rootPanel.getAbsoluteTop();
        int rootOffsetX =  newX-rootPanel.getAbsoluteLeft();
        if (rootOffsetX < 0) {
            rootOffsetX = 0;
        }
        if (rootOffsetY < 0) {
            rootOffsetY = 0;
        }
        rootPanel.setWidgetPosition(dragWidget, rootOffsetX, rootOffsetY);
    }
}
项目:firefly    文件:TabPane.java   
public TabPane() {
        tabs = new ArrayList<Tab<T>>();
//        visibleTabs = new ArrayList<Tab<T>>();
        tabPanel = new TabLayoutPanelPlus(20, Style.Unit.PX);
        tabPanel.setStyleName("firefly-TabPane");

        wrapper = new AbsolutePanel();
        wrapper.add(tabPanel);
        tabPanel.setSize("100%", "100%");
        initWidget(wrapper);

        SelHandler selHandler = new SelHandler();

        tabPanel.addBeforeSelectionHandler(selHandler);
        tabPanel.addSelectionHandler(selHandler);

        WebEventManager.getAppEvManager().addListener(Name.WINDOW_RESIZE,
                new WebEventListener(){
                    public void eventNotify(WebEvent ev) {
                        ensureHelpPos();
                    }
                });

    }
项目:firefly    文件:ShadowedPanel.java   
public ShadowedPanel(Widget w) {
    p = new AbsolutePanel();
    initWidget(p);
    p.add(_panel);
    _panel.setStyleName("shadow");
    setSize("100%", "100%");
    GwtUtil.setStyles(_panel, "position", "absolute", "top", "0px", "bottom", "0px", "left", "0px", "right", "0px");
    if (w!=null) setContent(w);
    WebEventManager.getAppEvManager().addListener(Name.WINDOW_RESIZE,
            new WebEventListener(){
                public void eventNotify(WebEvent ev) {
                    if (helpIcon != null) {
                        p.setWidgetPosition(helpIcon, p.getOffsetWidth()-23, 7);
                    }
                }
            });

}
项目:unitime    文件:PeriodPreferencesWidget.java   
public PeriodPreferencesWidget(boolean editable) {
    iEditable = editable;

    iPanel = new AbsolutePanel();

    iHorizontal = new CheckBox(MESSAGES.periodPreferenceHorizontal());
    iHorizontal.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            RoomCookie.getInstance().setHorizontal(iHorizontal.getValue());
            render();
        }
    });

    initWidget(iPanel);
}
项目:appformer    文件:GridLienzoScrollBarsTest.java   
private Panel scrollPanel() {

        final Panel panel = mock(AbsolutePanel.class);
        final Element element = mock(Element.class);

        doReturn(SCROLL_LEFT).when(element).getScrollLeft();
        doReturn(SCROLL_TOP).when(element).getScrollTop();
        doReturn(SCROLL_WIDTH).when(element).getScrollWidth();
        doReturn(SCROLL_HEIGHT).when(element).getScrollHeight();
        doReturn(CLIENT_WIDTH).when(element).getClientWidth();
        doReturn(CLIENT_HEIGHT).when(element).getClientHeight();

        doReturn(element).when(panel).getElement();

        return panel;
    }
项目:appformer    文件:GridLienzoScrollBarsTest.java   
private Panel emptyPanel() {

        final Panel panel = mock(AbsolutePanel.class);
        final Element element = mock(Element.class);

        doReturn(0).when(element).getScrollLeft();
        doReturn(0).when(element).getScrollTop();
        doReturn(0).when(element).getScrollWidth();
        doReturn(0).when(element).getScrollHeight();
        doReturn(0).when(element).getClientWidth();
        doReturn(0).when(element).getClientHeight();

        doReturn(element).when(panel).getElement();

        return panel;
    }
项目:appformer    文件:GridLienzoScrollHandlerTest.java   
@Test
public void testSetupScrollBarSynchronization() {

    final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);
    final ScrollHandler scrollHandler = mock(ScrollHandler.class);

    doReturn(scrollHandler).when(gridLienzoScrollHandler).onScroll();
    doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();
    doNothing().when(gridLienzoScrollHandler).synchronizeScrollSize();

    gridLienzoScrollHandler.setupScrollBarSynchronization();

    verify(gridLienzoScrollHandler).synchronizeScrollSize();
    verify(scrollPanel).addDomHandler(scrollHandler,
                                      ScrollEvent.getType());
}
项目:appformer    文件:GridLienzoScrollHandlerTest.java   
@Test
public void testSynchronizeScrollSize() {

    final AbsolutePanel panel = mock(AbsolutePanel.class);
    final Integer internalScrollPanelWidth = 42;
    final Integer internalScrollPanelHeight = 58;

    doReturn(internalScrollPanelWidth).when(gridLienzoScrollHandler).calculateInternalScrollPanelWidth();
    doReturn(internalScrollPanelHeight).when(gridLienzoScrollHandler).calculateInternalScrollPanelHeight();
    doReturn(panel).when(gridLienzoScrollHandler).getInternalScrollPanel();

    gridLienzoScrollHandler.synchronizeScrollSize();

    verify(panel).setPixelSize(eq(internalScrollPanelWidth),
                               eq(internalScrollPanelHeight));
}
项目:appformer    文件:GridLienzoScrollHandlerTest.java   
@Test
public void testScrollbarWidth() {

    final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);
    final Element element = mock(Element.class);
    final Integer offsetWidth = 1014;
    final Integer clientWidth = 1000;

    doReturn(offsetWidth).when(element).getOffsetWidth();
    doReturn(clientWidth).when(element).getClientWidth();
    doReturn(element).when(scrollPanel).getElement();
    doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();

    final Integer expectedScrollbarWidth = offsetWidth - clientWidth;
    final Integer actualScrollbarWidth = gridLienzoScrollHandler.scrollbarWidth();

    assertEquals(expectedScrollbarWidth,
                 actualScrollbarWidth);
}
项目:appformer    文件:GridLienzoScrollHandlerTest.java   
@Test
public void testScrollbarHeight() {

    final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);
    final Element element = mock(Element.class);
    final Integer offsetHeight = 1014;
    final Integer clientHeight = 1000;

    doReturn(offsetHeight).when(element).getOffsetHeight();
    doReturn(clientHeight).when(element).getClientHeight();
    doReturn(element).when(scrollPanel).getElement();
    doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();

    final Integer expectedScrollbarHeight = offsetHeight - clientHeight;
    final Integer actualScrollbarHeight = gridLienzoScrollHandler.scrollbarHeight();

    assertEquals(expectedScrollbarHeight,
                 actualScrollbarHeight);
}
项目:appformer    文件:GridLienzoScrollHandlerTest.java   
@Test
public void testSetupContextSwitcher() {

    final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);
    final LienzoPanel lienzoPanel = mock(LienzoPanel.class);
    final MouseWheelHandler wheelHandler = mock(MouseWheelHandler.class);
    final MouseMoveHandler moveHandler = mock(MouseMoveHandler.class);

    doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer();
    doReturn(wheelHandler).when(gridLienzoScrollHandler).disablePointerEvents();
    doReturn(moveHandler).when(gridLienzoScrollHandler).enablePointerEvents();

    gridLienzoScrollHandler.setupContextSwitcher();

    verify(domElementContainer).addDomHandler(wheelHandler, MouseWheelEvent.getType());
    verify(gridLienzoPanel).addMouseMoveHandler(moveHandler);
}
项目:appformer    文件:WorkbenchPickupDragController.java   
@Override
protected Widget newDragProxy(DragContext context) {
    final AbsolutePanel container = new AbsolutePanel();
    container.getElement().getStyle().setProperty("overflow",
                                                  "visible");
    container.getElement().getStyle().setOpacity(0.5);
    container.getElement().getStyle().setZIndex(Integer.MAX_VALUE);

    //Offset to centre of dragProxy
    int offsetX = 0 - ((int) (dragProxy.getWidth() * 0.5));
    int offsetY = 0 - ((int) (dragProxy.getHeight() * 2));
    container.add(dragProxy,
                  offsetX,
                  offsetY);
    return container;
}
项目:appformer    文件:WorkbenchLayoutImpl.java   
@Override
public void onBootstrap() {
    dndManager.unregisterDropControllers();

    AbsolutePanel dragBoundary = dragController.getBoundaryPanel();
    dragBoundary.add(perspectiveRootContainer);

    setupDocksContainer();
    rootContainer.add(dragBoundary);

    Layouts.setToFillParent(perspectiveRootContainer);
    Layouts.setToFillParent(dragBoundary);
    Layouts.setToFillParent(rootContainer);

    root.setContentWidget(rootContainer);
}
项目:appformer    文件:WorkbenchStartupTest.java   
@Before
public void setup() {
    when(bm.lookupBeans(any(Class.class))).thenReturn(Collections.emptyList());
    when(dragController.getBoundaryPanel()).thenReturn(new AbsolutePanel());
    doNothing().when(workbench).addLayoutToRootPanel(any(WorkbenchLayout.class));
    when(permissionManager.getAuthorizationPolicy()).thenReturn(authorizationPolicy);
    when(authorizationManager.authorize(any(Resource.class),
                                        any(User.class))).thenReturn(true);
    when(bm.lookupBeans(PerspectiveActivity.class)).thenReturn(Arrays.asList(perspectiveBean1,
                                                                             perspectiveBean2));
    when(perspectiveBean1.getInstance()).thenReturn(perspectiveActivity1);
    when(perspectiveBean2.getInstance()).thenReturn(perspectiveActivity2);
    when(perspectiveActivity1.getIdentifier()).thenReturn("perspective1");
    when(perspectiveActivity2.getIdentifier()).thenReturn("perspective2");
    when(perspectiveActivity2.isDefault()).thenReturn(true);
}
项目:qafe-platform    文件:PanelRenderer.java   
private void addChecksum(UIObject panel) {
    QHidden qafeChecksum = new QHidden();
    DOM.setElementAttribute(qafeChecksum.getElement(), "fn", DataContainerGVO.QAFE_CHECKSUM);
    if (panel instanceof FlexTable) {
        FlexTable flexTable = (FlexTable)panel;
        int rowCount = flexTable.getRowCount();
        flexTable.setWidget(rowCount, 0, qafeChecksum);
    } else if (panel instanceof AbsolutePanel) {
        AbsolutePanel absolutePanel = (AbsolutePanel)panel;
        absolutePanel.add(qafeChecksum, 0, 0);
    } else if (panel instanceof DockPanel) {
        DockPanel dockPanel = (DockPanel)panel;
        //dockPanel.add(qafeChecksum);
    } else if (panel instanceof CellPanel) {
        CellPanel cellPanel = (CellPanel)panel;
        cellPanel.add(qafeChecksum);
    }
}
项目:risk    文件:TankMovingAnimation.java   
public TankMovingAnimation(HTML mapContainer, int startX, int startY, int endX, int endY,
    ImageResource resource, Audio sfx, int tankSize) {
  piece = resource;
  this.startX = startX;
  this.startY = startY;
  this.endX = endX;
  this.endY = endY;
  this.startWidth = tankSize;
  this.startHeight = tankSize;
  sound = sfx;
  cancelled = false;

  panel = new AbsolutePanel();
  moving = new Image(resource);
  moving.setPixelSize(startWidth, startHeight);
  panel.add(moving, startX, startY);
  panel.getElement().getStyle().setOverflow(Overflow.VISIBLE);
  panel.getElement().getStyle().setPosition(Position.RELATIVE);
  mapContainer.getElement().insertFirst(panel.getElement());
}
项目:geomajas-project-hammer-gwt    文件:PanelsSample.java   
@Override
public Widget createWidget() {
    panel = new AbsolutePanel();
    panel.add(new Label("Swipe"));
    CheckBox checkBox = new CheckBox("unregister handler");
    checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
                unregisterHandler(EventType.SWIPE);
            } else {
                registerSwipeHandler(swipeHandler);
            }
        }
    });

    panel.add(checkBox);
    panel.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
    panel.setSize("150px", "200px");
    panel.getElement().setId("hammerWidget");
    panel.getElement().getStyle().setBackgroundColor("green");
    panel.getElement().getStyle().setRight(0, Style.Unit.PX);
    panel.getElement().getStyle().setTop(0, Style.Unit.PX);

    return panel;
}
项目:OneCMDBwithMaven    文件:DragControl.java   
public void onMouseMove(Widget source, int x, int y) {
    if (dragging) {
        // System.out.println("MOUSE MOVE:" + x + "," + y);

        AbsolutePanel rootPanel = getAbsoluteWidgetPanel(dragWidget);


        int newX = x + dragWidget.getAbsoluteLeft() - xOffset;
        int newY = y + dragWidget.getAbsoluteTop() - yOffset;




        int rootOffsetY = newY - rootPanel.getAbsoluteTop();
        int rootOffsetX =  newX-rootPanel.getAbsoluteLeft();
        if (rootOffsetX < 0) {
            rootOffsetX = 0;
        }
        if (rootOffsetY < 0) {
            rootOffsetY = 0;
        }
        rootPanel.setWidgetPosition(dragWidget, rootOffsetX, rootOffsetY);
    }
}
项目:rva    文件:PresentationLayoutWidget.java   
private void setWidgetPixelPosition(Widget placeholderWidget, PlaceholderInfo placeholder, int offset) {
//      if (placeholderWidget.getParent() != null) {
//          DOM.setStyleAttribute(placeholderWidget.getElement(), "position", "absolute");
//          DOM.setStyleAttribute(placeholderWidget.getElement(), "left", (placeholder.getLeft() + offset) + placeholder.getLeftUnits());
//          DOM.setStyleAttribute(placeholderWidget.getElement(), "top", (placeholder.getTop() + offset) + placeholder.getTopUnits());
//      }

        int top = getPixelSize(placeholder.getTop(), height, placeholder.getTopUnits());
        int left = getPixelSize(placeholder.getLeft(), width, placeholder.getLeftUnits());

        if (placeholderWidget.getParent() != null) {
            AbsolutePanel parent = (AbsolutePanel) placeholderWidget.getParent();

            parent.setWidgetPosition(placeholderWidget, left + offset, top + offset);
        }
    }
项目:QMAClone    文件:InputWidgetGroup.java   
public InputWidgetGroup(PacketProblem problem, AnswerView answerView,
        QuestionPanel questionPanel, SessionData sessionData) {
    super(problem, answerView, questionPanel, sessionData);

    // 解答フォーム表示位置の予約
    int numberOfGroups = ImmutableSet.copyOf(problem.getAnswerList()).size();
    int numberOfChoices = problem.getNumberOfShuffledChoices();

    // 解答フォームの表示
    gridConstrainedDropTarget = new AbsolutePanel();
    gridConstrainedDropTarget.setPixelSize(getDraggableOffsetWidth() * numberOfGroups + 8,
            draggableOffsetHeight * (numberOfChoices + 1) + 8);
    add(gridConstrainedDropTarget);
    // 表示先のDOMのサイズが確定しておらず、ラベルを追加すると左上に表示されてしまうため、追加タイミングを遅らせる
    Scheduler.get().scheduleDeferred(cmd);

    // OKボタン
    buttonOk.setStyleName(STYLE_NAME_GROUP_CONTROL);
    add(buttonOk);
}
项目:FallenGalaxy    文件:EmpireView.java   
public EmpireView() {
    getElement().setId("empireView");
    getElement().setAttribute("unselectable", "on");

    this.maxRowsCount = computeMaxRowsCount();
    this.fleets = new ArrayList<PlayerFleetData>();
    this.systems = new ArrayList<PlayerStarSystemData>();
    this.generators = new ArrayList<PlayerGeneratorData>();
    this.lastSystemsUpdate = 0;
    this.empireRows = new ArrayList<AbsolutePanel>();
    this.scrollUp = new ScrollView(this, true);
    this.scrollDown = new ScrollView(this, false);
    this.views = new ArrayList<View>();
    this.lastFleetUpdates = new HashMap<Integer, Long>();
    this.fleetViews = new HashMap<Integer, FleetView>();

    Window.addWindowResizeListener(this);

    sinkEvents(Event.ONCLICK | Event.ONDBLCLICK | Event.ONMOUSEWHEEL);
}
项目:gwt-connectors    文件:Shape.java   
private List<ConnectionPoint> createOvalShapeCP(AbsolutePanel connectionPointsPanel, Diagram diagram) {
  List<ConnectionPoint> connectionPoints = new ArrayList<ConnectionPoint>();

  ConnectionPoint cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_LEFT, 0, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_TOP, 1, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_TOP, 2, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_TOP, 3, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_RIGHT, 4, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_BOTTOM, 5, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_BOTTOM, 6, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_BOTTOM, 7, connectedWidget);
  connectionPoints.add(cp);

  calculateOvalCPPositions(connectionPoints, connectionPointsPanel);

  addConnectionPoints(connectionPoints, connectionPointsPanel);

  return connectionPoints;
}
项目:gwt-connectors    文件:Shape.java   
private void calculateOvalCPPositions(List<ConnectionPoint> connectionPoints, AbsolutePanel connectionPointsPanel) {
  double topRadius = ((double) connectedWidget.getOffsetHeight()) / 2.0;
  double widthRadius = ((double) connectedWidget.getOffsetWidth()) / 2.0;
  for (int i = 0; i < 8; i++) {
    connectionPoints.get(i).positionOnCPPanel = new Point(
        (int) Math.floor(widthRadius + ConnectionPoint.SIZE - (widthRadius * Math.cos((double) 2.0 * Math.PI / (double) 8.0 * i))), 
        (int) Math.floor(topRadius + ConnectionPoint.SIZE - (topRadius * Math.sin((double) 2.0 * Math.PI / (double) 8.0 * i))));
  }

  topRadius += END_POINT_DISTANCE_FROM_WIDGET + ConnectionPoint.RADIUS;
  widthRadius += END_POINT_DISTANCE_FROM_WIDGET + ConnectionPoint.RADIUS;
  for (int i = 0; i < 8; i++) {
    connectionPoints.get(i).endPointPosition = new Point(
        (int) Math.floor(widthRadius + ConnectionPoint.RADIUS - (widthRadius * Math.cos((double) 2.0 * Math.PI / (double) 8.0 * i))), 
        (int) Math.floor(topRadius + ConnectionPoint.RADIUS - (topRadius * Math.sin((double) 2.0 * Math.PI / (double) 8.0 * i))));
  }
}
项目:gwt-connectors    文件:Shape.java   
private List<ConnectionPoint> createDiamondShapeCP(AbsolutePanel connectionPointsPanel, Diagram diagram) {
  List<ConnectionPoint> connectionPoints = new ArrayList<ConnectionPoint>();

  ConnectionPoint cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_LEFT, 0, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_TOP, 1, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_TOP, 2, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_TOP, 3, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_RIGHT, 4, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_BOTTOM, 5, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_BOTTOM, 6, connectedWidget);
  connectionPoints.add(cp);
  cp = new ConnectionPoint(diagram, ConnectionPoint.DIRECTION_BOTTOM, 7, connectedWidget);
  connectionPoints.add(cp);

  calculateDiamondShapeCP(connectionPoints, connectionPointsPanel);

  addConnectionPoints(connectionPoints, connectionPointsPanel);

  return connectionPoints;
}
项目:gwt-connectors    文件:ShapePickupDragController.java   
public ShapePickupDragController(AbsolutePanel boundaryPanel, boolean allowDroppingOnBoundaryPanel, Diagram diagram) {

    super(boundaryPanel, allowDroppingOnBoundaryPanel);
    dragableWidgets = new ArrayList<Widget>();
    this.diagram = diagram;

    addDragHandler(new DragHandlerAdapter() {

      @Override
      public void onPreviewDragStart(DragStartEvent event) {
        if (event.getContext().draggable instanceof Shape) {
          Shape shape = (Shape) event.getContext().draggable;
          shape.hideShapeConnectorStartPionts();
        }
      }
    });
  }
项目:gwt-connectors    文件:AxisXYDragController.java   
/**
 * Called by {@link PickupDragController#dragStart()} to allow subclasses to provide their
 * own drag proxies.
 * 
 * @param context the current drag context
 * @return a new drag proxy
 */
@SuppressWarnings("rawtypes")
protected Widget newDragProxy(DragContext context) {
  AbsolutePanel container = new AbsolutePanel();
  DOM.setStyleAttribute(container.getElement(), "overflow", "visible");

  WidgetArea draggableArea = new WidgetArea(context.draggable, null);
  for (Iterator iterator = context.selectedWidgets.iterator(); iterator.hasNext();) {
    Widget widget = (Widget) iterator.next();
    WidgetArea widgetArea = new WidgetArea(widget, null);
    Widget proxy = new SimplePanel();
    proxy.setPixelSize(widget.getOffsetWidth(), widget.getOffsetHeight());
    proxy.addStyleName(PRIVATE_CSS_PROXY);
    WidgetUtils.addWidget(container, proxy, widgetArea.getLeft() - draggableArea.getLeft(), 
        widgetArea.getTop() - draggableArea.getTop());
  }

  return container;
}
项目:gwt-connectors    文件:AxisXYDragController.java   
/**
 * Restore the selected widgets to their original location.
 * 
 * @see #saveSelectedWidgetsLocationAndStyle()
 * @see #restoreSelectedWidgetsStyle()
 */
@SuppressWarnings({"rawtypes", "deprecation"})
protected void restoreSelectedWidgetsLocation() {
  for (Iterator iterator = context.selectedWidgets.iterator(); iterator.hasNext();) {
    Widget widget = (Widget) iterator.next();
    SavedWidgetInfo info = (SavedWidgetInfo) savedWidgetInfoMap.get(widget);

    // TODO simplify after enhancement for issue 1112 provides InsertPanel interface
    // http://code.google.com/p/google-web-toolkit/issues/detail?id=1112
    if (info.initialDraggableParent instanceof AbsolutePanel) {
      WidgetUtils.addWidget(((AbsolutePanel) info.initialDraggableParent), widget, info.initialDraggableParentLocation.getLeft(),
          info.initialDraggableParentLocation.getTop());
    } else if (info.initialDraggableParent instanceof HorizontalPanel) {
      ((HorizontalPanel) info.initialDraggableParent).insert(widget, info.initialDraggableIndex);
    } else if (info.initialDraggableParent instanceof VerticalPanel) {
      ((VerticalPanel) info.initialDraggableParent).insert(widget, info.initialDraggableIndex);
    } else if (info.initialDraggableParent instanceof FlowPanel) {
      ((FlowPanel) info.initialDraggableParent).insert(widget, info.initialDraggableIndex);
    } else if (info.initialDraggableParent instanceof SimplePanel) {
      ((SimplePanel) info.initialDraggableParent).setWidget(widget);
    } else {
      throw new RuntimeException("Unable to handle initialDraggableParent "
          + GWT.getTypeName(info.initialDraggableParent));
    }
  }
}
项目:gwt-connectors    文件:WidgetUtils.java   
public static void setWidgetPosition(AbsolutePanel parent, Widget widget, int left, int top) {
    if (parent != null) {
      parent.setWidgetPosition(widget, left, top);
    } else {
      LOG.severe("Unable to set widget position, parent is null");
    }
//    WidgetLocation location = new WidgetLocation(widget, parent);
//    if (location.getLeft() != left || location.getTop() != top) {
//      parent.setWidgetPosition(widget, left + (left - location.getLeft()), top + (top - location.getTop()));
//      location = new WidgetLocation(widget, parent);
//      if (location.getLeft() != left || location.getTop() != top) {
//      if (location.getLeft() != left) {
//        LOG.warning("Moved widget to wrong LEFT location (current: " + location.getLeft() + 
//            " should be: " + left + ")");
//      }
//      if (location.getTop() != top) {
//        LOG.warning("Moved widget to wrong TOP location (current: " + location.getTop() + 
//            " should be: " + top + ")");
//      }
//      }
//    }
  }
项目:gwt-connectors    文件:WidgetUtils.java   
public static void addWidget(AbsolutePanel parent, Widget widget, int left, int top) {
    if (parent != null) {
      parent.add(widget, left, top); 
    } else {
      LOG.severe("Unable to add widget, parent is null");
    }
//    WidgetLocation location = new WidgetLocation(widget, parent);
//    if (location.getLeft() != left || location.getTop() != top) {
//      parent.setWidgetPosition(widget, left + (left - location.getLeft()), top + (top - location.getTop()));
//      location = new WidgetLocation(widget, parent);
//      if (location.getLeft() != left || location.getTop() != top) {
//        if (location.getLeft() != left) {
//          LOG.warning("Added widget to wrong LEFT location (current: " + location.getLeft() + 
//              " should be: " + left + ")");
//        }
//        if (location.getTop() != top) {
//          LOG.warning("Added widget to wrong TOP location (current: " + location.getTop() + 
//              " should be: " + top + ")");
//        }
//      }
//    }
  }
项目:drools-wb    文件:GuidedDecisionTableModellerViewImplTest.java   
@Test
public void testSetup() throws Exception {
    final AbsolutePanel mainPanel = mock(AbsolutePanel.class);
    final Transform transform = mock(Transform.class);
    final Viewport viewport = mock(Viewport.class);
    final Mediators mediators = mock(Mediators.class);
    final Element element = mock(Element.class);

    doReturn(transform).when(transform).scale(anyDouble());

    doReturn(transform).when(view).newTransform();

    doReturn(mediators).when(viewport).getMediators();

    doReturn(element).when(mockGridPanel).getElement();
    doReturn(mainPanel).when(mockGridPanel).getScrollPanel();
    doReturn(viewport).when(mockGridPanel).getViewport();

    view.setup();

    verify(view).setupGridPanel();
    verify(mediators).push(restrictedMousePanMediator);
}
项目:gwtmockito    文件:GwtMockitoWidgetBaseClassesTest.java   
@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() {});
}
项目:gwt-esri    文件:ControlHandler.java   
/**
 * Pass references to the control layer and map
 * 
 * @param m - map
 * @param cl - control layer
 */
public ControlHandler(MapWidget m, AbsolutePanel cl){
    this.map = m;
    this.controlLayer = cl;

    controlLayer.getElement().getStyle().setPosition(com.google.gwt.dom.client.Style.Position.ABSOLUTE);
    controlLayer.getElement().getStyle().setOverflow(Overflow.VISIBLE);
    controlLayer.getElement().getStyle().setTop(0, Unit.PX);
    controlLayer.getElement().getStyle().setLeft(0, Unit.PX);
    controlLayer.setStyleName("controlLayer");

    map.addResizeHandler(new MapResizeHandler(){
        @Override
        public void onMapResize(Extent extent, int width, int height) {
            moveControls();
        }
    });
}
项目:EasyML    文件:DiagramController.java   
/**
 * Initialize the widget panel according to the canvas.
 * 
 * @param canvas
 */
protected void initWidgetPanel(final DiagramCanvas canvas) {
    widgetPanel = new AbsolutePanel();
    widgetPanel.getElement().getStyle().setWidth(canvas.getWidth(), Unit.PX);
    widgetPanel.getElement().getStyle().setHeight(canvas.getHeight(), Unit.PX);
    widgetPanel.add(canvas.asWidget());

    this.svgPanel = new SVGPanel();
    widgetPanel.add(svgPanel);
    focusPanel.add(widgetPanel);
    scrollPanel = new ScrollPanel(widgetPanel);

}
项目:appinventor-extensions    文件:MockCanvas.java   
/**
 * Creates a new MockCanvas component.
 *
 * @param editor editor of source file the component belongs to
 */
public MockCanvas(SimpleEditor editor) {
  super(editor, TYPE, images.canvas(), new MockCanvasLayout());

  rootPanel.setHeight("100%");

  canvasWidget = new AbsolutePanel();
  canvasWidget.setStylePrimaryName("ode-SimpleMockContainer");
  canvasWidget.add(rootPanel);

  initComponent(canvasWidget);
}
项目:appinventor-extensions    文件:MockContainer.java   
/**
 * Creates a new component container.
 * <p>
 * Implementations are responsible for constructing their own visual appearance
 * and calling {@link #initWidget(com.google.gwt.user.client.ui.Widget)}.
 * This appearance should include {@link #rootPanel} so that children
 * components are displayed correctly.
 *
 * @param editor  editor of source file the component belongs to
 */
MockContainer(SimpleEditor editor, String type, ImageResource icon,
    MockLayout layout) {
  super(editor, type, icon);

  this.layout = layout;
  layout.setContainer(this);

  children = new ArrayList<MockComponent>();
  rootPanel = new AbsolutePanel();
}