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

The following examples show how to use com.google.gwt.user.client.ui.SplitLayoutPanel. 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: PagedView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public Widget asWidget() {

        layout = new SplitLayoutPanel(2);
        layout.getElement().setId("PagedView");
        layout.setStyleName("fill-layout");


        navigationBar = bar.asWidget();
        navigationBar.addStyleName("paged-view-navigation");
        navigationBar.getElement().getStyle().setMarginTop(30, PX);
        /*navigationBar.getElement().getStyle().setMarginTop(0, PX);
        navigationBar.getElement().getStyle().setMarginBottom(0, PX);
        navigationBar.getElement().getStyle().setMarginLeft(15, PX);
        navigationBar.getElement().getStyle().setMarginRight(15, PX);*/
        layout.addWest(navigationBar, 256);
        navigationBar.getElement().getParentElement().addClassName("paged-view-navigation-container");
        layout.add(deck);



        layout.setWidgetHidden(navigationBar, !navOnFirstPage);

        return layout;
    }
 
Example #3
Source File: GwtThreeComponentSplitLayout.java    From consulo with Apache License 2.0 5 votes vote down vote up
public GwtThreeComponentSplitLayout() {
  mySplitLayoutPanel = new SplitLayoutPanel(1);

  GwtUIUtil.fill(mySplitLayoutPanel);

  setWidget(mySplitLayoutPanel);

  mySplitLayoutPanel.addWest(myLeftPanel, 250);
  mySplitLayoutPanel.addEast(myRightPanel, 250);
  mySplitLayoutPanel.add(myCenterPanel);

  mySplitLayoutPanel.setWidgetHidden(myLeftPanel, true);
  mySplitLayoutPanel.setWidgetHidden(myRightPanel, true);
  mySplitLayoutPanel.setWidgetHidden(myCenterPanel, true);
}
 
Example #4
Source File: MonitorView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
@Override
public Widget createMainLayout() {
	SplitLayoutPanel splitLayout = new SplitLayoutPanel();


	StackLayoutPanel stack = new StackLayoutPanel(Unit.EM);
	stack.setStyleName("sp");
	ScrollPanel leftcrp = new ScrollPanel();
	leftcrp.setSize("100%", "100%");
	VerticalPanel vPanel = new VerticalPanel();
	vPanel.setWidth("100%");

	programTree = ProgramTreeLoader.load(AppController.email);
	datasetTree = DatasetTreeLoader.load(AppController.email);
	jobTree = JobTreeLoader.load(AppController.email);
	resultTree = new SearchTree();
	initTabPanel();
	DisclosurePanel distackleft = new DisclosureStackPanel("Search")
	.asWidget();
	searchGrid = new SearchGrid(programTree,datasetTree,jobTree,resultTree);
	distackleft.setContent(searchGrid);
	SimplePanel tabSimPanel = new SimplePanel();
	tabSimPanel.add(tabPanel);

	vPanel.add(tabSimPanel);
	vPanel.add(distackleft);
	leftcrp.add(vPanel);
	stack.add(leftcrp, "", 0);

	StackLayoutPanel stackright = new StackLayoutPanel(Unit.EM);
	stackright.setStyleName("sp");
	DisclosurePanel distackright1 = new DisclosureStackPanel(Constants.studioUIMsg.jobPanelTitle())
	.asWidget();
	DisclosurePanel distackright2 = new DisclosureStackPanel(Constants.studioUIMsg.modulePanelTitle())
	.asWidget();
	ScrollPanel scvp = new ScrollPanel();
	VerticalPanel verticalPanel = new VerticalPanel();
	verticalPanel.setWidth("100%");

	HorizontalPanel btnPanel = new HorizontalPanel();
	historyBtn.removeStyleName("gwt-Button");
	historyBtn.addStyleName("history-button-style");
	submitBtn.setEnabled( false );
	submitBtn.removeStyleName("gwt-Button");
	submitBtn.addStyleName("button-style");
	clearBtn.removeStyleName("gwt-Button");
	clearBtn.addStyleName("button-style");
	cloneBtn.removeStyleName("gwt-Button");
	cloneBtn.addStyleName("button-style");
	refreshBtn.removeStyleName("gwt-Button");
	refreshBtn.addStyleName("button-style");
	stopBtn.removeStyleName("gwt-Button");
	stopBtn.addStyleName("button-style");

	btnPanel.add(historyBtn);
	btnPanel.add(new HTML("  "));
	btnPanel.add(submitBtn);
	btnPanel.add(new HTML("  "));
	btnPanel.add(clearBtn);
	btnPanel.add(new HTML("  "));
	btnPanel.add(cloneBtn);
	btnPanel.add(new HTML("  "));
	btnPanel.add(stopBtn);
	btnPanel.add(new HTML("  "));
	btnPanel.add(refreshBtn);


	btnPanel2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	btnPanel2.add(btnPanel);
	btnPanel2.addStyleName("btnPanel");

	splitLayout.addWest(stack, 200);

	jobDescGrid = new MonitorJobDescGrid();

	distackright1.setContent(jobDescGrid);
	distackright2.setContent(propPanel);
	verticalPanel.add(distackright1);
	verticalPanel.add(distackright2);
	scvp.add(verticalPanel);
	stackright.add(scvp, "", 0);
	splitLayout.addEast(stackright, 287);

	// Use different controllers in different classes
	setController(new MonitorController(Constants.CONTROLLER_WIDTH,
			Constants.CONTROLLER_HEIGHT));
	rebuiltLayoutPanel(getController());
	splitLayout.add(layoutPanel);

	return splitLayout;
}
 
