List of usage examples for com.google.gwt.event.shared HandlerManager HandlerManager
public HandlerManager(Object source)
From source file:org.onebusaway.webapp.gwt.where_library.view.stops.TransitMapManager.java
License:Apache License
/**** * Private Methods// w w w .j av a2s . c om ****/ private HandlerManager ensureHandlers() { return _handlerManager == null ? _handlerManager = new HandlerManager(this) : _handlerManager; }
From source file:org.opennms.features.poller.remote.gwt.client.Main.java
License:Open Source License
@Override public void onModuleLoad() { m_eventBus = new HandlerManager(null); Application application = new Application(getEventBus()); MapPanel mapPanel = createMap(application); LocationStatusServiceAsync remoteService = GWT.create(LocationStatusService.class); RemoteEventService remoteEventService = RemoteEventServiceFactory.getInstance().getRemoteEventService(); application.initialize(new DefaultApplicationView(application, getEventBus(), mapPanel), remoteService, remoteEventService, new DeferredCommandExecutor()); }
From source file:org.opennms.gwt.web.ui.asset.client.AssetPage.java
License:Open Source License
@Override public void onModuleLoad() { AssetServiceAsync rpcService = getAssetService(); HandlerManager eventBus = new HandlerManager(null); AppController appViewer = new AppController(rpcService, eventBus); if (RootPanel.get("opennms-assetNodePage") != null) { appViewer.go(RootPanel.get("opennms-assetNodePage")); }//from www.j av a2 s. c o m }
From source file:org.openremote.web.console.event.ConsoleUnitEventManager.java
License:Open Source License
private ConsoleUnitEventManager() { eventBus = new HandlerManager(WebConsole.getConsoleUnit()); pressMoveReleaseHandler = new PressMoveReleaseHandlerImpl(); attachHandlers(); }
From source file:org.rest.client.ui.desktop.widget.HeadersFormRow.java
License:Apache License
/** * Construct headers form inputs row.//ww w .j a v a2 s . co m * * @param suggestOracle An oracle to provide headers name suggestions. * @param name Default name for header. May be null. * @param name Default value for header. May be null. * @param value */ public HeadersFormRow(HeadersSuggestOracle suggestOracle, String name, String value) { initWidget(uiBinder.createAndBindUi(this)); this.suggestOracle = suggestOracle; handlerManager = new HandlerManager(this); //TODO: make it initialize in next event loop nameBox = getSuggestBox(); nameBox.addSelectionHandler(this); headerNamePanel.add(nameBox); if (name != null) { nameBox.setValue(name); } if (value != null) { valueBox.setValue(value); } nameBox.getElement().setAttribute("placeholder", "name"); valueBox.getElement().setAttribute("placeholder", "value"); if (name != null && !name.isEmpty()) { provideHeadersSupport(); } nameBox.addValueChangeHandler(this); valueBox.addValueChangeHandler(this); valueBox.addBlurHandler(headerInputBlurHandler); nameBox.addDomHandler(headerInputBlurHandler, BlurEvent.getType()); }
From source file:org.rstudio.studio.client.common.Value.java
License:Open Source License
public Value(T initialValue) { handlers_ = new HandlerManager(this); value_ = initialValue; }
From source file:org.rstudio.studio.client.common.ValueChangeHandlerManager.java
License:Open Source License
public ValueChangeHandlerManager(Object source) { manager_ = new HandlerManager(source); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.text.AceEditorWidget.java
License:Open Source License
public AceEditorWidget() { initWidget(new HTML()); FontSizer.applyNormalFontSize(this); setSize("100%", "100%"); capturingHandlers_ = new HandlerManager(this); addEventListener(getElement(), "keydown", capturingHandlers_); addEventListener(getElement(), "keyup", capturingHandlers_); addEventListener(getElement(), "keypress", capturingHandlers_); addStyleName("loading"); editor_ = AceEditorNative.createEditor(getElement()); editor_.manageDefaultKeybindings();/* w ww .j a v a 2s . c o m*/ editor_.getRenderer().setHScrollBarAlwaysVisible(false); editor_.setShowPrintMargin(false); editor_.setPrintMarginColumn(0); editor_.setHighlightActiveLine(false); editor_.setHighlightGutterLine(false); editor_.delegateEventsTo(AceEditorWidget.this); editor_.onChange(new CommandWithArg<AceDocumentChangeEventNative>() { public void execute(AceDocumentChangeEventNative changeEvent) { // Case 3815: It appears to be possible for change events to be // fired recursively, which exhausts the stack. This shouldn't // happen, but since it has in at least one setting, guard against // recursion here. if (inOnChangeHandler_) { Debug.log("Warning: ignoring recursive ACE change event"); return; } inOnChangeHandler_ = true; try { ValueChangeEvent.fire(AceEditorWidget.this, null); updateBreakpoints(changeEvent); updateAnnotations(changeEvent); // Immediately re-render on change if we have markers, to // ensure they're re-drawn in the correct locations. if (editor_.getSession().getMarkers(true).size() > 0) { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { editor_.getRenderer().renderMarkers(); } }); } } catch (Exception ex) { Debug.log("Exception occurred during ACE change event: " + ex.getMessage()); } inOnChangeHandler_ = false; } }); editor_.onChangeFold(new Command() { @Override public void execute() { fireEvent(new FoldChangeEvent()); } }); editor_.onGutterMouseDown(new CommandWithArg<AceMouseEventNative>() { @Override public void execute(AceMouseEventNative arg) { // make sure the click is actually intended for the gutter com.google.gwt.dom.client.Element targetElement = Element.as(arg.getNativeEvent().getEventTarget()); if (targetElement.getClassName().indexOf("ace_gutter-cell") < 0) { return; } NativeEvent evt = arg.getNativeEvent(); // right-clicking shouldn't set a breakpoint if (evt.getButton() != NativeEvent.BUTTON_LEFT) { return; } // make sure that the click was in the left half of the element-- // clicking on the line number itself (or the gutter near the // text) shouldn't set a breakpoint. if (evt.getClientX() < (targetElement.getAbsoluteLeft() + (targetElement.getClientWidth() / 2))) { toggleBreakpointAtPosition(arg.getDocumentPosition()); } } }); editor_.getSession().getSelection().addCursorChangeHandler(new CommandWithArg<Position>() { public void execute(Position arg) { AceEditorWidget.this.fireEvent(new CursorChangedEvent(arg)); } }); AceEditorNative.addEventListener(editor_, "undo", new CommandWithArg<Void>() { public void execute(Void arg) { fireEvent(new UndoRedoEvent(false)); } }); AceEditorNative.addEventListener(editor_, "redo", new CommandWithArg<Void>() { public void execute(Void arg) { fireEvent(new UndoRedoEvent(true)); } }); AceEditorNative.addEventListener(editor_, "paste", new CommandWithArg<String>() { public void execute(String text) { fireEvent(new PasteEvent(text)); } }); AceEditorNative.addEventListener(editor_, "mousedown", new CommandWithArg<AceMouseEventNative>() { @Override public void execute(AceMouseEventNative event) { fireEvent(new AceClickEvent(event)); } }); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.text.status.NotebookProgressWidget.java
License:Open Source License
public NotebookProgressWidget() { manager_ = new HandlerManager(this); cancelCommands_ = new ArrayList<Command>(); initWidget(uiBinder.createAndBindUi(this)); // ensure elements look clickable progressBar_.getElement().getStyle().setCursor(Cursor.POINTER); interruptButton_.getElement().getStyle().setCursor(Cursor.POINTER); MouseDownHandler handler = new MouseDownHandler() { public void onMouseDown(MouseDownEvent event) { event.preventDefault();//from w w w .j av a 2s.c o m event.stopPropagation(); ClickEvent.fireNativeEvent( Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false), manager_); } }; // connect native click handler progressBar_.addDomHandler(handler, MouseDownEvent.getType()); interruptButton_.addDomHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { for (Command cancelCommand : cancelCommands_) cancelCommand.execute(); } }, MouseDownEvent.getType()); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTargetWidget.java
License:Open Source License
public TextEditingTargetWidget(Commands commands, UIPrefs uiPrefs, FileTypeRegistry fileTypeRegistry, DocDisplay editor, TextFileType fileType, String extendedType, EventBus events, Session session) { commands_ = commands;/*w w w . j a v a 2 s . c o m*/ uiPrefs_ = uiPrefs; session_ = session; fileTypeRegistry_ = fileTypeRegistry; editor_ = editor; extendedType_ = extendedType; sourceOnSave_ = new CheckBox(); srcOnSaveLabel_ = new CheckboxLabel(sourceOnSave_, "Source on Save").getLabel(); statusBar_ = new StatusBarWidget(); shinyViewerMenu_ = RStudioGinjector.INSTANCE.getShinyViewerTypePopupMenu(); handlerManager_ = new HandlerManager(this); findReplace_ = new TextEditingTargetFindReplace(new TextEditingTargetFindReplace.Container() { @Override public AceEditor getEditor() { return (AceEditor) editor_; } @Override public void insertFindReplace(FindReplaceBar findReplaceBar) { Widget beforeWidget = null; if (warningBar_ != null && warningBar_.isAttached()) beforeWidget = warningBar_; panel_.insertNorth(findReplaceBar, findReplaceBar.getHeight(), beforeWidget); } @Override public void removeFindReplace(FindReplaceBar findReplaceBar) { panel_.remove(findReplaceBar); } }); panel_ = new PanelWithToolbars(toolbar_ = createToolbar(fileType), editor.asWidget(), statusBar_); adaptToFileType(fileType); initWidget(panel_); }