Example usage for com.google.gwt.safecss.shared SafeStylesUtils forWidth

List of usage examples for com.google.gwt.safecss.shared SafeStylesUtils forWidth

Introduction

In this page you can find the example usage for com.google.gwt.safecss.shared SafeStylesUtils forWidth.

Prototype

public static SafeStyles forWidth(double value, Unit unit) 

Source Link

Document

Set the width css property.

Usage

From source file:org.eclipse.che.ide.jseditor.client.preference.editorselection.EditorSelectionCell.java

License:Open Source License

@Override
public void render(final Context context, final EditorType editorType, final SafeHtmlBuilder sb) {
    // Get the view data.
    final FileType filetype = (FileType) context.getKey();
    String viewData = getViewData(filetype);
    if (viewData != null && viewData.equals(editorType.getEditorTypeKey())) {
        clearViewData(filetype);//from   ww w. j  a  v  a2s  . co  m
        viewData = null;
    }

    int selectedIndex = getIndex(this.editorTypes, viewData, editorType);
    Log.debug(EditorSelectionCell.class, "File type " + filetype + " - found selection " + selectedIndex);
    if (selectedIndex == -1) {
        selectedIndex = getDefaultIndex(this.editorTypes);
        Log.debug(EditorSelectionCell.class, "... using default value " + selectedIndex + " instead.");
    }

    final SafeStyles widthStyle = SafeStylesUtils.forWidth(this.selectWidthValue, this.selectWidthUnit);
    sb.append(template.select(this.stylename, widthStyle));
    int index = 0;
    for (final EditorType option : this.editorTypes) {
        if (index++ == selectedIndex) {
            sb.append(template.selected(option.getEditorTypeKey(), this.editorTypeRegistry.getName(option)));
        } else {
            sb.append(template.deselected(option.getEditorTypeKey(), this.editorTypeRegistry.getName(option)));
        }
    }
    sb.appendHtmlConstant("</select>");
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.FilterTextInputCell.java

License:Apache License

public FilterTextInputCell(double width, Unit widthUnit) {
    super(BrowserEvents.BLUR, BrowserEvents.CHANGE, BrowserEvents.KEYUP, PASTE);
    if (template == null) {
        template = GWT.create(Template.class);
    }//from www .j  ava  2 s.co  m
    if (width > 0) {
        inputStyle = SafeStylesUtils.forWidth(width, widthUnit);
    }
}

From source file:stroom.cell.info.client.SvgCell.java

License:Apache License

@Override
public void render(final Context context, final SvgPreset value, final SafeHtmlBuilder sb) {
    if (value == null) {
        sb.append(SafeHtmlUtils.EMPTY_SAFE_HTML);
    } else {//from  ww w .  j av a 2  s.co m
        final SafeStylesBuilder builder = new SafeStylesBuilder();
        builder.append(SafeStylesUtils.forWidth(value.getWidth(), Unit.PX));
        builder.append(SafeStylesUtils.forHeight(value.getHeight(), Unit.PX));

        String className = resources.style().icon();
        if (!value.isEnabled()) {
            className += " " + resources.style().disabled();
        }

        sb.append(template.icon(className, builder.toSafeStyles(), UriUtils.fromString(value.getUrl())));
    }
}