Example usage for com.google.gwt.user.client.ui HTML HTML

List of usage examples for com.google.gwt.user.client.ui HTML HTML

Introduction

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

Prototype

protected HTML(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

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

License:Apache License

protected HTML template() {
    return new HTML(templates().getResultsPanel().getText());
}

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

License:Apache License

public void display() {
    PageAssembler.ready(new HTML(Russel.htmlTemplates.getResultsPanel().getText()));
    PageAssembler.buildContents();//from   w  ww .ja v  a2s  .  c  om
    PageAssembler.inject("flowContainer", "x", new HTML(Russel.htmlTemplates.getDetailModal().getText()), true);
    PageAssembler.inject("objDetailPanelWidget", "x", new HTML(Russel.htmlTemplates.getDetailPanel().getText()),
            true);

    sh.hookAndClear("r-menuSearchBar", "searchPanelWidgetScroll", searchType);

    PageAssembler.attachHandler("r-menuSearchBar", Event.ONKEYUP, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            generateQuery();
        }
    });

    if (searchType.equals(SearchHandler.SOURCE_LEARNING_REGISTRY)) {
        pageTitle = "Learning Registry Resources";
        DOM.getElementById("searchOptions").removeClassName("hidden");
        DOM.getElementById("filterOptions").addClassName("hidden");
        DOM.getElementById("r-objectEditSelected").addClassName("hidden");
        DOM.getElementById("resultsSearchSourceLR").setAttribute("selected", "selected");
    } else {
        pageTitle = "Search Results";
        DOM.getElementById("searchOptions").removeClassName("hidden");
        DOM.getElementById("filterOptions").removeClassName("hidden");
        DOM.getElementById("r-objectEditSelected").removeClassName("hidden");
        if (setting == RESOURCE_LINK)
            DOM.getElementById("resultsSearchFilterLink").setAttribute("selected", "selected");
    }
    DOM.getElementById("r-pageTitle").setInnerHTML("<h4>" + pageTitle + "</h4>");

    PageAssembler.attachHandler("resultsSearchSelectShow", Event.ONCHANGE, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            generateQuery();
        }
    });
    PageAssembler.attachHandler("resultsSearchSelectDistribution", Event.ONCHANGE, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            generateQuery();
        }
    });
    PageAssembler.attachHandler("searchNextPage", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            generateQuery();
        }
    });

    PageAssembler.attachHandler("resultsSearchSelectSource", Event.ONCHANGE, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            ListBox lb = (ListBox) PageAssembler.elementToWidget("resultsSearchSelectSource",
                    PageAssembler.SELECT);
            Russel.screen.loadScreen(new SearchScreen(lb.getItemText(lb.getSelectedIndex())), true);
        }
    });

    PageAssembler.attachHandler("searchPreviousPage", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            sh.previousPage();
            generateQuery();
        }
    });

    PageAssembler.attachHandler("r-objectEditSelected", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            Russel.screen.loadScreen(new EditScreen(sh.getSelected()), true);
        }
    });

    generateQuery();
}

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

License:Apache License

/**
 * display Renders the Utility screen using appropriate templates and sets up handlers
 *//*from  w  w  w  .j a v  a2s  .c  om*/
