Java Code Examples for gwt.material.design.client.ui.MaterialPanel
The following examples show how to use
gwt.material.design.client.ui.MaterialPanel. These examples are extracted from open source projects.
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 Project: gwt-material Source File: MaterialWidgetTest.java License: Apache License 2.0 | 6 votes |
public void testChildren() { // given T widget = getWidget(); // when / then if (widget.getChildren().size() == 0) { int childCount = 3; for (int i = 1; i <= childCount; i++) { MaterialPanel panel = new MaterialPanel(); widget.add(panel); } assertTrue(widget.getChildren().size() != 0); assertEquals(3, widget.getChildren().size()); widget.getChildren().remove(0); assertEquals(2, widget.getChildren().size()); widget.clear(); assertEquals(0, widget.getChildren().size()); } }
Example 2
Source Project: gwt-material Source File: ScrollHelperTest.java License: Apache License 2.0 | 6 votes |
protected void checkProperties(MaterialPanel target, MaterialPanel container) { final boolean[] firedCallback = {false}; final String LINEAR_EASING = "linear"; Functions.Func CALLBACK = () -> { firedCallback[0] = true; }; ScrollHelper scrollHelper = new ScrollHelper(); scrollHelper.setEasing(LINEAR_EASING); scrollHelper.setCompleteCallback(CALLBACK); scrollHelper.setContainer(container); scrollHelper.scrollTo(target); checkOffsetPositioning(scrollHelper); assertEquals(LINEAR_EASING, scrollHelper.getEasing()); assertEquals(CALLBACK, scrollHelper.getCompleteCallback()); assertEquals(container.getElement(), scrollHelper.getContainerElement().asElement()); }
Example 3
Source Project: gwt-material Source File: AnimationTest.java License: Apache License 2.0 | 6 votes |
public void testAnimation() { MaterialPanel panel = new MaterialPanel(); RootPanel.get().add(panel); MaterialAnimation animation = new MaterialAnimation(); animation.delay(0); assertEquals(animation.getDelay(), 0); animation.infinite(true); assertTrue(animation.isInfinite()); animation.infinite(false); assertFalse(animation.isInfinite()); animation.duration(20); assertEquals(animation.getDuration(), 20); animation.transition(Transition.FADEIN); assertEquals(animation.getTransition(), Transition.FADEIN); animation.animate(panel); assertEquals(animation.getWidget(), panel); // Check Advance Logic String WEBKIT_ANIMATION_DURATION = panel.getElement().getStyle().getProperty("WebkitAnimationDuration"); assertEquals(WEBKIT_ANIMATION_DURATION, animation.getDuration() + "ms"); }
Example 4
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 6 votes |
public void testRestriction() { // UiBinder // given MaterialPanel panel = getWidget(false); MaterialIcon iconIgnore = new MaterialIcon(); MaterialLabel labelIgnore = new MaterialLabel(); panel.add(iconIgnore); panel.add(labelIgnore); // when / then checkRestriction(panel, iconIgnore.getElement(), labelIgnore.getElement()); // Standard // given attachWidget(); // when / then checkRestriction(panel, iconIgnore.getElement(), labelIgnore.getElement()); }
Example 5
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 6 votes |
protected void checkRestriction(MaterialPanel panel, Element... ignoredWidgets) { // when Restriction restriction = new Restriction(); restriction.setBottom(20); restriction.setLeft(20); restriction.setRight(20); restriction.setTop(20); restriction.setEndOnly(true); restriction.setRestriction(Restriction.Restrict.PARENT); MaterialDnd dnd = MaterialDnd.draggable(panel, JsDragOptions.create(restriction)); dnd.ignoreFrom(ignoredWidgets); JsDragOptions options = dnd.getDragOptions(); // then assertEquals(panel, dnd.getTarget()); assertEquals(Double.valueOf(20), options.restrict.elementRect.top); assertEquals(Double.valueOf(20), options.restrict.elementRect.left); assertEquals(Double.valueOf(20), options.restrict.elementRect.right); assertEquals(Double.valueOf(20), options.restrict.elementRect.bottom); assertEquals(Restriction.Restrict.PARENT, options.restrict.restriction); assertTrue(options.restrict.endOnly); assertEquals(2, dnd.getIgnoreFrom().length); for (Element element : dnd.getIgnoreFrom()) { assertTrue(element.hasClassName(AddinsCssName.INTERACT_IGNORED_CONTENT)); } }
Example 6
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 6 votes |
protected void checkDropEvents(MaterialPanel panel) { MaterialDnd.draggable(panel); // Drop Activate Event final boolean[] isDropActivateFired = {false}; panel.addDropActivateHandler(event -> isDropActivateFired[0] = true); panel.fireEvent(new DropActivateEvent() { }); assertTrue(isDropActivateFired[0]); // Drop Deactivate Event final boolean[] isDropDeactivateFired = {false}; panel.addDropDeactivateHandler(event -> isDropDeactivateFired[0] = true); panel.fireEvent(new DropDeactivateEvent() { }); assertTrue(isDropDeactivateFired[0]); // Drop Event final boolean[] isDropFired = {false}; panel.addDropHandler(event -> isDropFired[0] = true); panel.fireEvent(new DropEvent($(panel.getElement())) { }); assertTrue(isDropFired[0]); }
Example 7
Source Project: gwt-material-addins Source File: MaterialWindowTest.java License: Apache License 2.0 | 6 votes |
public void testDndArea() { // UiBinder // given MaterialWindow window = getWidget(false); MaterialPanel dndArea = new MaterialPanel(); window.setDndArea(dndArea); attachWidget(); window.open(); assertTrue(window.getDnd().getDragOptions().restrict.restriction instanceof Element); Element element = (Element) window.getDnd().getDragOptions().restrict.restriction; assertEquals(dndArea.getElement().getInnerHTML(), element.getInnerHTML()); assertEquals(dndArea.getElement(), element); }
Example 8
Source Project: gwt-material-addins Source File: MaterialSubheaderTest.java License: Apache License 2.0 | 6 votes |
public void testContainer() { // UiBinder // given MaterialSubHeaderContainer container = getWidget(true); // when / then assertEquals(5, container.getWidgetCount()); container.clear(); assertEquals(0, container.getWidgetCount()); MaterialPanel notSubHeader = new MaterialPanel(); container.add(notSubHeader); assertEquals(notSubHeader, container.getWidget(0)); assertFalse(notSubHeader.getElement().hasClassName(AddinsCssName.SUBHEADER)); }
Example 9
Source Project: gwt-material-addins Source File: MaterialSplitPanelTest.java License: Apache License 2.0 | 6 votes |
public void testStructure() { // UiBinder // given MaterialSplitPanel splitPanel = getWidget(false); MaterialPanel leftPanel = new MaterialPanel(); MaterialPanel rightPanel = new MaterialPanel(); splitPanel.add(leftPanel); splitPanel.add(rightPanel); // when / then checkStructure(splitPanel, leftPanel, rightPanel); // Standard // given attachWidget(); // when / then checkStructure(splitPanel, leftPanel, rightPanel); }
Example 10
Source Project: gwt-material-addins Source File: MaterialCarouselTest.java License: Apache License 2.0 | 6 votes |
public void testStructure() { // given MaterialCarousel carousel = getWidget(); // when / then assertEquals(carousel.getBtnNextArrow(), carousel.getWidget(0)); assertTrue(carousel.getWidget(0).getElement().hasClassName(AddinsCssName.CAROUSEL_NEXT_ARROW)); assertEquals(carousel.getBtnPrevArrow(), carousel.getWidget(1)); assertTrue(carousel.getWidget(1).getElement().hasClassName(AddinsCssName.CAROUSEL_PREV_ARROW)); assertEquals(carousel.getWrapper(), carousel.getWidget(2)); assertTrue(carousel.getWidget(2).getElement().hasClassName(AddinsCssName.MATERIAL_CAROUSEL_CONTAINER)); for (int i = 1; i <= 5; i++) { MaterialPanel panel = new MaterialPanel(); carousel.add(panel); } assertEquals(5, carousel.getContainer().getChildren().size()); }
Example 11
Source Project: lumongo Source File: QueryView.java License: Apache License 2.0 | 6 votes |
public QueryView() { splitPanel = new MaterialSplitPanel(); splitPanel.setHeight(Window.getClientHeight() - 102 + "px"); splitPanel.setBarPosition(25); leftPanel = new MaterialPanel(); leftPanel.setBackgroundColor(Color.WHITE); leftPanel.setGrid("s6 l3"); leftScrollPanel = new ScrollPanel(); leftScrollPanel.setHeight(Window.getClientHeight() - 130 + "px"); rightPanel = new MaterialPanel(); rightPanel.setBackgroundColor(Color.GREY_LIGHTEN_2); rightPanel.setGrid("s6 l9"); rightScrollPanel = new ScrollPanel(); rightScrollPanel.setHeight(Window.getClientHeight() - 130 + "px"); splitPanel.add(leftPanel); splitPanel.add(rightPanel); add(splitPanel); }
Example 12
Source Project: gwt-material Source File: ScrollHelperTest.java License: Apache License 2.0 | 5 votes |
@Override protected MaterialPanel createWidget() { MaterialPanel container = new MaterialPanel(); MaterialPanel target = new MaterialPanel(); container.add(target); return container; }
Example 13
Source Project: gwt-material Source File: ScrollHelperTest.java License: Apache License 2.0 | 5 votes |
public void testProperties() { // UiBinder // Given MaterialPanel container = getWidget(false); MaterialPanel target = (MaterialPanel) container.getWidget(0); checkProperties(target, container); // Standard // Given attachWidget(); checkProperties(target, container); }
Example 14
Source Project: gwt-material Source File: ScrollHelperTest.java License: Apache License 2.0 | 5 votes |
public void testScrollOnTarget() { // UiBinder // Given MaterialPanel container = getWidget(); MaterialPanel target = (MaterialPanel) container.getWidget(0); target.setMarginTop(2000); target.setPaddingTop(0); double targetOffset = $(target.getElement()).offset().top; ScrollHelper scrollHelper = new ScrollHelper(); scrollHelper.setCompleteCallback(() -> assertEquals(2000.0, targetOffset)); scrollHelper.scrollTo(target); }
Example 15
Source Project: gwt-material Source File: ScrollHelperTest.java License: Apache License 2.0 | 5 votes |
public void testDefaultContainer() { MaterialPanel target = new MaterialPanel(); ScrollHelper scrollHelper = new ScrollHelper(); scrollHelper.scrollTo(target); assertEquals($("html, body").asElement(), scrollHelper.getContainerElement().asElement()); }
Example 16
Source Project: gwt-material-addins Source File: ContinuousRangeSlider.java License: Apache License 2.0 | 5 votes |
protected void updateClassName(boolean remove) { String styleName = AddinsCssName.CONTINUOUS_SLIDER; MaterialPanel rangeContainer = getRangeContainer(); if (rangeContainer != null && rangeContainer.isAttached()) { if (remove) { if (rangeContainer.getElement().hasClassName(styleName)) { rangeContainer.removeStyleName(styleName); } } else { if (!rangeContainer.getElement().hasClassName(styleName)) { rangeContainer.addStyleName(styleName); } } } }
Example 17
Source Project: gwt-material-addins Source File: TimerProgressTest.java License: Apache License 2.0 | 5 votes |
public void testStructure() { TimerProgress timerProgress = getWidget(); assertTrue(timerProgress.getElement().hasClassName(IncubatorCssName.TIMER_PROGRESS)); assertTrue(timerProgress.getElement().hasClassName(IncubatorCssName.BOUNCING)); assertEquals(timerProgress.getWidgetCount(), 1); assertTrue(timerProgress.getWidget(0) instanceof MaterialPanel); MaterialPanel fillPanel = (MaterialPanel) timerProgress.getWidget(0); assertTrue(fillPanel.getElement().hasClassName(IncubatorCssName.FILL)); assertEquals(fillPanel, timerProgress.getFill()); }
Example 18
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 5 votes |
public void testDropzone() { // UiBinder // given MaterialPanel panel = getWidget(false); // when / then checkDropzone(panel); // Standard // given attachWidget(); // when / then checkDropzone(panel); }
Example 19
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 5 votes |
protected void checkDropzone(MaterialPanel panel) { final String ACCEPT = "accept"; final double OVERLAP = 20; MaterialDnd dnd = MaterialDnd.dropzone(panel, JsDropOptions.create(ACCEPT, OVERLAP)); JsDropOptions options = dnd.getDropOptions(); assertEquals(ACCEPT, options.accept); assertEquals(OVERLAP, options.overlap); }
Example 20
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 5 votes |
public void testAxis() { // UiBinder // given MaterialPanel panel = getWidget(false); // when / then checkAxis(panel); }
Example 21
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 5 votes |
protected void checkAxis(MaterialPanel panel) { final String VERTICAL_AXIS = "y"; final String HORIZONTAL_AXIS = "x"; MaterialDnd dnd = MaterialDnd.draggable(panel, JsDragOptions.create(Axis.VERTICAL)); assertEquals(VERTICAL_AXIS, dnd.getDragOptions().axis); dnd.getDragOptions().axis = HORIZONTAL_AXIS; assertEquals(HORIZONTAL_AXIS, dnd.getDragOptions().axis); }
Example 22
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 5 votes |
public void testInertia() { // UiBinder // given MaterialPanel panel = getWidget(false); // when / then checkInertia(panel); // Standard // given attachWidget(); // when / then checkInertia(panel); }
Example 23
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 5 votes |
public void testDropEvents() { // UiBinder // given MaterialPanel panel = getWidget(false); // when / then checkDropEvents(panel); // Standard // given attachWidget(); // when / then checkDropEvents(panel); }
Example 24
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 5 votes |
public void testDragEvents() { // UiBinder // given MaterialPanel panel = getWidget(false); // when / then checkDragEvents(panel); // Standard // given attachWidget(); // when / then checkDragEvents(panel); }
Example 25
Source Project: gwt-material-addins Source File: MaterialDndTest.java License: Apache License 2.0 | 5 votes |
protected void checkDragEvents(MaterialPanel panel) { MaterialDnd.draggable(panel); // Drag Start Event final boolean[] isDragStartFired = {false}; panel.addDragStartHandler(event -> isDragStartFired[0] = true); panel.fireEvent(new DragStartEvent() { }); assertTrue(isDragStartFired[0]); // Drag Enter Event final boolean[] isDragEnterFired = {false}; panel.addDragEnterHandler(event -> isDragEnterFired[0] = true); panel.fireEvent(new DragEnterEvent($(panel.getElement())) { }); assertTrue(isDragEnterFired[0]); // Drag Move Event final boolean[] isDragMoveFired = {false}; panel.addDragMoveHandler(event -> isDragMoveFired[0] = true); panel.fireEvent(new DragMoveEvent() { }); assertTrue(isDragMoveFired[0]); // Drag End Event final boolean[] isDragEndFired = {false}; panel.addDragEndHandler(event -> isDragEndFired[0] = true); panel.fireEvent(new DragEndEvent() { }); assertTrue(isDragEndFired[0]); // Drag Over Event final boolean[] isDragOverFired = {false}; panel.addDragOverHandler(event -> isDragOverFired[0] = true); panel.fireEvent(new DragOverEvent() { }); assertTrue(isDragOverFired[0]); }
Example 26
Source Project: gwt-material-addins Source File: MaterialPathAnimatorTest.java License: Apache License 2.0 | 5 votes |
@Override protected MaterialPanel createWidget() { source = new MaterialPanel(); target = new MaterialPanel(); RootPanel.get().add(target); return source; }
Example 27
Source Project: gwt-material-addins Source File: MaterialPathAnimatorTest.java License: Apache License 2.0 | 5 votes |
public void testProperties() { // given final int DURATION = 300; final int TARGET_DURATION = 500; final int EXTRA_DURATION = 800; final Functions.Func animateCallback = () -> {}; final Functions.Func reverseCallback = () -> {}; MaterialPathAnimator animator = new MaterialPathAnimator(); // when / then animator.setDuration(DURATION); assertEquals(DURATION, animator.getDuration()); animator.setTargetShowDuration(TARGET_DURATION); assertEquals(TARGET_DURATION, animator.getTargetShowDuration()); animator.setAnimateCallback(animateCallback); assertEquals(animateCallback, animator.getAnimateCallback()); animator.setReverseCallback(reverseCallback); assertEquals(reverseCallback, animator.getReverseCallback()); animator.setExtraTransitionDuration(EXTRA_DURATION); assertEquals(EXTRA_DURATION, animator.getExtraTransitionDuration()); MaterialPanel source = getWidget(); animator.setSourceElement(source.getElement()); assertEquals(source.getElement(), animator.getSourceElement()); assertNotNull(target); animator.setTargetElement(target.getElement()); assertEquals(target.getElement(), animator.getTargetElement()); }
Example 28
Source Project: gwt-material-addins Source File: MaterialPathAnimatorTest.java License: Apache License 2.0 | 5 votes |
public void testStaticInstance() { // given MaterialPanel source = new MaterialPanel(); MaterialPanel target = new MaterialPanel(); RootPanel.get().add(source); RootPanel.get().add(target); // when / then target.setVisibility(Style.Visibility.HIDDEN); target.setOpacity(0); assertEquals("hidden", target.getElement().getStyle().getVisibility()); assertEquals("0", target.getElement().getStyle().getOpacity()); MaterialPathAnimator.animate(source, target); MaterialPathAnimator.reverseAnimate(source, target); }
Example 29
Source Project: gwt-material-addins Source File: MaterialWindowTest.java License: Apache License 2.0 | 5 votes |
public void testStructure() { // UiBinder // given MaterialWindow window = getWidget(false); // when / then assertNotNull(window); // Check Window Toolbar Structure assertTrue(window.getWidget(0) instanceof MaterialWidget); MaterialWidget toolbar = (MaterialWidget) window.getWidget(0); assertEquals(toolbar, window.getToolbar()); assertTrue(toolbar.getElement().hasClassName(AddinsCssName.WINDOW_TOOLBAR)); assertEquals(toolbar.getWidget(0), window.getLabelTitle()); assertTrue(toolbar.getWidget(0).getElement().hasClassName(AddinsCssName.WINDOW_TITLE)); window.setTitle("Title"); assertEquals("Title", window.getLabelTitle().getText()); assertEquals(toolbar.getWidget(1), window.getIconClose()); assertTrue(toolbar.getWidget(1).getElement().hasClassName(AddinsCssName.WINDOW_ACTION)); assertEquals(toolbar.getWidget(2), window.getIconMaximize()); assertTrue(toolbar.getWidget(2).getElement().hasClassName(AddinsCssName.WINDOW_ACTION)); // Check Window Content structure assertNotNull(window.getWidget(1)); assertTrue(window.getWidget(1) instanceof MaterialWidget); MaterialWidget content = (MaterialWidget) window.getWidget(1); assertEquals(window.getContent(), content); MaterialPanel panel = new MaterialPanel(); window.add(panel); assertEquals(content.getWidget(0), panel); }
Example 30
Source Project: gwt-material-addins Source File: MaterialScrollfireTest.java License: Apache License 2.0 | 5 votes |
public void testScrollfire() { // UiBinder // given MaterialPanel panel = getWidget(false); // when / then checkScrollfire(panel); // Standard // given attachWidget(); // when / then checkScrollfire(panel); }