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

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

Introduction

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

Prototype

public void setBorderWidth(double value, Unit unit) 

Source Link

Usage

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();//from w  w w .  j  a v a 2 s  .co  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);
    }
}

From source file:jetbrains.jetpad.cell.toDom.BaseCellMapper.java

License:Apache License

private void applyStyle(boolean selected, boolean focusHighlighted, Color background) {
    updateCssStyle(CSS.selected(), (focusHighlighted && !isLeaf()) || selected);
    updateCssStyle(CSS.paired(), getSource().get(Cell.PAIR_HIGHLIGHTED));

    String backgroundColor = null;
    if (isLeaf() && focusHighlighted) {
        backgroundColor = CSS.currentHighlightColor();
    } else if (background != null) {
        backgroundColor = background.toCssColor();
    }//w w  w .  j  a  v a 2  s  . com
    String underline = getSource().get(Cell.RED_UNDERLINE) ? CSS.redUnderline()
            : (getSource().get(Cell.YELLOW_UNDERLINE) ? CSS.yellowUnderline() : null);
    applyBackground(backgroundColor, underline);

    Style style = getTarget().getStyle();
    Color borderColor = getSource().get(Cell.BORDER_COLOR);
    style.setBorderStyle(borderColor == null ? Style.BorderStyle.NONE : Style.BorderStyle.SOLID);
    style.setBorderWidth(borderColor == null ? 0 : 1, Style.Unit.PX);
    style.setBorderColor(borderColor == null ? null : borderColor.toCssColor());

    updateCssStyle(CSS.hidden(), !getSource().get(Cell.VISIBLE));
    updateCssStyle(CSS.hasShadow(), getSource().get(Cell.HAS_SHADOW));
}

From source file:org.eclipse.che.ide.ui.smartTree.SpeedSearch.java

License:Open Source License

private void initSearchPopUp() {
    this.searchPopUp = new SearchPopUp();
    Style style = this.searchPopUp.getElement().getStyle();

    style.setBackgroundColor("grey");
    style.setBorderStyle(Style.BorderStyle.SOLID);
    style.setBorderColor("#dbdbdb");
    style.setBorderWidth(1, Style.Unit.PX);
    style.setPadding(2, Style.Unit.PX);
    style.setPosition(Style.Position.FIXED);
    style.setTop(100, Style.Unit.PX);
    style.setLeft(20, Style.Unit.PX);
}

From source file:org.eclipse.che.ide.ui.smartTree.Tree.java

License:Open Source License

private void ensureFocusElement() {
    if (focusEl != null) {
        focusEl.removeFromParent();/* ww w.  j  a  va 2  s .  com*/
    }
    focusEl = getElement().appendChild(focusImpl.createFocusable());
    focusEl.addClassName(treeStyles.styles().noFocusOutline());
    if (focusEl.hasChildNodes()) {
        focusEl.getFirstChildElement().addClassName(treeStyles.styles().noFocusOutline());
        Style focusElStyle = focusEl.getFirstChildElement().getStyle();
        focusElStyle.setBorderWidth(0, Style.Unit.PX);
        focusElStyle.setFontSize(1, Style.Unit.PX);
        focusElStyle.setPropertyPx("lineHeight", 1);
    }
    focusEl.getStyle().setLeft(0, Style.Unit.PX);
    focusEl.getStyle().setTop(0, Style.Unit.PX);
    focusEl.getStyle().setPosition(Style.Position.ABSOLUTE);

    //subscribe for Event.FOCUSEVENTS
    int bits = DOM.getEventsSunk((Element) focusEl.cast()); //do not remove redundant cast, GWT tests will fail
    DOM.sinkEvents((Element) focusEl.cast(), bits | Event.FOCUSEVENTS);
}

From source file:org.jbpm.form.builder.ng.model.common.panels.FieldSetPanel.java

License:Apache License

public FieldSetPanel() {
    super();//  w  ww.j a va2 s.co m
    Style divStyle = getElement().getStyle();
    Style lgndStyle = legend.getStyle();

    divStyle.setBorderWidth(2, Unit.PX);
    divStyle.setBorderStyle(BorderStyle.SOLID);
    divStyle.setMarginTop(0.5, Unit.EM);
    divStyle.setMarginBottom(0.5, Unit.EM);
    divStyle.setMarginRight(0, Unit.PX);
    divStyle.setMarginLeft(0, Unit.PX);
    divStyle.setPaddingTop(0, Unit.PX);
    divStyle.setPaddingBottom(0, Unit.PX);
    divStyle.setPaddingRight(0.5, Unit.EM);
    divStyle.setPaddingLeft(0.5, Unit.EM);

    lgndStyle.setFontSize(100.0, Unit.PCT);
    lgndStyle.setFontWeight(FontWeight.NORMAL);
    lgndStyle.setMarginTop(-0.5, Unit.EM);
    lgndStyle.setMarginRight(0, Unit.PX);
    lgndStyle.setMarginLeft(0, Unit.PX);
    lgndStyle.setMarginBottom(0, Unit.PX);
    lgndStyle.setBackgroundColor("white");
    lgndStyle.setColor("black");
    lgndStyle.setFloat(Style.Float.LEFT);
    lgndStyle.setPaddingTop(0, Unit.PX);
    lgndStyle.setPaddingBottom(0, Unit.PX);
    lgndStyle.setPaddingRight(2, Unit.PX);
    lgndStyle.setPaddingLeft(2, Unit.PX);

    getElement().appendChild(legend);
}

