Example usage for com.google.gwt.dom.client Style setProperty

List of usage examples for com.google.gwt.dom.client Style setProperty

Introduction

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

Prototype

public void setProperty(String name, String value) 

Source Link

Usage

From source file:ilarkesto.gwt.client.desktop.fields.AEditableDropdownField.java

License:Open Source License

private RadioButton createRadioButton(boolean horizontal, String key, String label) {
    RadioButton radioButton = new RadioButton(getId(), label);
    radioButton.getElement().setId(getId() + "_radiobutton_");

    radioButton.setValue(isSelectedOptionKey(key));

    if (getEditVetoMessage() != null) {
        radioButton.setEnabled(false);/* w w w  .  j  a v  a  2 s .  co  m*/
        radioButton.setTitle(getEditVetoMessage());
    }

    Style style = radioButton.getElement().getStyle();
    style.setProperty("minWidth", "100px");
    style.setProperty("minHeight", "32px");
    style.setDisplay(Display.BLOCK);
    style.setFloat(com.google.gwt.dom.client.Style.Float.LEFT);
    style.setWidth(horizontal ? getTextBoxWidth() / 2 : getTextBoxWidth(), Unit.PX);
    style.setMarginRight(Widgets.defaultSpacing, Unit.PX);
    if (NULL_KEY.equals(key)) {
        style.setColor(Colors.greyedText);
    }

    if (!isParentMultiField()) {
        radioButton.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                if (fieldEditorDialogBox == null)
                    return;
                fieldEditorDialogBox.submit();
            }
        });
    }
    radioButtons.put(key, radioButton);
    return radioButton;
}

From source file:ilarkesto.gwt.client.desktop.fields.AEditableMultiSelectionField.java

License:Open Source License

