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

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

Introduction

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

Prototype

public void setColor(String value) 

Source Link

Usage

From source file:com.vaadin.client.metadata.ConnectorBundleLoader.java

License:Apache License

private void notice(String productName) {
    if (notice == null) {
        notice = new HTML();
        notice.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                notice.removeFromParent();
            }//from   w ww. j  ava  2s. c  o m
        });
        notice.addTouchStartHandler(new TouchStartHandler() {
            public void onTouchStart(TouchStartEvent event) {
                notice.removeFromParent();
            }
        });
    }
    String msg = notice.getText().trim();
    msg += msg.isEmpty() ? "Using Evaluation License of: " : ", ";
    notice.setText(msg + productName);
    RootPanel.get().add(notice);

    notice.getElement().setClassName("");
    Style s = notice.getElement().getStyle();

    s.setPosition(Position.FIXED);
    s.setTextAlign(TextAlign.CENTER);
    s.setRight(0, Unit.PX);
    s.setLeft(0, Unit.PX);
    s.setBottom(0, Unit.PX);
    s.setProperty("padding", "0.5em 1em");

    s.setProperty("font-family", "sans-serif");
    s.setFontSize(12, Unit.PX);
    s.setLineHeight(1.1, Unit.EM);

    s.setColor("white");
    s.setBackgroundColor("black");
    s.setOpacity(0.7);

    s.setZIndex(2147483646);
    s.setProperty("top", "auto");
    s.setProperty("width", "auto");
    s.setDisplay(Display.BLOCK);
    s.setWhiteSpace(WhiteSpace.NORMAL);
    s.setVisibility(Visibility.VISIBLE);
    s.setMargin(0, Unit.PX);
}

From source file:com.vaadin.client.SimpleTree.java

License:Apache License

public SimpleTree() {
    setElement(Document.get().createDivElement());
    Style style = getElement().getStyle();
    style.setProperty("whiteSpace", "nowrap");
    style.setPadding(3, Unit.PX);/* ww w.  j  a v a  2  s  . com*/
    style.setPaddingLeft(12, Unit.PX);
    // handle styling
    style = handle.getStyle();
    style.setDisplay(Display.NONE);
    style.setTextAlign(TextAlign.CENTER);
    style.setWidth(0.5, Unit.EM);
    style.setHeight(0.5, Unit.EM);
    style.setCursor(Cursor.POINTER);
    style.setBackgroundColor("gray");
    style.setColor("white");
    style.setPadding(4, Unit.PX);
    style.setMarginRight(3, Unit.PX);
    style.setLineHeight(0.5, Unit.EM);
    handle.setInnerHTML("+");
    getElement().appendChild(handle);
    getElement().appendChild(text);
    // children styling
    style = children.getStyle();
    style.setPaddingLeft(1.5, Unit.EM);
    style.setDisplay(Display.NONE);

    getElement().appendChild(children);
    addDomHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (event.getNativeEvent().getEventTarget().cast() == handle) {
                if (children.getStyle().getDisplay().intern() == Display.NONE.getCssName()) {
                    open(event.getNativeEvent().getAltKey());
                } else {
                    close();
                }

            } else if (event.getNativeEvent().getEventTarget().cast() == text) {
                select(event);
            }
        }
    }, ClickEvent.getType());
}

From source file:cz.filmtit.client.subgestbox.PosteditBox.java

License:Open Source License

public PosteditBox(TimedChunk chunk, TranslationWorkspace workspace, int tabIndex) {
    this.chunk = chunk;
    this.workspace = workspace;
    if (this.workspace == null) {
        Gui.log("workspace for subgestbox is null!!!");
    }/*from   w  w  w  . ja va  2 s .  com*/

    this.subgestBox = null;

    this.setHeight("36px");
    this.setHTML(posteditBoxHTML(""));

    this.addFocusHandler(this.workspace.posteditHandler);
    this.addKeyDownHandler(this.workspace.posteditHandler);
    this.addKeyUpHandler(this.workspace.posteditHandler);
    this.setTabIndex(tabIndex);

    this.addStyleName("posteditwidth");

    final RichTextArea richtext = this;
    richtext.addInitializeHandler(new InitializeHandler() {
        public void onInitialize(InitializeEvent ie) {
            IFrameElement fe = (IFrameElement) richtext.getElement().cast();
            Style s = fe.getContentDocument().getBody().getStyle();
            s.setProperty("fontFamily", "Arial Unicode MS,Arial,sans-serif");
            s.setProperty("fontSize", "small");
            s.setColor("#333");
        }
    });
}

From source file:cz.filmtit.client.subgestbox.SubgestBox.java

License:Open Source License

/**
 * Primary constructor for the SubgestBox.
 *
 * @param chunk - the source chunk of the underlying TranslationResult
 * @param workspace - the TranslationWorkspace in which this SubgestBox
 * operates//  w w  w .j a  va  2 s . c o m
 * @param tabIndex - intended tabIndex within the workspace
 */
