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

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

Introduction

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

Prototype

public void setFloat(Float value) 

Source Link

Usage

From source file:com.cgxlib.xq.client.css.FloatProperty.java

License:Apache License

@Override
protected void set(Style s, Float value) {
    s.setFloat(value);
}

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 .  jav a  2s.  c om*/
        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 {//from w  w  w .  ja  v a 2  s.c o  m
            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 horizontalLine(int margin) {
    SimplePanel spacer = new SimplePanel();
    Style style = spacer.getElement().getStyle();
    style.setFloat(Float.LEFT);
    style.setWidth(1, Unit.PX);/*  www . java 2 s  . c o m*/
    style.setHeight(100, Unit.PCT);
    style.setBackgroundColor("#999999");
    style.setMarginLeft(margin, Unit.PX);
    style.setMarginRight(margin, Unit.PX);
    return spacer;
}

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

License:Open Source License

public void setBreadcrumb(List<? extends AEntity> entities) {
    breadcrumb.clear();//  w w  w .j  a  v  a2s  .c  o m
    boolean first = true;
    for (AEntity entity : entities) {
        if (first) {
            first = false;
        } else {
            Label separator = new Label(" > ");
            Style style = separator.getElement().getStyle();
            style.setFloat(Float.LEFT);
            breadcrumb.add(separator);
        }
        breadcrumb.add(createBreadcrumbLink(entity));
    }
}

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

License:Open Source License

private Widget createBreadcrumbLink(AEntity entity) {
    String text;//from  ww  w.  j a va2 s  .  c o m
    try {
        text = breadcrumbResolver.getBreadcrumbText(entity);
    } catch (Exception ex) {
        log.error(ex);
        text = entity.getId();
    }

    Hyperlink link = new Hyperlink(text, AGwtApplication.get().getTokenForEntityActivity(entity));
    Style style = link.getElement().getStyle();
    style.setFloat(Float.LEFT);
    return link;
}

From source file:org.clevermore.monitor.client.AbstractEntryPoint.java

License:Apache License

/**
 * This is the entry point method./*  w  ww.  j  a  v  a  2  s.  c o m*/
 */
public void onModuleLoad() {
    Log.debug("Starting monitoring client.");

    Window.setMargin("0px");
    RootPanel.get().clear();
    RootPanel.get().add(loginWidget);

    refreshImg.getElement().setAttribute("state", "1");
    alertImg.getElement().setAttribute("state", "1");

    refreshImg.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            String attribute = refreshImg.getElement().getAttribute("state");
            if ("1".equals(attribute)) {
                refreshImg.getElement().setAttribute("state", "2");
                refresh = false;
                refreshImg.setResource(resources.continueRefresh());
                refreshImg.setTitle("Start Refresh");
                for (IMonitoringWidget widget : widgets) {
                    widget.setRefresh(false);
                }

            } else {
                refreshImg.getElement().setAttribute("state", "1");
                refresh = true;
                refresh();
                refreshImg.setTitle("Stop Refresh");
                refreshImg.setResource(resources.stopRefresh());
            }

        }
    });

    alertImg.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            String attribute = alertImg.getElement().getAttribute("state");
            alertButtonClicked(attribute, 0);
            alertsService.stopAlerts("2".equals(attribute), new AsyncCallback<Boolean>() {

                @Override
                public void onSuccess(Boolean result) {

                }

                @Override
                public void onFailure(Throwable caught) {
                    Window.alert(caught.getMessage());
                }
            });
        }
    });
    mainHeader.setStyleName("mainHeader");
    Style style = refProg.getElement().getStyle();
    style.setWidth(20, Unit.PX);
    style.setFloat(Float.LEFT);
    mainHeader.add(refProg);
    refreshImg.addStyleName("settings");
    refreshImg.setTitle("Stop Refresh");
    mainHeader.add(refreshImg);
    alertImg.addStyleName("settings");
    mainHeader.add(alertImg);

    Image settings = new Image(resources.settingsSmall());
    settings.addStyleName("settings");
    settings.setTitle("Settings");
    settings.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            SettingsPopup sp = new SettingsPopup(service);
            sp.center();
        }
    });
    mainHeader.add(settings);
    Image logout = new Image(resources.logout());
    logout.addStyleName("settings");
    logout.setTitle("Logout");
    logout.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            service.logout(new AsyncCallback<Void>() {

                @Override
                public void onSuccess(Void result) {
                    closeClient();
                }

                @Override
                public void onFailure(Throwable caught) {
                    closeClient();
                }
            });
        }
    });
    mainHeader.add(logout);

    mainHeader.add(mainHeaderLabel);
    mainPanel.add(mainHeader);
}

From source file:org.clevermore.monitor.client.widgets.AbstractMonitoringWidget.java

License:Apache License

@Override
protected void onAttach() {
    super.onAttach();
    Timer t = new Timer() {

        @Override//from w w  w  . j  a va  2 s . co m
        public void run() {
            Log.debug("Monitoring widget attached:" + name);
            try {
                Style style = getElement().getStyle();
                int absoluteLeft = getAbsoluteLeft();
                if (absoluteLeft < Window.getClientWidth() / 2) {
                    style.setFloat(Float.LEFT);
                    Log.debug("Monitoring widget:" + name + " floating to left:" + absoluteLeft);
                } else {
                    style.setWidth(50, Unit.PCT);
                    style.setFloat(Float.RIGHT);
                    Log.debug("Monitoring widget:" + name + " floating to right:" + absoluteLeft);
                }
            } catch (Exception e) {
                Log.error(e.getMessage(), e);
            }

        }
    };

    t.schedule(1000);

}

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

License:Apache License

public FieldSetPanel() {
    super();//from  w  w  w  .ja  va 2s.com
    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.opencms.gwt.client.ui.CmsPreviewDialog.java

License:Open Source License

/**
 * Initializes the locale selector if needed.<p>
 *
 * @param previewInfo the preview info// www. j  a  va 2 s .  c om
 */
private void initLocales(CmsPreviewInfo previewInfo) {

    if (m_localeSelect != null) {
        removeButton(m_localeSelect);
        m_localeSelect = null;
    }
    if (previewInfo.hasAdditionalLocales()) {
        m_localeSelect = new CmsSelectBox(previewInfo.getLocales());
        m_localeSelect.setFormValueAsString(previewInfo.getLocale());
        m_localeSelect.addValueChangeHandler(new ValueChangeHandler<String>() {

            public void onValueChange(ValueChangeEvent<String> event) {

                loadOtherLocale(event.getValue());
            }
        });
        Style style = m_localeSelect.getElement().getStyle();
        style.setWidth(SELECTBOX_WIDTH, Unit.PX);
        style.setFloat(com.google.gwt.dom.client.Style.Float.LEFT);
        style.setMargin(0, Unit.PX);
        m_localeSelect.truncate(TRUNCATION_PREFIX, SELECTBOX_WIDTH - 20);
        addButton(m_localeSelect);

    }
}