Example usage for com.google.gwt.user.client Element setPropertyBoolean

List of usage examples for com.google.gwt.user.client Element setPropertyBoolean

Introduction

In this page you can find the example usage for com.google.gwt.user.client Element setPropertyBoolean.

Prototype

@Override
    public void setPropertyBoolean(String name, boolean value) 

Source Link

Usage

From source file:com.eduworks.russel.ui.client.pagebuilder.screen.PermissionScreen.java

License:Apache License

private void fillServicePermissions(JSONObject servicePermissions) {
    for (final String key : servicePermissions.keySet()) {
        String parentName = key.substring(0, 1).toUpperCase() + key.substring(1);
        Element e = DOM.getElementById("permission" + parentName);
        JSONArray permissions = JSONUtils.sort(servicePermissions.get(key).isArray());
        for (int i = 0; i < permissions.size(); i++) {
            final String permission = permissions.get(i).isString().stringValue();
            Element d = DOM.createDiv();
            Element l = DOM.createLabel();
            l.setInnerText(permission.replaceAll("_", " "));
            final Element c = DOM.createInputCheck();
            PageAssembler.attachHandler(c, Event.ONCHANGE, new EventCallback() {
                @Override//from   www.  j  a v a  2s .  c o m
                public void onEvent(Event event) {
                    String destinationType = DOM.getElementById(DESTINATION_ENTITY_TYPE)
                            .getPropertyString("value");
                    if (!c.getPropertyBoolean("checked")) {
                        RusselApi.removePermission(permission, !type.equals(TYPE_RESOURCE) ? source
                                : destinationType.equalsIgnoreCase("service") ? key
                                        : DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value"),
                                !type.equals(TYPE_RESOURCE) ? type : destinationType,
                                !type.equals(TYPE_RESOURCE) ? destinationType.equalsIgnoreCase("service") ? key
                                        : DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value")
                                        : source,
                                !type.equals(TYPE_RESOURCE) ? destinationType : type,
                                new ESBCallback<ESBPacket>() {
                                    @Override
                                    public void onSuccess(ESBPacket esbPacket) {
                                        c.setPropertyBoolean("checked", false);
                                    }

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        c.setPropertyBoolean("checked", true);
                                    }
                                });
                    } else {
                        RusselApi.addPermission(permission, !type.equals(TYPE_RESOURCE) ? source
                                : destinationType.equalsIgnoreCase("service") ? key
                                        : DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value"),
                                !type.equals(TYPE_RESOURCE) ? type : destinationType,
                                !type.equals(TYPE_RESOURCE) ? destinationType.equalsIgnoreCase("service") ? key
                                        : DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value")
                                        : source,
                                !type.equals(TYPE_RESOURCE) ? destinationType : type,
                                new ESBCallback<ESBPacket>() {
                                    @Override
                                    public void onSuccess(ESBPacket esbPacket) {
                                        c.setPropertyBoolean("checked", true);
                                    }

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        c.setPropertyBoolean("checked", false);
                                    }
                                });
                    }
                }
            });
            c.setId(permission + parentName);
            d.appendChild(c);
            d.appendChild(l);
            d.appendChild(createBreak());
            e.appendChild(d);
        }
    }
}

From source file:org.xwiki.gwt.user.client.ui.internal.TextBoxImplIE6.java

License:Open Source License

@Override
public void setSelectionRange(Element element, int pos, int length) {
    if (!element.getPropertyBoolean(SELECTION_PRESERVED)) {
        element.setPropertyBoolean(SELECTION_PRESERVED, true);
        ensureSelectionIsPreserved(element);
    }//from  w w  w . j  av  a  2  s  . c om
    if (isFocused(element)) {
        super.setSelectionRange(element, pos, length);
    } else {
        element.setPropertyInt(CURSOR_POS, pos);
        element.setPropertyInt(SELECTION_LENGTH, length);
    }
}

From source file:rocket.widget.client.CheckBox.java

License:Apache License

/**
 * Checks or unchecks this check box./* w  w w . j av a2s  .c  o  m*/
 * 
 * @param checked
 *            <code>true</code> to check the check box
 */
public void setChecked(final boolean checked) {
    final Element element = this.getElement();
    element.setPropertyBoolean("checked", checked);
    element.setPropertyBoolean("defaultChecked", checked);
}