Example #5
Source File: CellBrowser.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected <T> CellBrowser(Builder<T> builder) {
  super(builder.viewModel);
  if (template == null) {
    template = GWT.create(Template.class);
  }
  Resources resources = builder.resources();
  this.style = resources.cellBrowserStyle();
  this.style.ensureInjected();
  this.cellListResources = new CellListResourcesImpl(resources);
  this.loadingIndicator = builder.loadingIndicator;
  this.pagerFactory = builder.pagerFactory;
  this.pageSize = builder.pageSize;
  initWidget(new SplitLayoutPanel());
  getElement().getStyle().setOverflow(Overflow.AUTO);
  setStyleName(this.style.cellBrowserWidget());

  // Initialize the open and close images strings.
  ImageResource treeOpen = resources.cellBrowserOpen();
  ImageResource treeClosed = resources.cellBrowserClosed();
  openImageHtml = getImageHtml(treeOpen);
  closedImageHtml = getImageHtml(treeClosed);
  imageWidth = Math.max(treeOpen.getWidth(), treeClosed.getWidth());
  minWidth = imageWidth + 20;

  // Add a placeholder to maintain the scroll width.
  scrollLock = Document.get().createDivElement();
  scrollLock.getStyle().setPosition(Position.ABSOLUTE);
  scrollLock.getStyle().setVisibility(Visibility.HIDDEN);
  scrollLock.getStyle().setZIndex(-32767);
  scrollLock.getStyle().setTop(0, Unit.PX);
  if (LocaleInfo.getCurrentLocale().isRTL()) {
    scrollLock.getStyle().setRight(0, Unit.PX);
  } else {
    scrollLock.getStyle().setLeft(0, Unit.PX);
  }
  scrollLock.getStyle().setHeight(1, Unit.PX);
  scrollLock.getStyle().setWidth(1, Unit.PX);
  getElement().appendChild(scrollLock);

  // Associate the first view with the rootValue.
  appendTreeNode(getNodeInfo(builder.rootValue), builder.rootValue);

  // Catch scroll events.
  sinkEvents(Event.ONSCROLL);
}
 
Example #6
Source File: CellBrowser.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new {@link TreeNodeImpl} and append it to the end of the
 * LayoutPanel.
 *
 * @param <C> the data type of the children
 * @param nodeInfo the info about the node
 * @param value the value of the open node
 */
private <C> TreeNode appendTreeNode(final NodeInfo<C> nodeInfo, Object value) {
  // Create the list view.
  final int level = treeNodes.size();
  final BrowserCellList<C> view = createDisplay(nodeInfo, level);

  // Create a pager and wrap the components in a scrollable container. Set the
  // tabIndex to -1 so the user can tab between lists without going through
  // the scrollable.
  ScrollPanel scrollable = new ScrollPanel();
  scrollable.getElement().setTabIndex(-1);
  final Widget pager = createPager(view);
  if (pager != null) {
    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(view);
    flowPanel.add(pager);
    scrollable.setWidget(flowPanel);
  } else {
    scrollable.setWidget(view);
  }
  scrollable.setStyleName(style.cellBrowserColumn());
  if (level == 0) {
    scrollable.addStyleName(style.cellBrowserFirstColumn());
  }

  // Create a TreeNode.
  TreeNodeImpl<C> treeNode = new TreeNodeImpl<C>(nodeInfo, value, view, scrollable);
  treeNodes.add(treeNode);

  /*
   * Attach the view to the selection model and node info. Nullify the default
   * selection manager because it is provided by the node info.
   */
  view.setSelectionModel(nodeInfo.getSelectionModel(), null);
  nodeInfo.setDataDisplay(view);

  // Add the view to the LayoutPanel.
  SplitLayoutPanel splitPanel = getSplitLayoutPanel();
  splitPanel.insertLineStart(scrollable, defaultWidth, null);
  splitPanel.setWidgetMinSize(scrollable, minWidth);
  splitPanel.forceLayout();

  // Scroll to the right.
  animation.scrollToEnd();
  return treeNode;
}
 
Example #7
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 #8
Source File: ColumnManager.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ColumnManager(SplitLayoutPanel delegate, FinderColumn.FinderId finderId) {
    this.splitlayout = delegate;
    this.finderId = finderId;
    this.eventBus = Console.MODULES.getPlaceManager();

    this.initialized = false;

    // default state
    if(null==totalColumnsVisible.get(finderId))
        totalColumnsVisible.put(finderId, 0);

    this.splitlayout.addAttachHandler(new AttachEvent.Handler() {
        @Override
        public void onAttachOrDetach(AttachEvent event) {
            if(!event.isAttached())
            {
                //System.out.println("Detach finder");
                decreaseTotalVisibleBy(ColumnManager.this.visibleColumns.size());

                assertVisibleColumns();
            }
            else
            {

                // skip the first attach event

                if(initialized) {

                   // System.out.println("Attach finder");

                    if (visibleColumns.size() > 0) {
                        increaseTotalVisibleBy(ColumnManager.this.visibleColumns.size());

                        assertVisibleColumns();
                    }
                }
                else
                {
                    initialized = true;
                }

                scrollIfNecessary();

            }
        }
    });


    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent resizeEvent) {
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    scrollIfNecessary();
                }
            });
        }
    });
}
 
Example #9
Source File: VerticalSplitLayoutExtended.java    From document-management-system with GNU General Public License v2.0 2 votes vote down vote up
/**
 * getSplitPanel
 *
 * @return
 */
public SplitLayoutPanel getSplitPanel() {
	return this;
}
 
Example #10
Source File: CellBrowser.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link SplitLayoutPanel} used to lay out the views.
 *
 * @return the {@link SplitLayoutPanel}
 */
private SplitLayoutPanel getSplitLayoutPanel() {
  return (SplitLayoutPanel) getWidget();
}