Example usage for com.google.gwt.dom.client Document get

List of usage examples for com.google.gwt.dom.client Document get

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Document get.

Prototype

public static Document get() 

Source Link

Document

Gets the default document.

Usage

From source file:accelerator.client.ui.widget.AbstractButton.java

License:Open Source License

private void keyboardNavigation(Event event) {
    if (disabled) {
        return;/*from   w ww .j  a v a2s  . co  m*/
    }

    int code = DOM.eventGetKeyCode(event);
    switch (code) {
    case KeyCodes.KEY_ENTER:
        NativeEvent ne = Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false);
        ClickEvent.fireNativeEvent(ne, this);
        break;
    }
}

From source file:annis.gui.widgets.gwt.client.ui.VAudioPlayer.java

License:Apache License

public VAudioPlayer() {
    super(Document.get().createAudioElement());
    setStyleName(CLASSNAME);

}

From source file:annis.gui.widgets.gwt.client.ui.VJITWrapper.java

License:Apache License

public VJITWrapper() {
    super();/*from  w  ww  . j  a  v a 2s . c o  m*/

    // build the html id
    elementID = Document.get().createUniqueId();

    // init container
    DivElement wrapper = doc.createDivElement();
    DivElement container = wrapper.appendChild(doc.createDivElement());
    setElement(wrapper);

    container.setAttribute("id", "container_" + elementID);
    wrapper.setAttribute("id", elementID);
}

From source file:annis.gui.widgets.gwt.client.ui.VVideoPlayer.java

License:Apache License

public VVideoPlayer() {
    super(Document.get().createVideoElement());
    setStyleName(CLASSNAME);

    updateDimensionsWhenMetadataLoaded(getMedia());
}

From source file:ar.com.kyol.jet.client.JetCombo.java

License:Open Source License

public void setSelectedItem(E item, boolean fireEvent) {
    if (cargando) {
        pendingSelectedItem = item;/*from w  ww.j a  va 2  s.  com*/
    } else {
        int index = list.indexOf(item);
        if (index > -1) {
            if (hasSeleccioneItem) {
                index += 1;
            }
            listBox.setSelectedIndex(index);
            if (fireEvent) {
                DomEvent.fireNativeEvent(Document.get().createChangeEvent(), listBox);
            }
        }
    }
}

From source file:ar.com.kyol.jet.client.wrappers.JetComboWrapper.java

License:Open Source License

public void fireChangeEvent() {
    ChangeEvent.fireNativeEvent(Document.get().createChangeEvent(), getWrappedWidget());
}

From source file:at.ait.dme.yuma.client.colorpicker.ColorPicker.java

License:Artistic License

/**
 * Fired whenever something in this widget changes.
 *
 * Subclasses that override this method must call <tt>super.onChange(sender)</tt> to ensure that the Widget recieves its events.
 * @param sender the widget that has changed.
 *//*from   w  w w.j  a  v a 2s .com*/
public void onChange(Widget sender) {
    if (sender == tbHexColor) {
        // Figure out colors
        // Color class will do bounds check on hex input
        try {
            Color color = new Color();
            color.setHex(tbHexColor.getText());
            tbHue.setText(Integer.toString(color.getHue()));
            tbSaturation.setText(Integer.toString(color.getSaturation()));
            tbBrightness.setText(Integer.toString(color.getValue()));
            tbRed.setText(Integer.toString(color.getRed()));
            tbGreen.setText(Integer.toString(color.getGreen()));
            tbBlue.setText(Integer.toString(color.getBlue()));
            tbHexColor.setText(color.getHex());
            setPreview(color.getHex());
        } catch (Exception e) {
        }
    }

    if (sender == tbRed || sender == tbGreen || sender == tbBlue) {
        // Don't allow this value to overflow or underflow
        try {
            if (Integer.parseInt(((TextBox) sender).getText()) > 255) {
                ((TextBox) sender).setText("255");
            }
            if (Integer.parseInt(((TextBox) sender).getText()) < 0) {
                ((TextBox) sender).setText("0");
            }
        } catch (Exception e) {
        }

        red = Integer.parseInt(tbRed.getText());
        green = Integer.parseInt(tbGreen.getText());
        blue = Integer.parseInt(tbBlue.getText());
        hue = Integer.parseInt(tbHue.getText());
        saturation = Integer.parseInt(tbSaturation.getText());
        brightness = Integer.parseInt(tbBrightness.getText());

        // Figure out the colors
        try {
            Color color = new Color();
            color.setRGB(red, green, blue);
            tbHue.setText(Integer.toString(color.getHue()));
            tbSaturation.setText(Integer.toString(color.getSaturation()));
            tbBrightness.setText(Integer.toString(color.getValue()));
            tbHexColor.setText(color.getHex());
            setPreview(color.getHex());
        } catch (Exception e) {
        }
    } else if (sender == tbHue || sender == tbSaturation || sender == tbBrightness) {
        // Don't allow this value to overflow
        try {
            if (Integer.parseInt(tbHue.getText()) > 359) {
                tbHue.setText("359");
            }

            if (Integer.parseInt(tbSaturation.getText()) > 100) {
                tbSaturation.setText("100");
            }

            if (Integer.parseInt(tbBrightness.getText()) > 100) {
                tbBrightness.setText("100");
            }
        } catch (Exception e) {
        }

        red = Integer.parseInt(tbRed.getText());
        green = Integer.parseInt(tbGreen.getText());
        blue = Integer.parseInt(tbBlue.getText());
        hue = Integer.parseInt(tbHue.getText());
        saturation = Integer.parseInt(tbSaturation.getText());
        brightness = Integer.parseInt(tbBrightness.getText());

        // Figure out colors
        try {
            Color color = new Color();
            color.setHSV(hue, saturation, brightness);
            tbRed.setText(Integer.toString(color.getRed()));
            tbGreen.setText(Integer.toString(color.getGreen()));
            tbBlue.setText(Integer.toString(color.getBlue()));
            tbHexColor.setText(color.getHex());
            setPreview(color.getHex());
        } catch (Exception e) {
        }
    }

    // Let the sliders know something's changed
    updateSliders();

    ChangeEvent.fireNativeEvent(Document.get().createChangeEvent(), this);
}