public void display() {
    PageAssembler.ready(new HTML(templates().getUserManagementPanel().getText()));
    PageAssembler.buildContents();

    DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active");
    DOM.getElementById("r-menuProjects").getParentElement().removeClassName("active");
    DOM.getElementById("r-menuWorkspace").getParentElement().removeClassName("active");

    RusselApi.getUserListing(new ESBCallback<ESBPacket>() {
        @Override
        public void onSuccess(ESBPacket esbPacket) {
            populateUserList(esbPacket.getObject("obj").getObject("users"));
        }

        @Override
        public void onFailure(Throwable caught) {

        }
    });

    PageAssembler.attachHandler("userCreate", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            openPopup(CREATE);
            ((TextBox) PageAssembler.elementToWidget("newUsername", PageAssembler.TEXT)).setText("");
            ((PasswordTextBox) PageAssembler.elementToWidget("newPassword", PageAssembler.PASSWORD))
                    .setText("");
            ((PasswordTextBox) PageAssembler.elementToWidget("newPasswordConfirmation", PageAssembler.PASSWORD))
                    .setText("");

            PageAssembler.attachHandler("modalNewUserCreate", Event.ONCLICK, new EventCallback() {
                @Override
                public void onEvent(Event event) {
                    String username = ((TextBox) PageAssembler.elementToWidget("newUsername",
                            PageAssembler.TEXT)).getText().trim();
                    if (matchingPasswords("newPassword", "newPasswordConfirmation") && username != "") {
                        String password = ((PasswordTextBox) PageAssembler.elementToWidget("newPassword",
                                PageAssembler.PASSWORD)).getText();
                        createUser(username, password);
                    }
                }
            });

            PageAssembler.attachHandler("modalNewUserCancel", Event.ONCLICK, new EventCallback() {
                @Override
                public void onEvent(Event event) {
                    PageAssembler.closePopup("createUserModal");
                }
            });
        }
    });

    PageAssembler.attachHandler("userPasswordReset", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            if (selectedIdPrefix != null) {
                openPopup(RESET);
                ((PasswordTextBox) PageAssembler.elementToWidget("resetPassword", PageAssembler.PASSWORD))
                        .setText("");
                ((PasswordTextBox) PageAssembler.elementToWidget("resetPasswordConfirmation",
                        PageAssembler.PASSWORD)).setText("");

                PageAssembler.attachHandler("modalResetPasswordAccept", Event.ONCLICK, new EventCallback() {
                    @Override
                    public void onEvent(Event event) {
                        if (matchingPasswords("resetPassword", "resetPasswordConfirmation")) {
                            String password = ((PasswordTextBox) PageAssembler.elementToWidget("resetPassword",
                                    PageAssembler.PASSWORD)).getText();
                            resetPassword(selectedUsername, password);
                        }
                    }
                });

                PageAssembler.attachHandler("modalResetPasswordCancel", Event.ONCLICK, new EventCallback() {
                    @Override
                    public void onEvent(Event event) {
                        PageAssembler.closePopup("resetPasswordModal");
                    }
                });
            }
        }
    });

    PageAssembler.attachHandler("userPermissions", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            if (selectedIdPrefix != null) {
                openPopup(PERMISSION);

                fillPermissions();

                PageAssembler.attachHandler("modalPermissionAccept", Event.ONCLICK, new EventCallback() {
                    @Override
                    public void onEvent(Event event) {
                        toggleUserAdmin(selectedIdPrefix, selectedUsername, ((SimpleCheckBox) PageAssembler
                                .elementToWidget("adminPermissionToggle", PageAssembler.CHECK_BOX)).getValue());
                    }
                });

                PageAssembler.attachHandler("modalPermissionCancel", Event.ONCLICK, new EventCallback() {
                    @Override
                    public void onEvent(Event event) {
                        PageAssembler.closePopup("setPermissionsModal");
                    }
                });
            }
        }

    });

    PageAssembler.attachHandler("userDelete", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            if (selectedIdPrefix != null)
                deleteUser(selectedIdPrefix, selectedUsername);
        }
    });
}

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

License:Apache License

private void makeUserRow(final String username, JSONArray permissions) {
    Vector<String> ids = PageAssembler.inject("userList", "x",
            new HTML(templates().getUserManagementPanelWidget().getText()), true);
    final String idPrefix = ids.get(0).substring(0, ids.get(0).indexOf("-"));
    ((Label) PageAssembler.elementToWidget(idPrefix + "-username", PageAssembler.LABEL)).setText(username);
    String roleText = "";
    if (isAdmin(username, permissions))
        roleText = "Administrator";
    ((Label) PageAssembler.elementToWidget(idPrefix + "-role", PageAssembler.LABEL)).setText(roleText);
    PageAssembler.attachHandler(idPrefix + "-userSelected", Event.ONCLICK, new EventCallback() {
        @Override/*from  ww w .  j av  a  2 s . c o m*/
        public void onEvent(Event event) {
            selectedIdPrefix = idPrefix;
            selectedUsername = username;
        }
    });

}

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

