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

The following examples show how to use com.google.gwt.user.client.ui.AbsolutePanel. 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: MockMap.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
public MockMap(SimpleEditor editor) {
  super(editor, TYPE, images.map(), new MockMapLayout());
  initToolbarItems();

  rootPanel.setHeight("100%");

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

  initComponent(mapWidget);
  mapWidget.addAttachHandler(new AttachEvent.Handler() {
    @Override
    public void onAttachOrDetach(AttachEvent arg0) {
      if (arg0.isAttached()) {
        initPanel();
        invalidateMap();
        for (MockComponent child : children) {
          ((MockMapFeature) child).addToMap(MockMap.this);
        }
      }
    }
  });
}
 
Example #2
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 #3
Source File: PeriodPreferencesWidget.java    From unitime with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #4
Source File: MockForm.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
TitleBar() {
  title = new Label();
  title.setStylePrimaryName("ode-SimpleMockFormTitle");
  title.setHorizontalAlignment(Label.ALIGN_LEFT);

  menuButton = new Button();
  menuButton.setText("\u22ee");
  menuButton.setStylePrimaryName("ode-SimpleMockFormMenuButton");

  bar = new AbsolutePanel();
  bar.add(title);
  bar.add(menuButton);

  initWidget(bar);

  setStylePrimaryName("ode-SimpleMockFormTitleBar");
  setSize("100%", TITLEBAR_HEIGHT + "px");
}
 
Example #5
Source File: WorkAreaPanel.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * 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());
}
 
Example #6
Source File: DiagramController.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * 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);

}
 
Example #7
Source File: MockCanvas.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #8
Source File: MockContainer.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #9
Source File: BoxView.java    From shortyz with GNU General Public License v3.0 5 votes vote down vote up
@Inject
public BoxView(Resources resources){
    AbsolutePanel main = new AbsolutePanel();
    
    number.setStyleName(resources.css().number());
    letter.setStyleName(resources.css().letter());
    main.add(number, 0,0);
    main.add(letter, 0,0);

    super.initWidget(main);
    this.setStyleName(resources.css().boxPanel());
}
 
Example #10
Source File: MockTableArrangement.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new MockTableArrangement component.
 *
 * @param editor  editor of source file the component belongs to
 */
public MockTableArrangement(SimpleEditor editor) {
  super(editor, TYPE, images.table(), new MockTableLayout());

  rootPanel.setHeight("100%");

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

  initComponent(layoutWidget);
}
 
Example #11
Source File: PreviewPopupPanel.java    From EasyML with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize
 * 
 * @param path  Result root address
 */
protected void init(String path) {
	this.setSize("650px", "400px");
	this.setGlassEnabled(true);
	this.setModal(true);
	closeButton.setSize("10px", "10px");
	closeButton.setStyleName("closebtn");
	closeButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			PreviewPopupPanel.this.hide();
		}
	});
	VerticalPanel verticalPanel = new VerticalPanel();
	verticalPanel.add(closeButton);
	verticalPanel.setCellHeight(closeButton, "13px");
	verticalPanel.setStyleName("vpanel");
	desc.setStyleName("popupTitle");
	verticalPanel.add(desc);
	verticalPanel.setCellHeight(desc, "30px");

	HorizontalPanel hPanel = new HorizontalPanel();
	savebtn.setStyleName("popupsavebtn");
	savebtn.setVisible(false);
	refreshBtn.setStyleName("popuprefreshbtn");
	refreshBtn.setVisible(false);
	uploadSubmitButton.setVisible(false);
	hPanel.add(uploadSubmitButton);
	hPanel.add(savebtn);
	hPanel.add(refreshBtn);
	hPanel.setCellVerticalAlignment(uploadSubmitButton,
			HasVerticalAlignment.ALIGN_BOTTOM);

	tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);
	tabPanel.setSize("650px", "355px");
	dirPanel = new HorizontalPanel();
	resultDirTree = PopupRetDirTreeLoad.load(path);
	resultDirTree.getRoot().setState(false);
	ScrollPanel dirScrollPanel = new ScrollPanel();
	dirScrollPanel.add(resultDirTree);
	dirScrollPanel.setAlwaysShowScrollBars(true);
	dirScrollPanel.setSize("300px", "320px");

	VerticalPanel fileViewPanel = new VerticalPanel();
	fileLabel.setText("Please select a file to view!");
	fileLabel.setStyleName("popupFileSelectName");
	fileViewPanel.add(fileLabel);
	fileTextArea.setStyleName("popupMsg");
	fileTextArea.setSize("342px", "298px");
	fileTextArea.getElement().setAttribute("wrap", "off");    
	fileTextArea.setReadOnly(true);
	fileViewPanel.add(fileTextArea);
	dirPanel.add(dirScrollPanel);
	dirPanel.add(fileViewPanel);
	tabPanel.add(dirPanel,"Results directory");

	AbsolutePanel bottomPanel = new AbsolutePanel(); 
	bottomPanel.setSize("650px", "360px");
	bottomPanel.add(tabPanel, 0, 0);
	bottomPanel.add(hPanel,460,3);

	fileSizeLabel.setStyleName("popupFileSelectName");
	verticalPanel.add(bottomPanel); 
	verticalPanel.add(fileSizeLabel);
	this.add(verticalPanel);
	this.setStyleName("loading_container");
}
 