From source file:at.ait.dme.yuma.client.image.StandardImageComposite.java

License:EUPL

/**
 * called by the load listener to initialize the widget after the image was
 * loaded./* w  w  w  .j  a  v a 2  s.  c om*/
 * 
 * @see ImageComposite.LoadListener
 */
private void init() {
    originalImageHeight = image.getHeight();
    originalImageWidth = image.getWidth();

    // make the image fit the screen in case it's larger
    makeImageFitToScreen();

    DOM.setStyleAttribute(imagePanel.getElement(), "border", "1px solid gray");
    DOM.setStyleAttribute(imagePanel.getElement(), "backgroundColor", "#d3d3d3");

    // make the image draggable
    PickupDragController pickupDragController = new PickupDragController(imagePanel, false);
    pickupDragController.setBehaviorConstrainedToBoundaryPanel(false);
    pickupDragController.makeDraggable(image);
    pickupDragController.registerDropController(new TolerantAbsolutePositionDropController(imagePanel) {
        public void onDrop(DragContext context) {
            super.onDrop(context);

            imageRect.setLeft(image.getAbsoluteLeft() - IMAGE_OFFSET_LEFT);
            imageRect.setTop(image.getAbsoluteTop() - IMAGE_OFFSET_TOP);

            // redraw the fragments
            Collection<ImageAnnotation> annotations = new ArrayList<ImageAnnotation>();
            annotations.addAll(fragmentPanels.keySet());
            for (ImageAnnotation annotation : annotations) {
                showFragment(annotation);
            }
        }
    });

    // add the zoom icons and ensure they are always on top
    imagePanel.add(zoomIn, 5, 5);
    zoomIn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            zoom(true);
        }
    });
    imagePanel.add(zoomOut, 5, 25);
    zoomOut.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            zoom(false);
        }
    });
    DOM.setStyleAttribute(zoomIn.getElement(), "zIndex", "15");
    DOM.setStyleAttribute(zoomOut.getElement(), "zIndex", "15");

    // add the fragment icon and ensure its on top
    imagePanel.add(fragment, 5, 55);
    fragment.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            showActiveFragmentPanel(null, false);
        }
    });
    DOM.setStyleAttribute(fragment.getElement(), "zIndex", "15");

    LoadEvent.fireNativeEvent(Document.get().createLoadEvent(), this);
}

From source file:at.ait.dme.yuma.client.image.StandardImageComposite.java

License:EUPL

/**
 * @see HasLoadHandlers/* w  w  w  .j  a  v  a 2  s .co  m*/
 */
@Override
public HandlerRegistration addLoadHandler(LoadHandler loadHandler) {
    if (loadHandler == null)
        return null;

    HandlerRegistration hr = addHandler(loadHandler, LoadEvent.getType());

    if (imageRect != null) {
        LoadEvent.fireNativeEvent(Document.get().createLoadEvent(), this);
    }

    return hr;
}

From source file:at.ait.dme.yuma.client.map.TiledImageComposite.java

License:EUPL

public void init(final Tileset ts) {
    loadMask.hide();//from   ww w.j av  a2  s.  c om
    this.xExtent = ts.getWidth();
    this.yExtent = ts.getHeight();

    panel.add(createMap(ts));

    LoadEvent.fireNativeEvent(Document.get().createLoadEvent(), this);
}