License:Apache License

/**
 * display Renders the Utility screen using appropriate templates and sets up handlers
 *//*from  w  ww .  j av  a2  s. c o  m*/
public void display() {
    PageAssembler.ready(new HTML(Russel.htmlTemplates.getUserManagementPanel().getText()));
    PageAssembler.buildContents();

    DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active");
    DOM.getElementById("r-menuProjects").getParentElement().removeClassName("active");
    DOM.getElementById("r-menuWorkspace").getParentElement().removeClassName("active");

    PageAssembler.attachHandler("userGroups", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            Russel.screen.loadScreen(new GroupScreen(), true);
        }
    });

    PageAssembler.attachHandler("userPermissions", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            Russel.screen.loadScreen(new PermissionScreen(PermissionScreen.TYPE_USER,
                    DOM.getElementById("userList").getPropertyString("value")), false);
        }
    });

    RusselApi.getUsers(new ESBCallback<ESBPacket>() {
        @Override
        public void onSuccess(ESBPacket esbPacket) {
            JSONArray jsonArray = esbPacket.getArray("obj");
            for (int i = 0; i < jsonArray.size(); i++) {
                String username = jsonArray.get(i).isString().stringValue();
                makeOption(username, "userList");
            }
        }

        @Override
        public void onFailure(Throwable caught) {
        }
    });

    PageAssembler.attachHandler("userCreate", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            openPopup(CREATE);
            ((TextBox) PageAssembler.elementToWidget("newUsername", PageAssembler.TEXT)).setText("");
            ((PasswordTextBox) PageAssembler.elementToWidget("newPassword", PageAssembler.PASSWORD))
                    .setText("");
            ((PasswordTextBox) PageAssembler.elementToWidget("newPasswordConfirmation", PageAssembler.PASSWORD))
                    .setText("");

            PageAssembler.attachHandler("modalNewUserCreate", Event.ONCLICK, new EventCallback() {
                @Override
                public void onEvent(Event event) {
                    String username = ((TextBox) PageAssembler.elementToWidget("newUsername",
                            PageAssembler.TEXT)).getText().trim();
                    if (matchingPasswords("newPassword", "newPasswordConfirmation") && username != "") {
                        String password = ((PasswordTextBox) PageAssembler.elementToWidget("newPassword",
                                PageAssembler.PASSWORD)).getText();
                        createUser(username, password);
                    }
                }
            });

            PageAssembler.attachHandler("modalNewUserCancel", Event.ONCLICK, new EventCallback() {
                @Override
                public void onEvent(Event event) {
                    PageAssembler.closePopup("createUserModal");
                }
            });
        }
    });

    PageAssembler.attachHandler("userPasswordReset", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            openPopup(RESET);
            ((PasswordTextBox) PageAssembler.elementToWidget("resetPassword", PageAssembler.PASSWORD))
                    .setText("");
            ((PasswordTextBox) PageAssembler.elementToWidget("resetPasswordConfirmation",
                    PageAssembler.PASSWORD)).setText("");

            PageAssembler.attachHandler("modalResetPasswordAccept", Event.ONCLICK, new EventCallback() {
                @Override
                public void onEvent(Event event) {
                    if (matchingPasswords("resetPassword", "resetPasswordConfirmation")) {
                        String password = ((PasswordTextBox) PageAssembler.elementToWidget("resetPassword",
                                PageAssembler.PASSWORD)).getText();
                        resetPassword(DOM.getElementById("userList").getPropertyString("value"), password);
                    }
                }
            });

            PageAssembler.attachHandler("modalResetPasswordCancel", Event.ONCLICK, new EventCallback() {
                @Override
                public void onEvent(Event event) {
                    PageAssembler.closePopup("resetPasswordModal");
                }
            });
        }
    });

    PageAssembler.attachHandler("userDelete", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            deleteUser(DOM.getElementById("userList").getPropertyString("value"));
        }
    });
}

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

