List of usage examples for com.google.gwt.event.shared HandlerManager HandlerManager
public HandlerManager(Object source)
From source file:ace.client.JSEditorToolbar.java
License:Apache License
/** * Creates a new toolbar that drives the given rich text area. * //from w w w .j a v a2 s .c o m * @param richText the rich text area to be controlled */ public JSEditorToolbar(JSEditorProxy editor) { this.editor = editor; //this.basic = richText.getBasicFormatter(); //this.extended = richText.getExtendedFormatter(); hm = new HandlerManager(editor); outer.add(topPanel); //outer.add(bottomPanel); //topPanel.setWidth("100%"); //bottomPanel.setWidth("100%"); initWidget(outer); setStyleName("gwt-RichTextToolbar"); //richText.addStyleName("hasRichTextToolbar"); topPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); topPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); topPanel.setSpacing(3); topPanel.add(new Label("JSEditor") { { setWidth("70px"); } }); topPanel.add(save = createPushButton(images.save(), strings.save())); topPanel.add(indent = createPushButton(images.indent(), strings.indent())); indent.setEnabled(false); topPanel.add(outdent = createPushButton(images.outdent(), strings.outdent())); outdent.setEnabled(false); /* if (basic != null) { topPanel.add(bold = createToggleButton(images.bold(), strings.bold())); topPanel.add(italic = createToggleButton(images.italic(), strings.italic())); topPanel.add(underline = createToggleButton(images.underline(), strings.underline())); topPanel.add(subscript = createToggleButton(images.subscript(), strings.subscript())); topPanel.add(superscript = createToggleButton(images.superscript(), strings.superscript())); topPanel.add(justifyLeft = createPushButton(images.justifyLeft(), strings.justifyLeft())); topPanel.add(justifyCenter = createPushButton(images.justifyCenter(), strings.justifyCenter())); topPanel.add(justifyRight = createPushButton(images.justifyRight(), strings.justifyRight())); } if (extended != null) { topPanel.add(strikethrough = createToggleButton(images.strikeThrough(), strings.strikeThrough())); topPanel.add(indent = createPushButton(images.indent(), strings.indent())); topPanel.add(outdent = createPushButton(images.outdent(), strings.outdent())); topPanel.add(hr = createPushButton(images.hr(), strings.hr())); topPanel.add(ol = createPushButton(images.ol(), strings.ol())); topPanel.add(ul = createPushButton(images.ul(), strings.ul())); topPanel.add(insertImage = createPushButton(images.insertImage(), strings.insertImage())); topPanel.add(createLink = createPushButton(images.createLink(), strings.createLink())); topPanel.add(removeLink = createPushButton(images.removeLink(), strings.removeLink())); topPanel.add(removeFormat = createPushButton(images.removeFormat(), strings.removeFormat())); } if (basic != null) { bottomPanel.add(backColors = createColorList("Background")); bottomPanel.add(foreColors = createColorList("Foreground")); bottomPanel.add(fonts = createFontList()); bottomPanel.add(fontSizes = createFontSizes()); // We only use these handlers for updating status, so don't hook them up // unless at least basic editing is supported. richText.addKeyUpHandler(handler); richText.addClickHandler(handler); } */ }
From source file:com.ait.lienzo.client.core.event.AttributesChangedManager.java
License:Open Source License
public final HandlerRegistration addAttributesChangedHandler(final Attribute attribute, final AttributesChangedHandler handler) { if ((null == attribute) || (null == handler)) { return null; }/*from w w w. j a v a 2 s .co m*/ if (null != m_ser) { if (null == m_ctr) { m_ctr = new NFastStringHistogram(); } if (null == m_map) { m_map = new NFastStringMap<HandlerManager>(); } final String name = attribute.getProperty(); m_ctr.inc(name); HandlerManager entry = m_map.get(name); if (null == entry) { m_map.put(name, entry = new HandlerManager(m_ser)); } return new HandlerRegistrationProxy(name, entry.addHandler(AttributesChangedEvent.getType(), handler)); } return null; }
From source file:com.ait.lienzo.client.core.shape.Attributes.java
License:Open Source License
public final HandlerRegistration addAttributesChangedHandler(final Attribute attribute, final AttributesChangedHandler handler) { if ((null == attribute) || (null == handler)) { return null; }/* ww w . j av a2 s .com*/ if (null != m_ser) { final String name = attribute.getProperty(); if (null == m_set) { m_set = new NFastStringCountingSet(); } m_set.inc(name); if (null == m_man) { m_man = new HandlerManager(m_ser); } final HandlerRegistration proxy = m_man.addHandler(AttributesChangedEvent.getType(), handler); return new HandlerRegistration() { @Override public void removeHandler() { if (null != m_set) { m_set.dec(name); if (m_set.isEmpty()) { m_set = null; } } proxy.removeHandler(); } }; } return null; }
From source file:com.ait.lienzo.client.core.shape.Node.java
License:Open Source License
public HandlerManager getHandlerManager() { if (null == m_events) { m_events = new HandlerManager(this); } return m_events; }
From source file:com.ait.lienzo.client.core.shape.Node.java
License:Open Source License
protected final <H extends EventHandler> HandlerRegistration addEnsureHandler(final Type<H> type, final H handler) { if (null == m_events) { m_events = new HandlerManager(this); }/*from w w w .j a va2s. co m*/ return m_events.addHandler(type, handler); }
From source file:com.ait.lienzo.client.core.shape.wires.WiresContainer.java
License:Open Source License
WiresContainer(final IContainer<?, IPrimitive<?>> container, final HandlerManager m_events, final HandlerRegistrationManager m_registrationManager, final IAttributesChangedBatcher attributesChangedBatcher) { this.m_container = container; this.m_events = null != m_events ? m_events : new HandlerManager(this); this.m_dragging = false; this.m_drag_initialized = false; this.m_childShapes = new NFastArrayList<>(); this.m_registrationManager = m_registrationManager; this.attributesChangedBatcher = attributesChangedBatcher; }
From source file:com.ait.lienzo.client.widget.panel.impl.PreviewPanel.java
License:Apache License
PreviewPanel(final LienzoPanel panel, final HandlerRegistrationManager registrationManager) { super(panel, new PreviewBoundsProvider()); m_events = new HandlerManager(this); visibleBounds = Bounds.empty(); visibleScaleFactor = new Point2D(1, 1); handlers = registrationManager;/*from w w w .j av a 2 s. com*/ previewLayer = new PreviewLayer(backgroundBoundsSupplier, visibleBoundsSupplier); decorator = new PreviewLayerDecorator(handlers, backgroundBoundsSupplier, visibleBoundsSupplier, new PreviewLayerDecorator.EventHandler() { @Override public void onMouseEnter() { getLienzoPanel().getElement().getStyle().setCursor(Style.Cursor.MOVE); } @Override public void onMouseExit() { getLienzoPanel().getElement().getStyle().setCursor(Style.Cursor.DEFAULT); } @Override public void onMove(final Point2D point) { setVisibleBoundsAt(point.getX(), point.getY()); fireLienzoPanelScrollEvent(); batch(); } }); }
From source file:com.ait.lienzo.client.widget.panel.scrollbars.ScrollablePanel.java
License:Apache License
private ScrollablePanel(final LienzoPanel lienzoPanel, final BoundsProvider layerBoundsProvider) { super(lienzoPanel, layerBoundsProvider); this.m_events = new HandlerManager(this); this.scrollHandler = new ScrollablePanelHandler(this); this.handlers = new HandlerRegistrationManager(); setupPanels();//ww w . jav a 2 s. co m setupHandlers(); }
From source file:com.ait.lienzo.test.stub.overlays.OptionalNodeFields.java
License:Open Source License
public HandlerManager getHandlerManager() { if (null == m_hand) { setHandlerManager(new HandlerManager(this)); }/*from w w w .j a va 2s. c om*/ return m_hand; }
From source file:com.ait.tooling.nativetools.client.storage.ClientStorage.java
License:Open Source License
public final HandlerRegistration addClientStorageHandler(final ClientStorageHandler handler) { if (null == m_events) { m_events = new HandlerManager(this); }//from ww w .j a va 2 s.c o m return m_events.addHandler(ClientStorageEvent.TYPE, Objects.requireNonNull(handler)); }