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

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

Introduction

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

Prototype

@Override
    public boolean getPropertyBoolean(String name) 

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   ww w.  j a v a  2  s.com*/
                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  .ja va  2s.c om
    if (isFocused(element)) {
        super.setSelectionRange(element, pos, length);
    } else {
        element.setPropertyInt(CURSOR_POS, pos);
        element.setPropertyInt(SELECTION_LENGTH, length);
    }
}