Java Code Examples for com.google.gwt.user.client.DOM#sinkEvents()

The following examples show how to use com.google.gwt.user.client.DOM#sinkEvents() . 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: AnnotationSpreadRenderer.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
private void updateEventHandler(final ContentElement element, String eventHandlerId) {
  Element implNodelet = element.getImplNodelet();
  final EventHandler handler =
      eventHandlerId == null ? null : AnnotationPaint.eventHandlerRegistry.get(eventHandlerId);
  if (handler != null) {
    DOM.sinkEvents(DomHelper.castToOld(implNodelet), MOUSE_LISTENER_EVENTS);
    DOM.setEventListener(DomHelper.castToOld(implNodelet), new EventListener() {
      @Override
      public void onBrowserEvent(Event event) {
        handler.onEvent(element, event);
      }
    });
  } else {
    removeListener(DomHelper.castToOld(implNodelet));
  }
}
 
Example 2
Source File: CubaResizableTextAreaWrapperWidget.java    From cuba with Apache License 2.0 6 votes vote down vote up
public void setResizableDirection(ResizeDirection resizableDirection) {
    this.resizableDirection = resizableDirection;
    if (resizableDirection == ResizeDirection.NONE) {
        if (isResizable()) {
            DOM.sinkEvents(resizeElement, 0);
            DOM.setEventListener(resizeElement, null);
            resizeElement.removeFromParent();
            resizeElement = null;
        }
    } else {
        if (!isResizable()) {
            resizeElement = DOM.createDiv();
            resizeElement.setClassName(RESIZE_ELEMENT);
            getElement().appendChild(resizeElement);
            DOM.sinkEvents(resizeElement, MOUSE_EVENTS);
            DOM.setEventListener(resizeElement, new ResizeEventListener());
        }
    }
}
 
Example 3
Source File: TopicScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * TopicScrollTable
 */
public TopicScrollTable(FixedWidthGrid dataTable, FixedWidthFlexTable headerTable, ScrollTableImages scrollTableImages,
                        ForumController controller) {
	super(dataTable, headerTable, scrollTableImages);
	this.dataTable = dataTable;
	this.controller = controller;

	setResizePolicy(ResizePolicy.UNCONSTRAINED);
	setScrollPolicy(ScrollPolicy.BOTH);
	dataTable.setSelectionEnabled(false); // Disables selection

	dataTable.setColumnSorter(new ExtendedColumnSorter());

	// Sets some events
	DOM.sinkEvents(getDataWrapper(), Event.ONDBLCLICK | Event.ONMOUSEDOWN);
}
 
Example 4
Source File: ForumScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ForumScrollTable
 */
public ForumScrollTable(FixedWidthGrid dataTable, FixedWidthFlexTable headerTable,
                        ScrollTableImages scrollTableImages, ForumController controller) {
	super(dataTable, headerTable, scrollTableImages);
	this.dataTable = dataTable;
	this.controller = controller;

	setResizePolicy(ResizePolicy.UNCONSTRAINED);
	setScrollPolicy(ScrollPolicy.BOTH);
	dataTable.setSelectionEnabled(false); // Disables selection

	dataTable.setColumnSorter(new ExtendedColumnSorter());

	// Sets some events
	DOM.sinkEvents(getDataWrapper(), Event.ONDBLCLICK | Event.ONMOUSEDOWN);
}
 
Example 5
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param dataTable
 * @param headerTable
 * @param scrollTableImages
 */
public ExtendedScrollTable(FixedWidthGrid dataTable, FixedWidthFlexTable headerTable,
                           ScrollTableImages scrollTableImages) {
	super(dataTable, headerTable, scrollTableImages);
	formManager = new FormManager(null); // Used to draw extended columns

	this.dataTable = dataTable;
	this.headerTable = headerTable;

	// Table data SortableFixedWidthGrid.HOVERING_POLICY_CELL
	dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.ONE_ROW);
	setResizePolicy(ResizePolicy.FILL_WIDTH);
	setScrollPolicy(ScrollPolicy.BOTH);

	columnSorter = new ExtendedColumnSorter();
	dataTable.setColumnSorter(columnSorter);

	// Sets some events
	DOM.sinkEvents(getDataWrapper(), Event.ONCLICK | Event.ONDBLCLICK | Event.ONMOUSEDOWN | Event.ONMOUSEUP
			| Event.ONMOUSEMOVE | Event.ONMOUSEUP);
}
 
Example 6
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ExtendedScrollTable
 */
