Java Code Examples for javafx.event.EventHandler#handle()

The following examples show how to use javafx.event.EventHandler#handle() . 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: Section.java    From OEE-Designer with MIT License 6 votes vote down vote up
@SuppressWarnings("rawtypes")
public void fireSectionEvent(final SectionEvent EVENT) {
       final EventHandler<SectionEvent> HANDLER;
       final EventType                  TYPE = EVENT.getEventType();
       if (SectionEvent.TILES_FX_SECTION_ENTERED == TYPE) {
           HANDLER = getOnSectionEntered();
       } else if (SectionEvent.TILES_FX_SECTION_LEFT == TYPE) {
           HANDLER = getOnSectionLeft();
       } else if (SectionEvent.TILES_FX_SECTION_UPDATE == TYPE) {
           HANDLER = getOnSectionUpdate();
       } else {
           HANDLER = null;
       }

       if (null == HANDLER) return;

       HANDLER.handle(EVENT);
   }
 
Example 2
Source File: TimeSection.java    From OEE-Designer with MIT License 6 votes vote down vote up
@SuppressWarnings("rawtypes")
public void fireTimeSectionEvent(final TimeSectionEvent EVENT) {
       final EventHandler<TimeSectionEvent> HANDLER;
       final EventType                      TYPE = EVENT.getEventType();
       if (TimeSectionEvent.TIME_SECTION_ENTERED == TYPE) {
           HANDLER = getOnTimeSectionEntered();
       } else if (TimeSectionEvent.TIME_SECTION_LEFT == TYPE) {
           HANDLER = getOnTimeSectionLeft();
       } else {
           HANDLER = null;
       }

       if (null == HANDLER) return;

       HANDLER.handle(EVENT);
   }
 
Example 3
Source File: DockItem.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** Programmatically close this tab
 *
 *  <p>Will invoke on-close-request handler that can abort the action,
 *  otherwise invoke the on-closed handler and remove the tab
 *
 *  @return <code>true</code> if tab closed, <code>false</code> if it remained open
 */
public boolean close()
{
    EventHandler<Event> handler = getOnCloseRequest();
    if (handler != null)
    {
        final Event event = new Event(Tab.TAB_CLOSE_REQUEST_EVENT);
        handler.handle(event);
        if (event.isConsumed())
            return false;
    }

    handleClosed(null);

    getDockPane().getTabs().remove(this);

    return true;
}
 
Example 4
Source File: RadialMenu.java    From Enzo with Apache License 2.0 6 votes vote down vote up
public void fireMenuEvent(final MenuEvent EVENT) {
    fireEvent(EVENT);

    final EventType TYPE = EVENT.getEventType();
    final EventHandler<MenuEvent> HANDLER;

    if (MenuEvent.MENU_OPEN_STARTED == TYPE) {
        HANDLER = getOnMenuOpenStarted();
    } else if (MenuEvent.MENU_OPEN_FINISHED == TYPE) {
        HANDLER = getOnMenuOpenFinished();
    } else if (MenuEvent.MENU_CLOSE_STARTED == TYPE) {
        HANDLER = getOnMenuCloseStarted();
    } else if (MenuEvent.MENU_CLOSE_FINISHED == TYPE) {
        HANDLER = getOnMenuCloseFinished();
    } else {
        HANDLER = null;
    }

    if (HANDLER != null) {
        HANDLER.handle(EVENT);
    }
}
 
Example 5
Source File: Section.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
public void fireSectionEvent(final SectionEvent EVENT) {
    final EventHandler<SectionEvent> HANDLER;
    final EventType                  TYPE = EVENT.getEventType();
    if (SectionEvent.TILES_FX_SECTION_ENTERED == TYPE) {
        HANDLER = getOnSectionEntered();
    } else if (SectionEvent.TILES_FX_SECTION_LEFT == TYPE) {
        HANDLER = getOnSectionLeft();
    } else if (SectionEvent.TILES_FX_SECTION_UPDATE == TYPE) {
        HANDLER = getOnSectionUpdate();
    } else {
        HANDLER = null;
    }

    if (null == HANDLER) return;

    HANDLER.handle(EVENT);
}
 
