当前位置: 首页>>代码示例>>Java>>正文


Java Event.sinkEvents方法代码示例

本文整理汇总了Java中com.google.gwt.user.client.Event.sinkEvents方法的典型用法代码示例。如果您正苦于以下问题:Java Event.sinkEvents方法的具体用法?Java Event.sinkEvents怎么用?Java Event.sinkEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.client.Event的用法示例。


在下文中一共展示了Event.sinkEvents方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replaceInputElement

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
 * Replace the current input element with a new one. Preserves all state except for the name property, for nasty reasons related to radio button grouping.
 * (See implementation of {@link RadioButton#setName}.)
 *
 * @param elem the new input element
 */
protected void replaceInputElement(Element elem) {
    InputElement newInputElem = InputElement.as(elem);
    // Collect information we need to set
    int tabIndex = getTabIndex();
    boolean checked = getValue();
    boolean enabled = isEnabled();
    String formValue = getFormValue();
    String uid = inputElem.getId();
    String accessKey = inputElem.getAccessKey();
    int sunkEvents = Event.getEventsSunk(inputElem);

    // Clear out the old input element
    setEventListener(asOld(inputElem), null);

    getElement().replaceChild(newInputElem, inputElem);

    // Sink events on the new element
    Event.sinkEvents(elem, Event.getEventsSunk(inputElem));
    Event.sinkEvents(inputElem, 0);
    inputElem = newInputElem;

    // Setup the new element
    Event.sinkEvents(inputElem, sunkEvents);
    inputElem.setId(uid);
    if (!"".equals(accessKey)) {
        inputElem.setAccessKey(accessKey);
    }
    setTabIndex(tabIndex);
    setValue(checked);
    setEnabled(enabled);
    setFormValue(formValue);

    // Set the event listener
    if (isAttached()) {
        setEventListener(asOld(inputElem), this);
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:44,代码来源:AccessibleCheckBox.java

示例2: sinkEvents

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void sinkEvents(int eventBitsToAdd) {
    // Like CheckBox, we want to hear about inputElem. We
    // also want to know what's going on with the label, to
    // make sure onBrowserEvent is able to record value changes
    // initiated by label events
    if (isOrWasAttached()) {
        Event.sinkEvents(inputElem, eventBitsToAdd | Event.getEventsSunk(inputElem));
        Event.sinkEvents(labelElem, eventBitsToAdd | Event.getEventsSunk(labelElem));
    } else {
        super.sinkEvents(eventBitsToAdd);
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:14,代码来源:AccessibleRadioButton.java

示例3: sinkEvents

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void sinkEvents(int eventBitsToAdd) {
    if (isOrWasAttached()) {
        Event.sinkEvents(inputElem, eventBitsToAdd | Event.getEventsSunk(inputElem));
    } else {
        super.sinkEvents(eventBitsToAdd);
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:9,代码来源:AccessibleCheckBox.java

示例4: addClickHandler

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
private void addClickHandler(Set<String> ids, final VizClickHandler handler) {
    for (String nodeId : ids) {
        Element svgNode = DOM.getElementById(nodeId);
        Event.sinkEvents(svgNode, Event.ONCLICK);
        Event.setEventListener(svgNode, new EventListener() {

            @Override
            public void onBrowserEvent(Event event) {
                handler.onClick(event);
            }
        });
    }
}
 
开发者ID:pontusbostrom,项目名称:VaadinGraphvizComponent,代码行数:14,代码来源:VizComponentWidget.java

示例5: CubaWindowWidget

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
public CubaWindowWidget() {
    DOM.sinkEvents(header, DOM.getEventsSunk(header) | Event.ONCONTEXTMENU);
    addStyleName(NONMODAL_WINDOW_CLASSNAME);
    Event.sinkEvents(getModalityCurtain(), Event.ONCLICK);
    Event.setEventListener(getModalityCurtain(), event -> {
        if (closeOnClickOutside) {
            if (clickOnModalityCurtain != null) {
                clickOnModalityCurtain.run();
            }
        }
    });
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:CubaWindowWidget.java

示例6: initPanels

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
private void initPanels() {
    pagination = new Pagination();
    pager = new SimplePager();

    VerticalPanel bottomWidgets = new VerticalPanel();

    startDateControlScrollbar = new NativeHorizontalScrollbar();
    startDateControlScrollbar.setWidth("100%");
    startDateControlScrollbar.addScrollHandler((e) -> {
        double pos = (startDateControlScrollbar.getHorizontalScrollPosition()
                + 0.0) /
                (startDateControlScrollbar.getScrollWidth());
        long secondsBetween = presenter.getHardEndDateBound().toEpochSecond(ZoneOffset.UTC) - presenter
                .getHardStartDateBound()
                .toEpochSecond(ZoneOffset.UTC);
        presenter.setToolBox(null);
        presenter.getCalendar().setDate(presenter.getHardStartDateBound().plusSeconds(Math.round(secondsBetween
                * pos)));
    });

    daysShownRangeSlider = RangeSlider.create();
    daysShownRangeSlider.setMin("1");
    daysShownRangeSlider.setMax("7");
    daysShownRangeSlider.setStep("1");
    daysShownRangeSlider.setAttribute("orient", "vertical");
    CssResources.INSTANCE.calendar().ensureInjected();
    daysShownRangeSlider.setClassName(CssResources.INSTANCE.calendar().verticalSlider());
    daysShownRangeSlider.setValue(Integer.toString(presenter.getDaysShown()));
    Event.setEventListener(daysShownRangeSlider, (e) -> {
        presenter.getCalendar().setDaysShown(Integer
                .parseInt(daysShownRangeSlider.getValue()));
    });
    //Work around for there not being a Event.ONINPUT
    Event.sinkEvents(daysShownRangeSlider, ~0);
    daysShownRangeSliderContainer = new Span();
    daysShownRangeSliderContainer.getElement().appendChild(daysShownRangeSlider);
    sidePanel.add(daysShownRangeSliderContainer);

    bottomWidgets.add(startDateControlScrollbar);

    bottomWidgets.add(pagination);

    bottomPanel.add(bottomWidgets);

    pager.setDisplay(presenter.getPager());
    pager.setPageSize(presenter.getTotalDisplayedSpotSlots());
    pagination.clear();
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:49,代码来源:TwoDayView.java

示例7: DateCell

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
public DateCell(WeekGrid parent, Date date, Set<Long> blockedSlots) {
    weekgrid = parent;
    Element mainElement = DOM.createDiv();
    setElement(mainElement);
    makeFocusable();
    setDate(date);

    addStyleName("v-calendar-day-times");

    handlers = new LinkedList<>();

    // 2 slots / hour
    firstHour = weekgrid.getFirstHour();
    lastHour = weekgrid.getLastHour();
    numberOfSlots = (lastHour - firstHour + 1) * 2;

    long slotTime = Math.round(((lastHour - firstHour + 1) * 3600000.0) / numberOfSlots);

    slotElements = new Element[numberOfSlots];
    slotElementHeights = new int[numberOfSlots];

    slots.clear();

    long dateTime = getDate().getTime();
    long start = dateTime + firstHour * 3600000;
    long end = start + slotTime;

    for (int i = 0; i < numberOfSlots; i++) {

        boolean blocked = blockedSlots != null && blockedSlots.contains(start-dateTime);

        DateCellSlot slot = new DateCellSlot(this, new Date(start), new Date(end), blocked);
        if (i % 2 == 0) {
            slot.setStyleName(blocked ? "v-datecellslot-blocked-even" : "v-datecellslot-even");
        } else {
            slot.setStyleName(blocked ? "v-datecellslot-blocked" : "v-datecellslot");
        }

        Event.sinkEvents(slot.getElement(), Event.MOUSEEVENTS);

        mainElement.appendChild(slot.getElement());
        slotElements[i] = slot.getElement();
        slots.add(slot);
        start = end;
        end = start + slotTime;
    }

    // Sink items for tooltip handling
    Event.sinkEvents(mainElement, Event.MOUSEEVENTS);
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:51,代码来源:DateCell.java


注:本文中的com.google.gwt.user.client.Event.sinkEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。