From source file:org.komodo.web.client.panels.vdb.VdbEditPanel.java

License:Apache License

private ScrollPanel createDiagramPanel() {
    ScrollPanel scroller = new ScrollPanel(editor);
    editor.addSelectionHandler(this);

    scroller.setTitle(VDB_EDIT_DIAG_SCROLLPANEL);
    scroller.setWidth(DIAGRAM_PANEL_WIDTH + Unit.EM.getType());
    scroller.setHeight(EDIT_PANEL_HEIGHT + Unit.EM.getType());

    Style style = scroller.getElement().getStyle();
    style.setBorderWidth(BORDER_WIDTH, Unit.EM);
    style.setBorderStyle(BorderStyle.SOLID);

    return scroller;
}

From source file:org.nsesa.editor.gwt.core.client.ui.document.sourcefile.marker.MarkerViewImpl.java

License:EUPL

@Override
public FocusWidget addMarker(final double top, final String color) {

    int height = getOffsetHeight();

    double v = height * top;

    LOG.info("Drawing marker at " + (int) v);

    Anchor marker = new Anchor("<div></div>", true);
    mainPanel.add(marker);/*www .j av  a  2s .com*/
    final Style style = marker.getElement().getFirstChildElement().getStyle();
    style.setPosition(Style.Position.ABSOLUTE);
    style.setTop((int) v, Style.Unit.PX);
    style.setWidth(100, Style.Unit.PCT);
    style.setHeight(5, Style.Unit.PX);
    style.setBorderWidth(1.0, Style.Unit.PX);
    style.setBackgroundColor(color);
    return marker;

}

From source file:org.opencms.gwt.client.util.CmsDebugLog.java

License:Open Source License

/**
 * Constructor.<p>/*ww w  .j a  v a 2  s . c  om*/
 */
@SuppressWarnings("unused")
private CmsDebugLog() {

    if (!DEBUG) {
        return;
    }
    m_html = new HTML();
    initWidget(m_html);
    Style style = getElement().getStyle();
    style.setWidth(200, Unit.PX);
    style.setHeight(500, Unit.PX);
    style.setPadding(10, Unit.PX);
    style.setOverflow(Overflow.AUTO);
    style.setBorderStyle(BorderStyle.SOLID);
    style.setBorderColor(I_CmsLayoutBundle.INSTANCE.constants().css().borderColor());
    style.setBorderWidth(1, Unit.PX);
    style.setPosition(Position.FIXED);
    style.setTop(50, Unit.PX);
    style.setRight(50, Unit.PX);
    style.setBackgroundColor(I_CmsLayoutBundle.INSTANCE.constants().css().backgroundColorDialog());
    style.setZIndex(10);
}

From source file:org.rstudio.studio.client.workbench.prefs.views.AceEditorPreview.java

License:Open Source License

public AceEditorPreview(String code) {
    code_ = code;//w ww.  j av  a2s . c  o m
    Style style = getStyleElement().getStyle();
    style.setBorderColor("#CCC");
    style.setBorderWidth(1, Unit.PX);
    style.setBorderStyle(BorderStyle.SOLID);
}

From source file:org.rstudio.studio.client.workbench.views.vcs.ConsoleProgressDialog.java

License:Open Source License

public ConsoleProgressDialog(String title, ConsoleProcess consoleProcess) {
    consoleProcess_ = consoleProcess;/*from w  ww .  jav a  2  s . c  o m*/

    setText(title);

    registrations_ = new HandlerRegistrations();
    registrations_.add(consoleProcess.addConsoleOutputHandler(this));
    registrations_.add(consoleProcess.addProcessExitHandler(this));

    output_ = new PreWidget();
    output_.getElement().getStyle().setMargin(0, Unit.PX);
    output_.getElement().getStyle().setFontSize(11, Unit.PX);

    scrollPanel_ = new BottomScrollPanel(output_);
    scrollPanel_.setSize("640px", "200px");

    Style style = scrollPanel_.getElement().getStyle();
    style.setBackgroundColor("white");
    style.setBorderStyle(BorderStyle.SOLID);
    style.setBorderColor("#BBB");
    style.setBorderWidth(1, Style.Unit.PX);
    style.setMargin(0, Unit.PX);
    style.setMarginBottom(3, Unit.PX);
    style.setPadding(4, Unit.PX);

    status_ = new Label("The process is executing...");

    button_ = new ThemedButton("Stop", this);
    addOkButton(button_);

    consoleProcess.start(new SimpleRequestCallback<Void>() {
        @Override
        public void onError(ServerError error) {
            // Show error and stop
            super.onError(error);
            closeDialog();
        }
    });
}