License:Apache License

/**
 * display Renders the Utility screen using appropriate templates and sets up handlers
 */// w  ww .ja v a2s .  c  o  m
public void display() {
    PageAssembler.ready(new HTML(templates().getUtilityPanel().getText()));
    PageAssembler.buildContents();

    DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active");
    DOM.getElementById("r-menuProjects").getParentElement().removeClassName("active");
    DOM.getElementById("r-menuWorkspace").getParentElement().removeClassName("active");

    // Setup Title and utility panel
    if (utilType.equals(ACCOUNT_TYPE)) {
        pageTitle = "Account Settings";
    } else if (utilType.equals(USERS_TYPE)) {
        pageTitle = "Manage Users";
    } else if (utilType.equals(GROUPS_TYPE)) {
        pageTitle = "Manage Groups";

    } else if (utilType.equals(REPSETTINGS_TYPE)) {
        pageTitle = "Repository Settings";
        setDisplayIE0(DOM.getElementById("r-alfrescoUtil"), "none");
        setDisplayIE0(DOM.getElementById("r-repositorySettings"), "block");
        populateFLRSettings();
    } else {
        pageTitle = "Unknown Alfresco Utility";
        populateFLRSettings();
    }

    DOM.getElementById("r-pageTitle").setInnerHTML("<h4>" + pageTitle + "</h4>");

}

From source file:com.enably.chrometric.client.ChrometricApp.java

License:Open Source License

public static void showTooltip(String caption, String content, UIObject target) {
    if (tooltip == null) {
        tooltip = new PopupPanel();
        tooltip.setWidth("300px");
        tooltip.addStyleName("tooltip");
    }/*w ww . j a va2 s . c o m*/
    tooltip.setWidget(new HTML("<h2>" + caption + "</h2>" + content));
    tooltip.showRelativeTo(target);
}

From source file:com.ephesoft.dcma.gwt.foldermanager.client.view.FolderTableView.java

License:Open Source License

private final void createTableHeader() {
    selectAll = new CheckBox();
    selectAll.addClickHandler(new ClickHandler() {

        @Override//  w  ww .  ja  v  a 2 s .c o m
        public void onClick(ClickEvent event) {
            Boolean isSelectAllSelected = selectAll.getValue();
            for (FolderTableRow folderTableRow : folderTableRows) {
                folderTableRow.checkBox.setValue(isSelectAllSelected);
            }
        }
    });
    headers.setWidget(0, 0, selectAll);
    String name = LocaleDictionary.get().getConstantValue(FolderManagementConstants.NAME);

    String modifiedAt = LocaleDictionary.get().getConstantValue(FolderManagementConstants.MODIFIED_AT);
    String type = LocaleDictionary.get().getConstantValue(FolderManagementConstants.TYPE);

    HTML nameHTML = new HTML(name);
    HTML modifiedAtHTML = new HTML(modifiedAt);
    HTML typeHTML = new HTML(type);
    final HorizontalPanel nameHorizontalPanel = new HorizontalPanel();
    final HorizontalPanel modifiedHorizontalPanel = new HorizontalPanel();
    final HorizontalPanel typeHorizontalPanel = new HorizontalPanel();
    nameHorizontalPanel.add(nameHTML);
    modifiedHorizontalPanel.add(modifiedAtHTML);
    typeHorizontalPanel.add(typeHTML);

    nameHorizontalPanel.addStyleName(FolderManagementConstants.CURSOR_HAND);
    modifiedHorizontalPanel.addStyleName(FolderManagementConstants.CURSOR_HAND);
    typeHorizontalPanel.addStyleName(FolderManagementConstants.CURSOR_HAND);
    nameHTML.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            nameOrderAscending = toggleSortingAnchor(nameHorizontalPanel, nameOrderAscending);
            lastSortingOption = SortingOption.NAME;
            updateTableContent(presenter.getFolderPath());
        }

    });
    modifiedAtHTML.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            dateOrderAscending = toggleSortingAnchor(modifiedHorizontalPanel, dateOrderAscending);
            lastSortingOption = SortingOption.DATE;
            updateTableContent(presenter.getFolderPath());
        }
    });
    typeHTML.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            typeOrderAscending = toggleSortingAnchor(typeHorizontalPanel, typeOrderAscending);
            lastSortingOption = SortingOption.TYPE;
            updateTableContent(presenter.getFolderPath());
        }

    });

    headers.setWidget(0, 1, nameHorizontalPanel);
    headers.setWidget(0, 2, modifiedHorizontalPanel);
    headers.setWidget(0, 3, typeHorizontalPanel);
    headers.getCellFormatter().addStyleName(0, 0, FolderManagementConstants.FILES_TABLE_SMALL_COLUMN
            + FolderManagementConstants.SPACE + FolderManagementConstants.FILES_TABLE_HEADER_CELL);
    headers.getCellFormatter().addStyleName(0, 1, FolderManagementConstants.FILES_TABLE_HEADER_CELL);
    headers.getCellFormatter().addStyleName(0, 2, FolderManagementConstants.FILES_TABLE_HEADER_CELL);
    headers.getCellFormatter().addStyleName(0, 3, FolderManagementConstants.FILES_TABLE_HEADER_CELL);
    headers.getColumnFormatter().setWidth(0, PERCENTAGE_FIVE);
    headers.getColumnFormatter().setWidth(1, PERCENTAGE_FOURTY_EIGHT);
    headers.getColumnFormatter().setWidth(2, PERCENTAGE_TWENTY_EIGHT);
    headers.getColumnFormatter().setWidth(3, PERCENTAGE_ELEVEN);
    headers.setWidth(PERCENTAGE_HUNDRED);
}