private IsWidget createCheckboxesEditorWidget(Collection<String> optionKeys) {
    checkboxes = new LinkedHashMap<String, CheckBox>();

    boolean horizontal = isHorizontal();
    Panel panel = horizontal ? new FlowPanel() : new VerticalPanel();

    Collection<String> selectedKeys = getSelectedOptionKeys();

    int inRow = 0;

    for (String key : optionKeys) {
        String label = getTextForOption(getValueForKey(key));
        CheckBox checkBox = new CheckBox(label);
        checkBox.getElement().setId(getId() + "_checkbox_" + key);
        checkBox.setValue(selectedKeys.contains(key));
        if (getEditVetoMessage() == null) {
        } else {// w ww  .  ja v a 2  s.  c  om
            checkBox.setEnabled(false);
            checkBox.setTitle(getEditVetoMessage());
        }
        updateStyle(checkBox);
        checkBox.addValueChangeHandler(new CheckboxChangeHandler(checkBox));
        if (horizontal) {
            Style style = checkBox.getElement().getStyle();
            style.setProperty("minWidth", "100px");
            style.setDisplay(Display.BLOCK);
            style.setFloat(com.google.gwt.dom.client.Style.Float.LEFT);
            style.setWidth(220, Unit.PX);
            style.setMarginRight(Widgets.defaultSpacing, Unit.PX);
        }
        checkboxes.put(key, checkBox);
        panel.add(checkBox);
        inRow++;
        if (horizontal && inRow >= 3) {
            panel.add(new HTML("<br>"));
            inRow = 0;
        }
    }
    if (horizontal) {
        panel.add(Widgets.clear());
    }

    if (optionKeys.size() >= 10) {
        panel.add(new ActionButton(new SelectAllCheckboxesAction()));
        panel.add(new ActionButton(new DeselectAllCheckboxesAction()));
    }

    return panel;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget scrollerY(IsWidget content) {
    SimplePanel panel = new SimplePanel(content.asWidget());
    Style style = panel.getElement().getStyle();
    style.setProperty("width", "auto");
    style.setOverflowX(Overflow.HIDDEN);
    style.setOverflowY(Overflow.SCROLL);
    return panel;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget scroller(IsWidget content) {
    SimplePanel panel = new SimplePanel(content.asWidget());
    Style style = panel.getElement().getStyle();
    style.setProperty("width", "auto");
    style.setOverflowX(Overflow.HIDDEN);
    style.setOverflowY(Overflow.SCROLL);
    return panel;
}

From source file:info.magnolia.ui.vaadin.gwt.client.applauncher.widget.AppTileWidget.java

License:Open Source License

/**
 * Set the tile colors for the Off state, not active, not clicked.
 */// w ww. j  a  va2s .co  m
private void setColorsOff() {
    final Style style = getElement().getStyle();
    style.setProperty("backgroundColor", "");
    style.setProperty("color", "");
}

From source file:info.magnolia.ui.vaadin.gwt.client.icon.widget.IconWidget.java

License:Open Source License

private void initDefaultStyles() {
    Style style = root.getStyle();
    style.setFontSize(SIZE_DEFAULT, Unit.PX);
    style.setProperty("lineHeight", "1");
}

From source file:info.magnolia.ui.vaadin.gwt.client.layout.thumbnaillayout.widget.ThumbnailsSizeKeeper.java

License:Open Source License

private void doSetThumbnailSize(int width, int height, Element element) {
    final Style style = element.getStyle();
    style.setFontSize(width * 0.75d, Style.Unit.PX);
    style.setWidth(width, Style.Unit.PX);
    style.setHeight(height, Style.Unit.PX);

    Style imageStyle = element.getElementsByTagName(ImageElement.TAG).getItem(0).getStyle();
    imageStyle.setProperty("maxWidth", width + "px");
    imageStyle.setProperty("maxHeight", height + "px");
}

From source file:info.magnolia.ui.vaadin.gwt.client.tabsheet.widget.MagnoliaTabSheetViewImpl.java

License:Open Source License

private void animateHeightChange(MagnoliaTabWidget newActiveTab) {
    final Style tabPanelStyle = tabPanel.getElement().getStyle();
    int offsetTabHeight = tabPanel.getOffsetHeight();
    tabPanelStyle.clearHeight();//  w ww. j a  v  a  2s.c  o  m
    int newHeight = newActiveTab.getOffsetHeight();
    final String heightPropertyCC = offsetTabHeight < newHeight ? "maxHeight" : "minHeight";
    final String heightProperty = offsetTabHeight < newHeight ? "max-height" : "min-height";

    final JQueryAnimation animation = new JQueryAnimation();
    tabPanelStyle.setProperty(heightPropertyCC, offsetTabHeight + "px");
    animation.setProperty(heightProperty, newHeight);
    tabPanelStyle.setOverflow(Style.Overflow.HIDDEN);
    animation.addCallback(new JQueryCallback() {
        @Override
        public void execute(JQueryWrapper query) {
            tabPanelStyle.clearOverflow();
            tabPanelStyle.clearProperty(heightPropertyCC);
        }
    });
    animation.run(HEIGHT_CHANGE_ANIMATION_DURATION, tabPanel.getElement());
}

From source file:info.magnolia.ui.vaadin.gwt.client.tabsheet.widget.MagnoliaTabSheetViewImpl.java

License:Open Source License

@Override
public void setMaxHeight(int height) {
    int tabBarHeight = getOffsetHeight() - scroller.getOffsetHeight();
    height -= tabBarHeight;//from   ww w  .ja va2s .  com
    final Style scrollerStyle = scroller.getElement().getStyle();
    ;
    scrollerStyle.setPosition(Position.ABSOLUTE);
    scrollerStyle.setOverflow(Style.Overflow.AUTO);
    scrollerStyle.setProperty("zoom", "1");
    scrollerStyle.setProperty("maxHeight", height + "px");
}

From source file:jake2.gwt.client.GwtQuake.java

License:Open Source License

public void onModuleLoad() {
    // Initialize drivers.
    Document doc = Document.get();
    doc.setTitle("GWT Quake II");
    BodyElement body = doc.getBody();// w w  w  . j a  v a  2s  . c  o  m
    Style style = body.getStyle();
    style.setPadding(0, Unit.PX);
    style.setMargin(0, Unit.PX);
    style.setBorderWidth(0, Unit.PX);
    style.setProperty("height", "100%");
    style.setBackgroundColor("#000");
    style.setColor("#888");

    boolean wireframe = ("" + Window.Location.getHash()).indexOf("wireframe") != -1;

    canvas = (CanvasElement) doc.createElement("canvas");
    video = doc.createElement("video");

    w = Window.getClientWidth();
    h = Window.getClientHeight();
    canvas.setWidth(w);
    canvas.setHeight(h);
    style = canvas.getStyle();
    style.setProperty("height", "100%");
    style.setProperty("width", "100%");

    style = video.getStyle();
    style.setProperty("height", "100%");
    style.setProperty("width", "100%");
    style.setProperty("display", "none");

    body.appendChild(canvas);
    body.appendChild(video);

    try {
        final refexport_t renderer = wireframe ? new GwtWireframeGLRenderer(canvas)
                : new GwtWebGLRenderer(canvas, video);
        Globals.re = renderer;

        ResourceLoader.impl = new GwtResourceLoaderImpl();
        Compatibility.impl = new CompatibilityImpl();

        S.impl = new GwtSound();
        NET.socketFactory = new WebSocketFactoryImpl();
        //      Sys.impl = new Sys.SysImpl() {
        //        public void exit(int status) {
        //          Window.alert("Something's rotten in Denmark");
        //          Window.Location.assign("gameover.html");
        //        }
        //      };

        // Flags.
        Qcommon.Init(new String[] { "GQuake" });

        // Enable stdout.
        Globals.nostdout = Cvar.Get("nostdout", "0", 0);

        Window.addResizeHandler(new ResizeHandler() {

            public void onResize(ResizeEvent event) {
                if (Window.getClientWidth() == w && Window.getClientHeight() == h) {
                    return;
                }

                w = Window.getClientWidth();
                h = Window.getClientHeight();

                renderer.GLimp_SetMode(new Dimension(w, h), 0, false);
            }
        });

        //      QuakeServer.main(new String[0], new DummySNetImpl(), false);

        timer = new Timer() {
            double startTime = Duration.currentTimeMillis();

            @Override
            public void run() {
                try {
                    double curTime = Duration.currentTimeMillis();
                    boolean pumping = ResourceLoader.Pump();
                    if (pumping) {
                        SCR.UpdateScreen2();
                    } else {
                        int dt = (int) (curTime - startTime);
                        GwtKBD.Frame(dt);
                        Qcommon.Frame(dt);
                    }
                    startTime = curTime;
                    timer.schedule(ResourceLoader.Pump() ? LOADING_DELAY : INTER_FRAME_DELAY);
                } catch (Exception e) {
                    Compatibility.printStackTrace(e);
                }
            }
        };
        timer.schedule(INTER_FRAME_DELAY);
    } catch (Exception e) {
        Compatibility.printStackTrace(e);
        body.setInnerHTML(NO_WEBGL_MESSAGE);
    }
}