public ExtendedScrollTable(FixedWidthGrid dataTable, FixedWidthFlexTable headerTable, ScrollTableImages scrollTableImages) {
	super(dataTable, headerTable, scrollTableImages);
	this.dataTable = dataTable;
	this.headerTable = headerTable;

	formManager = new FormManager(null); // Used to draw extended columns

	dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.ONE_ROW);
	setResizePolicy(ResizePolicy.FILL_WIDTH);
	setScrollPolicy(ScrollPolicy.BOTH);

	columnSorter = new ExtendedColumnSorter();
	dataTable.setColumnSorter(columnSorter);

	// Sets some events
	DOM.sinkEvents(getDataWrapper(), Event.ONDBLCLICK | Event.ONMOUSEDOWN);
}
 
Example 7
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Should the next page button be visible to the user?
 *
 * @param active
 */
private void setNextButtonActive(boolean active) {
	debug("VComboBoxMultiselect.SP: setNextButtonActive(" + active + ")");

	if (active) {
		DOM.sinkEvents(this.down, Event.ONCLICK);
		this.down.setClassName(VComboBoxMultiselect.this.getStylePrimaryName() + "-nextpage");
	} else {
		DOM.sinkEvents(this.down, 0);
		this.down.setClassName(VComboBoxMultiselect.this.getStylePrimaryName() + "-nextpage-off");
	}
}
 
Example 8
Source File: CubaTextFieldWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
public CubaTextFieldWidget() {
    // handle shortcuts
    DOM.sinkEvents(getElement(), Event.ONKEYDOWN);

    addInputHandler(getElement());

    disableAutocompletion();
}
 
Example 9
Source File: TableAggregationRow.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void addCellWithField(String text, char align, int colIndex) {
    final TableCellElement td = DOM.createTD().cast();
    final DivElement container = DOM.createDiv().cast();
    container.setClassName(tableWidget.getStylePrimaryName() + "-cell-wrapper" + " " + "widget-container");

    setAlign(align, container);

    InputElement inputElement = DOM.createInputText().cast();
    inputElement.setValue(text);
    inputElement.addClassName("v-textfield v-widget");
    inputElement.addClassName("c-total-aggregation-textfield");
    Style elemStyle = inputElement.getStyle();
    elemStyle.setWidth(100, Style.Unit.PCT);

    container.appendChild(inputElement);

    if (inputsList == null) {
        inputsList = new ArrayList<>();
    }
    inputsList.add(new AggregationInputFieldInfo(text, tableWidget.getColKeyByIndex(colIndex), inputElement));

    DOM.sinkEvents(inputElement, Event.ONCHANGE | Event.ONKEYDOWN);

    td.setClassName(tableWidget.getStylePrimaryName() + "-cell-content");
    td.addClassName(tableWidget.getStylePrimaryName() + "-aggregation-cell");
    td.appendChild(container);
    tr.appendChild(td);
}
 
Example 10
Source File: CubaTokenListLabelWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
public CubaTokenListLabelWidget() {
    add(label);
    label.setStyleName("content");
    label.addClickHandler(event -> {
        if (canOpen) {
            handler.click();
        }
    });

    closeDiv.setClassName(CLOSE_STYLENAME);
    getElement().appendChild(closeDiv);
    DOM.sinkEvents(closeDiv, Event.ONCLICK);
}
 
Example 11
Source File: CubaGroupBoxWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void init() {
    if (!isShowAsPanel()) {
        captionNode.setClassName(getStylePrimaryName() + "-caption");
        contentNode.setClassName(getStylePrimaryName() + "-content");
        bottomDecoration.setClassName(getStylePrimaryName() + "-deco");
        expander.setClassName(getStylePrimaryName() + "-expander");

        contentNode.getStyle().clearPosition();

        setExpanded(true);

        captionStartDeco.appendChild(DOM.createDiv());
        captionStartDeco.setClassName(getStylePrimaryName() + "-caption-start-deco");
        captionWrap.insertFirst(captionStartDeco);

        captionEndDeco.appendChild(DOM.createDiv());
        captionEndDeco.setClassName(getStylePrimaryName() + "-caption-end-deco");
        captionWrap.appendChild(captionEndDeco);

        captionNode.insertFirst(expander);

        captionTextNode.setClassName(getStylePrimaryName() + "-caption-text");

        DOM.sinkEvents(expander, Event.ONCLICK);
        DOM.sinkEvents(captionTextNode, Event.ONCLICK);
    }
}
 
Example 12
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Should the next page button be visible to the user?
 *
 * @param active
 */