Example 6
Source File: Section.java    From Medusa with Apache License 2.0 6 votes vote down vote up
public void fireSectionEvent(final SectionEvent EVENT) {
    final EventHandler<SectionEvent> HANDLER;
    final EventType                  TYPE = EVENT.getEventType();
    if (SectionEvent.SECTION_ENTERED == TYPE) {
        HANDLER = getOnSectionEntered();
    } else if (SectionEvent.SECTION_LEFT == TYPE) {
        HANDLER = getOnSectionLeft();
    } else if (SectionEvent.SECTION_UPDATE == TYPE) {
        HANDLER = getOnSectionUpdate();
    } else {
        HANDLER = null;
    }

    if (null == HANDLER) return;

    HANDLER.handle(EVENT);
}
 
Example 7
Source File: PushButton.java    From Enzo with Apache License 2.0 6 votes vote down vote up
public void fireSelectionEvent(final SelectionEvent EVENT) {
    final EventType TYPE    = EVENT.getEventType();
    final EventHandler<SelectionEvent> HANDLER;

    if (SelectionEvent.SELECTED == TYPE) {
        HANDLER = getOnSelect();
    } else if (SelectionEvent.DESELECTED == TYPE) {
        HANDLER = getOnDeselect();
    } else if (SelectionEvent.EMPTY == TYPE) {
        HANDLER = getOnEmpty();
    } else {
        HANDLER = null;
    }

    if (HANDLER != null) {
        HANDLER.handle(EVENT);
    }
}
 
Example 8
Source File: RadialMenu.java    From Enzo with Apache License 2.0 6 votes vote down vote up
public void fireItemEvent(final ItemEvent EVENT) {
    fireEvent(EVENT);

    final EventType TYPE = EVENT.getEventType();
    final EventHandler<ItemEvent> HANDLER;
    if (ItemEvent.ITEM_CLICKED == TYPE) {
        HANDLER = getOnItemClicked();
    } else if (ItemEvent.ITEM_SELECTED == TYPE) {
        HANDLER = getOnItemSelected();
    } else if (ItemEvent.ITEM_DESELECTED == TYPE) {
       HANDLER = getOnItemDeselected();
    } else {
        HANDLER = null;
    }

    if (HANDLER != null) {
        HANDLER.handle(EVENT);
    }
}
 
Example 9
Source File: TimeSection.java    From Medusa with Apache License 2.0 5 votes vote down vote up
public void fireTimeSectionEvent(final TimeSectionEvent EVENT) {
    final EventHandler<TimeSectionEvent> HANDLER;
    final EventType                      TYPE = EVENT.getEventType();
    if (TimeSectionEvent.TIME_SECTION_ENTERED == TYPE) {
        HANDLER = getOnTimeSectionEntered();
    } else if (TimeSectionEvent.TIME_SECTION_LEFT == TYPE) {
        HANDLER = getOnTimeSectionLeft();
    } else {
        HANDLER = null;
    }

    if (null == HANDLER) return;

    HANDLER.handle(EVENT);
}
 
Example 10
Source File: OnOffSwitch.java    From Enzo with Apache License 2.0 5 votes vote down vote up
public void fireSelectionEvent(final SelectionEvent EVENT) {
    fireEvent(EVENT);
    final EventType TYPE = EVENT.getEventType();
    final EventHandler<SelectionEvent> HANDLER;
    if (SelectionEvent.SELECT == TYPE) {
        HANDLER = getOnSelect();
    } else if (SelectionEvent.DESELECT == TYPE) {
        HANDLER = getOnDeselect();
    } else {
        HANDLER = null;
    }
    if (null == HANDLER) return;
    HANDLER.handle(EVENT);
}
 
Example 11
Source File: IconSwitch.java    From Enzo with Apache License 2.0 5 votes vote down vote up
public void fireSelectionEvent(final SelectionEvent EVENT) {
    fireEvent(EVENT);
    final EventType TYPE = EVENT.getEventType();
    final EventHandler<SelectionEvent> HANDLER;
    if (SelectionEvent.SELECT == TYPE) {
        HANDLER = getOnSelect();
    } else if (SelectionEvent.DESELECT == TYPE) {
        HANDLER = getOnDeselect();
    } else {
        HANDLER = null;
    }
    if (null == HANDLER) return;
    HANDLER.handle(EVENT);
}
 