From source file:com.ephesoft.dcma.gwt.foldermanager.client.view.FolderTableView.java

License:Open Source License

private boolean toggleSortingAnchor(HorizontalPanel horizontalPanel, boolean ascending) {
    if (anchorHtml != null) {
        anchorHtml.removeFromParent();/*from w  w  w  .j ava 2s  . c o m*/
    }
    if (ascending) {
        anchorHtml = new HTML(FolderManagementConstants.SORT_UP);
    } else {
        anchorHtml = new HTML(FolderManagementConstants.SORT_DOWN);
    }
    horizontalPanel.add(anchorHtml);
    return !ascending;
}

From source file:com.ephesoft.dcma.gwt.foldermanager.client.view.FolderTableView.java

License:Open Source License

public final void cleanupTableContent() {
    folderTableRows.clear();/*  w  w w .  j  a  v  a2 s.  com*/
    folderDisplayTable.removeAllRows();
    folderDisplayTable.getColumnFormatter().setWidth(0, PERCENTAGE_FIVE);
    folderDisplayTable.getColumnFormatter().setWidth(1, PERCENTAGE_FOURTY_EIGHT);
    folderDisplayTable.getColumnFormatter().setWidth(2, PERCENTAGE_TWENTY_EIGHT);
    folderDisplayTable.getColumnFormatter().setWidth(3, PERCENTAGE_NINE);
    folderDisplayTable.setWidth(PERCENTAGE_HUNDRED);

    // These empty labels are for alignment purpose only
    final Label emptyLabelCol1 = new Label();
    final Label emptyLabelCol3 = new Label();
    final Label emptyLabelCol4 = new Label();

    emptyLabelCol1.setWidth(PERCENTAGE_FIVE);
    emptyLabelCol3.setWidth(PERCENTAGE_TWENTY_EIGHT);
    emptyLabelCol4.setWidth(PERCENTAGE_NINE);
    folderDisplayTable.setWidget(0, 0, emptyLabelCol1);
    folderDisplayTable.setWidget(0, 2, emptyLabelCol3);
    folderDisplayTable.setWidget(0, 3, emptyLabelCol4);
    HTML html = new HTML(FolderManagementConstants.IMAGE_LOADING);
    folderDisplayTable.setWidget(0, 1, html);
    folderDisplayTable.getCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_MIDDLE);
    selectAll.setValue(false);
}