private void setNextButtonActive(boolean active) {
	debug("VComboBoxMultiselect.SP: setNextButtonActive(" + active + ")");

	if (active) {
		DOM.sinkEvents(this.down, Event.ONCLICK);
		this.down.setClassName(VComboBoxMultiselect.this.getStylePrimaryName() + "-nextpage");
	} else {
		DOM.sinkEvents(this.down, 0);
		this.down.setClassName(VComboBoxMultiselect.this.getStylePrimaryName() + "-nextpage-off");
	}
}
 
Example 13
Source File: CubaScrollTableWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
public CubaScrollTableHead() {
    Element iconElement = presentationsEditIcon.getElement();
    iconElement.setClassName("c-table-prefs-icon");
    iconElement.getStyle().setDisplay(Style.Display.NONE);

    Element columnSelector = (Element) getElement().getLastChild();
    DOM.insertChild(getElement(), iconElement, DOM.getChildIndex(getElement(), columnSelector));

    DOM.sinkEvents(iconElement, Event.ONCLICK);
}
 
Example 14
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Should the previous page button be visible to the user
 *
 * @param active
 */
private void setPrevButtonActive(boolean active) {
	debug("VComboBoxMultiselect.SP: setPrevButtonActive(" + active + ")");

	if (active) {
		DOM.sinkEvents(this.up, Event.ONCLICK);
		this.up.setClassName(VComboBoxMultiselect.this.getStylePrimaryName() + "-prevpage");
	} else {
		DOM.sinkEvents(this.up, 0);
		this.up.setClassName(VComboBoxMultiselect.this.getStylePrimaryName() + "-prevpage-off");
	}

}
 
Example 15
Source File: VSliderPanel.java    From vaadin-sliderpanel with MIT License 4 votes vote down vote up
public VSliderPanel() {
    super();
    // main wrapper of the component
    this.wrapperNode = Document.get()
                               .createDivElement();
    this.wrapperNode.setClassName(VSliderPanel.CLASSNAME + "-wrapper");
    getElement().appendChild(this.wrapperNode);

    // container that holds the content
    this.contentNode = Document.get()
                               .createDivElement();
    this.contentNode.setClassName(VSliderPanel.CLASSNAME + "-content");
    this.contentNode.getStyle()
                    .setDisplay(Display.BLOCK);
    this.wrapperNode.appendChild(this.contentNode);

    // wrapper for collapsed content line, tab with caption and icon
    this.navigationElem = Document.get()
                                  .createDivElement();
    this.navigationElem.setClassName(VSliderPanel.CLASSNAME + "-navigator");

    this.tabElem = Document.get()
                           .createDivElement();
    this.tabElem.setClassName(VSliderPanel.CLASSNAME + "-tab");
    this.navigationElem.appendChild(this.tabElem);

    this.captionNode = Document.get()
                               .createDivElement();
    this.captionNode.setClassName(VSliderPanel.CLASSNAME + "-caption");
    this.tabElem.appendChild(this.captionNode);

    DivElement toggleLabel = Document.get()
                                     .createDivElement();
    toggleLabel.setClassName(VSliderPanel.CLASSNAME + "-icon");
    this.tabElem.appendChild(toggleLabel);

    DOM.sinkEvents(this.tabElem, Event.ONCLICK);
    this.wrapperNode.appendChild(this.navigationElem);

    Event.addNativePreviewHandler(this);
}
 
Example 16
Source File: CubaDateFieldWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
public CubaDateFieldWidget() {
    // handle shortcuts
    DOM.sinkEvents(getElement(), Event.ONKEYDOWN);
}
 
Example 17
Source File: CubaTreeTableWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
protected CubaTreeTableWidget() {
    // handle shortcuts
    DOM.sinkEvents(getElement(), Event.ONKEYDOWN);

    hideColumnControlAfterClick = false;
}
 
Example 18
Source File: AnnotationSpreadRenderer.java    From swellrt with Apache License 2.0 4 votes vote down vote up
@Deprecated
private void removeListener(com.google.gwt.user.client.Element implNodelet) {
  DOM.setEventListener(implNodelet, null);
  DOM.sinkEvents(implNodelet, DOM.getEventsSunk(implNodelet) & ~MOUSE_LISTENER_EVENTS);
}
 
Example 19
Source File: CubaWindowWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void constructDOM() {
    super.constructDOM();

    DOM.sinkEvents(closeBox, Event.FOCUSEVENTS);
}
 
Example 20
Source File: CubaOrderedActionsLayoutWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
public CubaOrderedActionsLayoutWidget(String className, boolean vertical) {
    super(vertical);
    getElement().setTabIndex(-1);
    setStyleName(className);
    DOM.sinkEvents(getElement(), Event.ONKEYDOWN);
}