gwt.material.design.jquery.client.api.JQueryElement Java Examples
The following examples show how to use
gwt.material.design.jquery.client.api.JQueryElement.
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: ScrollHelper.java From gwt-material with Apache License 2.0 | 6 votes |
/** * Will scroll to target offset. */ public void scrollTo(double offset) { this.offset = offset; ScrollOption option = new ScrollOption(); JQueryElement target = getContainerElement(); if (containerElement != getDefaultContainer()) { offset = target.scrollTop() - target.offset().top + offset; } else { target = $("html, body"); } option.scrollTop = offset - addedScrollOffset; target.animate(option, duration, easing, () -> { if (completeCallback != null) { completeCallback.call(); } }); }
Example #2
Source File: MaterialComboBox.java From gwt-material-addins with Apache License 2.0 | 5 votes |
/** * Will get the Selection Results ul element containing all the combobox items. */ public JQueryElement getDropdownResultElement() { String dropdownId = getDropdownContainerElement().attr("id").toString(); if (dropdownId != null && !(dropdownId.isEmpty())) { dropdownId = dropdownId.replace("container", "results"); return $("#" + dropdownId); } else { GWT.log("The element dropdown-result ul element is undefined.", new NullPointerException()); } return null; }
Example #3
Source File: MaterialListValueBox.java From gwt-material with Apache License 2.0 | 5 votes |
@Override public void load() { JQueryElement listBoxElement = $(listBox.getElement()); JsMaterialElement.$(listBox.getElement()).material_select(() -> $("input.select-dropdown").trigger("close", true)); listBoxElement.change((e, param) -> { try { ValueChangeEvent.fire(this, getValue()); } catch (IndexOutOfBoundsException ex) { GWT.log("ListBox value change handler threw an exception.", ex); } return true; }); JQueryElement selectDropdown = listBoxElement.siblings("input.select-dropdown"); selectDropdown.mousedown((event, o) -> { $("input[data-activates!='" + listBoxElement.attr("data-activates") + "'].select-dropdown").trigger("close", true); return true; }); selectDropdown.blur((e, param1) -> { DomEvent.fireNativeEvent(Document.get().createBlurEvent(), this); return true; }); selectDropdown.focus((e, param1) -> { DomEvent.fireNativeEvent(Document.get().createFocusEvent(), this); if (isAsynchronous() && !isLoaded()) { load(getAsyncCallback()); } return true; }); if (isAllowBlank()) { addBlankItemIfNeeded(); } }
Example #4
Source File: MaterialComboBox.java From gwt-material-addins with Apache License 2.0 | 5 votes |
/** * Will get the Selection dropdown container rendered */ public JQueryElement getDropdownContainerElement() { JQueryElement element = $(getElement()).find(".select2 .selection .select2-selection__rendered"); if (element == null) { GWT.log("The element dropdown-container element is undefined.", new NullPointerException()); } return element; }
Example #5
Source File: ContinuousRangeSlider.java From gwt-material-addins with Apache License 2.0 | 5 votes |
protected void updateDom(Integer value) { JQueryElement sliderFill = $(getElement()).find(".slider-fill"); JQueryElement sliderHandler = $(getElement()).find(".slider-handle"); double percent = (value * 1.0 / getMax()) * 100; if (sliderFill != null && sliderHandler != null) { sliderFill.css("width", percent + "%"); sliderHandler.css("left", percent + "%"); } }
Example #6
Source File: OverlayStyleMixin.java From gwt-material with Apache License 2.0 | 5 votes |
/** * Will apply the blur into the provided list of {@link JQueryElement}. * If reset was true then we set the filter property to empty value. */ protected void applyBlur(Blur blur, boolean reset) { if (blur != null && blur.getTargets() != null) { for (JQueryElement target : blur.getTargets()) { String blurValue = "blur(" + blur.getValue() + "px)"; if (reset) { blurValue = ""; } target.css("filter", blurValue != null ? blurValue : ""); } } }
Example #7
Source File: OverlayStyleMixin.java From gwt-material with Apache License 2.0 | 5 votes |
@Override public void applyOverlayStyle(JQueryElement overlayElement) { this.overlayElement = overlayElement; applyBackgroundColor(overlayOption.getBackgroundColor()); applyBlur(overlayOption.getBlur(), false); applyOpacity(overlayOption.getOpacity()); applyVisibility(overlayOption.getVisibility()); }
Example #8
Source File: DropEventDispatcher.java From gwt-material-addins with Apache License 2.0 | 5 votes |
public void fireDropEvent(JQueryElement relatedTarget) { target.fireEvent(new GwtEvent<DropEvent.DropHandler>() { @Override public Type<DropEvent.DropHandler> getAssociatedType() { return DropEvent.TYPE; } @Override protected void dispatch(DropEvent.DropHandler handler) { handler.onDrop(new DropEvent(relatedTarget)); } }); }
Example #9
Source File: TooltipMixin.java From gwt-material with Apache License 2.0 | 5 votes |
public void addTooltipClass(String... classes) { JQueryElement tooltipElement = this.tooltip.getTooltipElement(); if (tooltipElement != null) { for (String tooltipClass : classes) { tooltipElement.addClass(tooltipClass); } } }
Example #10
Source File: DragEventDispatcher.java From gwt-material-addins with Apache License 2.0 | 5 votes |
public void fireDragLeaveEvent(JQueryElement relatedTarget) { target.fireEvent(new GwtEvent<DragLeaveEvent.DragLeaveHandler>() { @Override public Type<DragLeaveEvent.DragLeaveHandler> getAssociatedType() { return DragLeaveEvent.TYPE; } @Override protected void dispatch(DragLeaveEvent.DragLeaveHandler handler) { handler.onDragLeave(new DragLeaveEvent(relatedTarget)); } }); }
Example #11
Source File: MaterialSplitPanel.java From gwt-material-addins with Apache License 2.0 | 5 votes |
protected void applySplitterLineColor(Color splitterLineColor) { if (splitterLineColor != null) { JQueryElement splitterBar = $(getElement()).find(".splitter-bar"); if (splitterBar != null) { MaterialWidget widget = new MaterialWidget(splitterBar); widget.setBackgroundColor(splitterLineColor); } } }
Example #12
Source File: ScrollHelper.java From gwt-material with Apache License 2.0 | 5 votes |
public boolean isInViewPort(Element element, double addedHeight) { double elementTop = getElementTop(element) + addedHeight; double elementBottom = elementTop + $(element).outerHeight() + addedHeight; JQueryElement target = getContainerElement(); double viewportTop = target.scrollTop(); if (target.asElement() != getDefaultContainer()) { viewportTop = getElementTop(target.asElement()); } double viewportBottom = viewportTop + target.height(); return elementBottom > viewportTop && elementTop < viewportBottom; }
Example #13
Source File: MaterialWidget.java From gwt-material with Apache License 2.0 | 5 votes |
public MaterialWidget(JQueryElement jQueryElement) { this(); setElement(jQueryElement.asElement()); // We are already attached to the DOM. // This will happen in instances where // we are taking an element from JQuery. onAttach(); }
Example #14
Source File: DragEnterEvent.java From gwt-material with Apache License 2.0 | 4 votes |
public JQueryElement getRelatedTarget() { return relatedTarget; }
Example #15
Source File: JsCarousel.java From gwt-material-addins with Apache License 2.0 | 4 votes |
@JsMethod public native JQueryElement slick();
Example #16
Source File: JsRichEditor.java From gwt-material-addins with Apache License 2.0 | 4 votes |
@JsMethod public native JQueryElement destroy();
Example #17
Source File: JsInputMask.java From gwt-material-addins with Apache License 2.0 | 4 votes |
@JsMethod public native JQueryElement unmask();
Example #18
Source File: DndView.java From gwt-material-demo with Apache License 2.0 | 4 votes |
@Inject DndView(Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); MaterialDnd.draggable(panel); MaterialDnd.draggable(woInertialPanel, JsDragOptions.create(false)); Restriction restriction = new Restriction(); restriction.setEndOnly(false); MaterialDnd.draggable(endOnlyPanel, JsDragOptions.create(restriction)); Restriction restriction1 = new Restriction(); restriction1.setRestriction(Restriction.Restrict.SELF); MaterialDnd.draggable(selfRestrict, JsDragOptions.create(restriction1)); Restriction restriction2 = new Restriction(); restriction2.setTop(0.25); restriction2.setLeft(0.25); restriction2.setRight(0.75); restriction2.setBottom(0.75); MaterialDnd.draggable(restrictPanel, JsDragOptions.create(restriction2)); MaterialDnd dndIgnore = MaterialDnd.draggable(dndIgnoreFrom); dndIgnore.ignoreFrom(ignoredPanel); MaterialDnd.draggable(xAxisPanel, JsDragOptions.create(Axis.HORIZONTAL)); MaterialDnd.draggable(yAxisPanel, JsDragOptions.create(Axis.VERTICAL)); MaterialDnd.draggable(item1); MaterialDnd.draggable(item2); MaterialDnd.draggable(item3); MaterialDnd.draggable(item4); MaterialDnd.dropzone(dropzoneContainer, JsDropOptions.create(".test")); dropzoneContainer.addDropActivateHandler(event1 -> { MaterialToast.fireToast("Drop Activate"); }); dropzoneContainer.addDragEnterHandler(dragEnterEvent -> { placeContainer.setBackgroundColor(Color.BLUE); MaterialToast.fireToast("Drag Enter"); }); dropzoneContainer.addDragLeaveHandler(event1 -> { placeContainer.setBackgroundColor(Color.GREY_LIGHTEN_2); MaterialToast.fireToast("Drag Leave"); }); dropzoneContainer.addDropHandler(event -> { JQueryElement target = $(event.getRelatedTarget()); MaterialWidget widget = new MaterialWidget(target.asElement()); placeContainer.add(widget); MaterialToast.fireToast("Dropped"); }); dropzoneContainer.addDropDeactivateHandler(event -> { MaterialToast.fireToast("Drop Deactivate"); }); MaterialDnd.draggable(eventPanel); // Add Drag Start Handler eventPanel.addDragStartHandler(event -> { eventPanel.setBackgroundColor(Color.BLUE); lblStarted.setVisible(true); }); // Add Drag Move Handler eventPanel.addDragMoveHandler(event -> { eventPanel.setBackgroundColor(Color.AMBER); lblMoved.setVisible(true); }); // Add Drag End Handler eventPanel.addDragEndHandler(event -> { eventPanel.setBackgroundColor(Color.GREEN); lblEnded.setVisible(true); }); }
Example #19
Source File: Blur.java From gwt-material with Apache License 2.0 | 4 votes |
/** * Will set the target elements to be blurred */ public void setTargets(JQueryElement... targets) { this.targets = targets; }
Example #20
Source File: MaterialComboBox.java From gwt-material-addins with Apache License 2.0 | 4 votes |
public JQueryElement getArrowIconElement() { return $(getElement()).find(".select2-selection__arrow"); }
Example #21
Source File: Blur.java From gwt-material with Apache License 2.0 | 4 votes |
/** * Will get the target elements that had been blurred */ public JQueryElement[] getTargets() { return targets; }
Example #22
Source File: JsTimePicker.java From gwt-material-addins with Apache License 2.0 | 4 votes |
@JsMethod public native JQueryElement lolliclock(String action, Object... vars);
Example #23
Source File: JsContinuousRange.java From gwt-material-addins with Apache License 2.0 | 4 votes |
@JsMethod public native JQueryElement rkmd_rangeSlider();
Example #24
Source File: DragEnterEvent.java From gwt-material with Apache License 2.0 | 4 votes |
public static void fire(HasHandlers source, JQueryElement relatedTarget) { source.fireEvent(new DragEnterEvent(relatedTarget)); }
Example #25
Source File: JsCircularProgress.java From gwt-material-addins with Apache License 2.0 | 4 votes |
@JsMethod public native JQueryElement circleProgress(Object param1, Object param2);
Example #26
Source File: DragEnterEvent.java From gwt-material with Apache License 2.0 | 4 votes |
public DragEnterEvent(JQueryElement relatedTarget) { this.relatedTarget = relatedTarget; }
Example #27
Source File: DragLeaveEvent.java From gwt-material with Apache License 2.0 | 4 votes |
public JQueryElement getRelatedTarget() { return relatedTarget; }
Example #28
Source File: JsComboBox.java From gwt-material-addins with Apache License 2.0 | 4 votes |
@JsMethod(name = "$", namespace = JsPackage.GLOBAL) public static native JsComboBox $(JQueryElement element);
Example #29
Source File: JsTimePicker.java From gwt-material-addins with Apache License 2.0 | 4 votes |
@JsMethod(name = "$", namespace = JsPackage.GLOBAL) public static native JsTimePicker $(JQueryElement element);
Example #30
Source File: DropEvent.java From gwt-material with Apache License 2.0 | 4 votes |
public static void fire(HasHandlers source, JQueryElement relatedTarget) { source.fireEvent(new DropEvent(relatedTarget)); }