public SubgestBox(TimedChunk chunk, TranslationWorkspace workspace, int tabIndex) {
    this.chunk = chunk;
    this.translationResult = new TranslationResult(chunk);
    this.workspace = workspace;
    if (this.workspace == null) {
        Gui.log("workspace for subgestbox is null!!!");
    }

    this.posteditBox = null;

    this.setHeight("36px");
    this.setHTML(subgestBoxHTML(""));

    this.addFocusHandler(this.workspace.subgestHandler);
    this.addKeyDownHandler(this.workspace.subgestHandler);
    this.addKeyUpHandler(this.workspace.subgestHandler);
    this.setTabIndex(tabIndex);

    if (workspace.isPosteditOn()) {
        this.addStyleName("posteditwidth");
    } else {
        this.addStyleName("subgest_fullwidth");
    }

    final RichTextArea richtext = this;
    richtext.addInitializeHandler(new InitializeHandler() {
        public void onInitialize(InitializeEvent ie) {
            IFrameElement fe = (IFrameElement) richtext.getElement().cast();
            Style s = fe.getContentDocument().getBody().getStyle();
            s.setProperty("fontFamily", "Arial Unicode MS,Arial,sans-serif");
            s.setProperty("fontSize", "small");
            s.setColor("#333");
        }
    });

}

From source file:fr.mncc.gwttoolbox.ui.client.Indicator.java

License:Open Source License

public void setMessage(String msg, String bkgColor, String txtColor) {

    label_.setText(msg);//from  w  ww.ja v  a 2s  .  c  o m

    Style labelStyle = label_.getElement().getStyle();
    labelStyle.setFontSize(1.6, Style.Unit.EM);
    labelStyle.setBackgroundColor(bkgColor);
    labelStyle.setColor(txtColor);
    labelStyle.setPadding(5, Style.Unit.PX);
}

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

License:Open Source License

protected void onUpdate() {
    if (sortColumnIndex == -1) {
        sortColumnIndex = getInitialSortColumnIndex();
        reverseSort = isInitialSortReverse();
    }//w  ww  .  j  a  va  2 s.c  om

    Collection<O> objects;
    try {
        objects = getObjects();
    } catch (Exception ex) {
        throw new RuntimeException(Str.getSimpleName(getClass()) + ".getObjects() failed.", ex);
    }

    log.info("Objects loaded:", objects.size());

    int rowIndex = -1;

    if (isColumnTitlesEnabled()) {
        rowIndex++;
        for (AColumn column : columns) {
            String columnTitle;
            try {
                columnTitle = column.getTitle();
            } catch (Exception ex) {
                log.error(ex);
                columnTitle = "ERROR: " + Str.formatException(ex);
            }

            Widget titleWidget = Widgets.textFieldlabel(columnTitle, false);
            if (titleWidget != null && (sortColumnIndex == column.index)) {
                // Sortierte Spalte hervorheben
                Style style = titleWidget.getElement().getStyle();
                style.setColor("#444");
                style.setFontWeight(FontWeight.BOLD);
                if (reverseSort)
                    style.setFontStyle(FontStyle.ITALIC);
            }

            table.setWidget(rowIndex, column.index, Widgets.frame(titleWidget, Widgets.defaultSpacing, 0,
                    Widgets.defaultSpacing, Widgets.defaultSpacing / 2));

            if (isCustomSortingEnabled()) {
                for (int col = 0; col < columns.size(); col++) {
                    table.getCellFormatter().setStyleName(rowIndex, col, "clickable");
                }
            }
        }
    }

    if (isColumnFilteringEnabled()) {
        rowIndex++;
        for (AColumn column : columns) {
            TextBox filterTextbox = column.getFilterWidget();
            SimplePanel frame = Widgets.frame(filterTextbox, Widgets.defaultSpacing);
            table.setWidget(rowIndex, column.index, frame);
        }
    }

    try {
        rows = createRows(objects, rowIndex);
    } catch (Exception ex) {
        throw new RuntimeException(Str.getSimpleName(getClass()) + ".createRows() failed.", ex);
    }
    table.setVisible(!rows.isEmpty());

    for (Row row : rows) {
        appendRow(row);
        rowIndex++;
    }

    for (int i = 0; i < getFootRowCount(); i++) {
        rowIndex++;
        for (AColumn column : columns) {
            table.setWidget(rowIndex, column.index, column.getFootCellWidget(i));
        }
    }

}

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

License:Open Source License

protected Widget createGroupWidget(G group) {
    if (group instanceof String) {
        Label title = Widgets.text(group);
        Style style = title.getElement().getStyle();
        style.setColor("white");
        style.setBackgroundColor(Colors.googleBlue);
        style.setPadding(Widgets.defaultSpacing, Unit.PX);
        return title;
    }//www .  j  a  v a2 s  .  c  om
    return Widgets.widget(group);
}

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 .c o  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.AEditableMultiFieldField.java

License:Open Source License

public Widget createLabelWidget(AEditableField field) {
    String labelText = field.getLabel();
    if (labelText == null)
        labelText = "";

    String html = "<strong>" + Str.toHtml(labelText) + "</strong>";

    String tooltip = field.getTooltip();
    if (!Str.isBlank(tooltip))
        html += " - " + Str.toHtml(tooltip);

    HTML widget = new HTML(html);
    Style style = widget.getElement().getStyle();
    style.setFontSize(65, Unit.PCT);/*from   ww  w.ja va2s .c o  m*/
    style.setColor("#999999");
    return widget;
}

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

License:Open Source License

private void updateStyle(CheckBox checkBox) {
    Style style = checkBox.getElement().getStyle();
    if (checkBox.getValue().booleanValue()) {
        style.setColor("#000");
    } else {/*from w  ww  .  java  2  s.  c  o  m*/
        style.setColor("#666");
    }
}