Example #12
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;
}
 
Example #13
Source File: MockForm.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new MockForm component.
 *
 * @param editor  editor of source file the component belongs to
 */
public MockForm(SimpleEditor editor) {
  // Note(Hal): This helper thing is a kludge because I really want to write:
  // myLayout = new MockHVLayout(orientation);
  // super(editor, type, icon, myLayout);
  // but Java won't let me do that.

  super(editor, TYPE, images.form(), MockFormHelper.makeLayout());
  // Note(hal): There better not be any calls to MockFormHelper before the
  // next instruction.  Note that the Helper methods are synchronized to avoid possible
  // future problems if we ever have threads creating forms in parallel.
  myLayout = MockFormHelper.getLayout();

  phoneWidget = new AbsolutePanel();
  phoneWidget.setStylePrimaryName("ode-SimpleMockFormPhonePortrait");
  formWidget = new AbsolutePanel();
  formWidget.setStylePrimaryName("ode-SimpleMockForm");
  responsivePanel = new AbsolutePanel();

  // Initialize mock form UI by adding the phone bar and title bar.
  responsivePanel.add(new PhoneBar());
  titleBar = new TitleBar();
  responsivePanel.add(titleBar);

  // Put a ScrollPanel around the rootPanel.
  scrollPanel = new ScrollPanel(rootPanel);
  responsivePanel.add(scrollPanel);

  formWidget.add(responsivePanel);

  //Add navigation bar at the bottom of the viewer.
  navigationBar = new NavigationBar();
  formWidget.add(navigationBar);

  phoneWidget.add(formWidget);
  initComponent(phoneWidget);

  // Set up the initial state of the vertical alignment property editor and its dropdowns
  try {
    myVAlignmentPropertyEditor = PropertiesUtil.getVAlignmentEditor(properties);
  } catch (BadPropertyEditorException e) {
    OdeLog.log(MESSAGES.badAlignmentPropertyEditorForArrangement());
    return;
  }
  enableAndDisableDropdowns();
  initialized = true;
  // Now that the default for Scrollable is false, we need to force setting the property when creating the MockForm
  setScrollableProperty(getPropertyValue(PROPERTY_NAME_SCROLLABLE));
}
 
Example #14
Source File: MockForm.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
NavigationBar() {
  bar = new AbsolutePanel();
  initWidget(bar);

  setStylePrimaryName("ode-SimpleMockFormNavigationBarPortrait");
}
 
Example #15
Source File: DiagramController.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public AbsolutePanel getWidgetPanel() {
	return widgetPanel;
}
 
Example #16
Source File: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
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());
}
 
Example #17
Source File: DiagramController.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public void setWidgetPanel(AbsolutePanel widgetPanel) {
	this.widgetPanel = widgetPanel;
}
 
Example #18
Source File: DiagramController.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public AbsolutePanel getView() {
	return widgetPanel;
}
 
Example #19
Source File: MockContainer.java    From appinventor-extensions with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the GWT root panel that displays the children of this container.
 * <p>
 * This method should only be called by layout managers.
 */
final AbsolutePanel getRootPanel() {
  return rootPanel;
}
 
Example #20
Source File: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 
 * @return the view where the widgets are displayed
 */
public AbsolutePanel getView() {
	return widgetPanel;
}
 
Example #21
Source File: RoomSharingWidget.java    From unitime with Apache License 2.0 votes vote down vote up
public AbsolutePanel getPanel() { return iPanel; } 
Example #22
Source File: PeriodPreferencesWidget.java    From unitime with Apache License 2.0 votes vote down vote up
public AbsolutePanel getPanel() { return iPanel; }