Example 12
Source File: Marker.java    From Enzo with Apache License 2.0 5 votes vote down vote up
public void fireMarkerEvent(final MarkerEvent EVENT) {
    final EventHandler<MarkerEvent> HANDLER;
    final EventType TYPE = EVENT.getEventType();
    if (MarkerEvent.MARKER_EXCEEDED == TYPE) {
        HANDLER = getOnMarkerExceeded();
    } else if (MarkerEvent.MARKER_UNDERRUN == TYPE) {
        HANDLER = getOnMarkerUnderrun();
    } else {
        HANDLER = null;
    }

    if (null == HANDLER) return;

    HANDLER.handle(EVENT);
}
 
Example 13
Source File: Section.java    From Enzo with Apache License 2.0 5 votes vote down vote up
public void fireSectionEvent(final SectionEvent EVENT) {
    final EventHandler<SectionEvent> HANDLER;
    final EventType TYPE = EVENT.getEventType();
    if (SectionEvent.ENTERING_SECTION == TYPE) {
        HANDLER = getOnEnteringSection();
    } else if (SectionEvent.LEAVING_SECTION == TYPE) {
        HANDLER = getOnLeavingSection();
    } else {
        HANDLER = null;
    }

    if (null == HANDLER) return;

    HANDLER.handle(EVENT);
}
 
Example 14
Source File: TButton.java    From Enzo with Apache License 2.0 5 votes vote down vote up
public void fireSelectEvent(final SelectEvent EVENT) {
    final EventHandler<SelectEvent> HANDLER;
    final EventType                    TYPE    = EVENT.getEventType();
    if (SelectEvent.SELECT == TYPE) {
        HANDLER = getOnSelect();
    } else if (SelectEvent.DESELECT == TYPE) {
        HANDLER = getOnDeselect();
    } else {
        HANDLER = null;
    }

    if (HANDLER != null) {
        HANDLER.handle(EVENT);
    }
}
 
Example 15
Source File: HelloIoTApp.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
private void doTimeout(Duration duration, EventHandler<ActionEvent> eventhandler) {
    if (duration.greaterThan(Duration.ZERO)) {
        new Timeline(new KeyFrame(duration, eventhandler)).play();
    } else {
        eventhandler.handle(new ActionEvent());
    }
}
 
Example 16
Source File: TimeSection.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public void fireTimeSectionEvent(final TimeSectionEvent EVENT) {
    final EventHandler<TimeSectionEvent> HANDLER;
    final EventType                      TYPE = EVENT.getEventType();
    if (TimeSectionEvent.TIME_SECTION_ENTERED == TYPE) {
        HANDLER = getOnTimeSectionEntered();
    } else if (TimeSectionEvent.TIME_SECTION_LEFT == TYPE) {
        HANDLER = getOnTimeSectionLeft();
    } else {
        HANDLER = null;
    }

    if (null == HANDLER) return;

    HANDLER.handle(EVENT);
}
 
Example 17
Source File: ViewportTabs.java    From Recaf with MIT License 5 votes vote down vote up
private void closeTab(Tab tab) {
	// Call close handler
	EventHandler<Event> handler = tab.getOnClosed();
	if(handler != null)
		handler.handle(null);
	// Actually close tab
	getTabs().remove(tab);
}
 
Example 18
Source File: PreferencesFxModel.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private void fireEvent(PreferencesFxEvent event) {
  List<EventHandler<? super PreferencesFxEvent>> list =
      this.eventHandlers.get(event.getEventType());
  if (list == null) {
    return;
  }
  for (EventHandler<? super PreferencesFxEvent> eventHandler : list) {
    if (!event.isConsumed()) {
      eventHandler.handle(event);
    }
  }
}
 
Example 19
Source File: EventHandlerTool.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
private static <T extends Event> void handle(final T e, final EventHandler<T> h1, final EventHandler<T> h2, final EventHandler<T> h3) {
    h1.handle(e);
    h2.handle(e);
    h3.handle(e);
}
 
Example 20
Source File: PopOverWrapper.java    From pmd-designer with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void handleHiding(WindowEvent we) {
    EventHandler<WindowEvent> userOnHiding = this.userOnHiding;
    this.userOnHiding = weee -> {};
    userOnHiding.handle(we);
}