Java Code Examples for com.google.gwt.user.client.ui.LayoutPanel#addStyleName()

The following examples show how to use com.google.gwt.user.client.ui.LayoutPanel#addStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RBACContextView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launch() {
    final DefaultWindow window = new DefaultWindow("RBAC Diagnostics");

    LayoutPanel inner = new LayoutPanel();
    inner.setStyleName("default-window-content");
    inner.addStyleName("rbac-diagnostics");

    ClickHandler clickHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            window.hide();
        }
    };
    Widget content = new WindowContentBuilder(asWidget(), new DialogueOptions(
            "Done", clickHandler, "Cancel", clickHandler)
    ).build();

    inner.add(content);

    window.setWidget(inner);

    window.setWidth(480);
    window.setHeight(360);
    window.center();
}
 
Example 2
Source File: PicketLinkFinder.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
void launchAddFederationDialog() {
    ResourceDescription resourceDescription = StaticResourceDescription
            .from(PICKET_LINK_RESOURCES.newFederationDescription());
    ComboBoxItem securityDomains = new ComboBoxItem("security-domain", "Security Domain");
    securityDomains.setRequired(false);
    securityDomains.setValueMap(this.securityDomains);

    DefaultWindow dialog = new DefaultWindow(Console.MESSAGES.newTitle("Federation"));
    ModelNodeFormBuilder.FormAssets assets = new ModelNodeFormBuilder()
            .setResourceDescription(resourceDescription)
            .addFactory("security-domain", attributeDescription -> securityDomains)
            .setSecurityContext(securityContext)
            .unsorted()
            .build();
    assets.getForm().setEnabled(true);
    assets.getForm().addFormValidator(new IdentityProviderEditor.IdentityProviderFormValidator());

    DialogueOptions options = new DialogueOptions(
            event -> {
                FormValidation validation = assets.getForm().validate();
                if (!validation.hasErrors()) {
                    dialog.hide();

                    ModelNode payload = assets.getForm().getUpdatedEntity();
                    String name = payload.get(NAME).asString();
                    String ip = payload.get("identity-provider").asString();

                    Operation addFederation = new Operation.Builder(ADD,
                            FEDERATION_TEMPLATE.resolve(statementContext, name)).build();
                    Operation addIdentityProvider = new Operation.Builder(ADD,
                            IDENTITY_PROVIDER_TEMPLATE.resolve(statementContext, name, ip))
                            .param("security-domain", payload.get("security-domain").asString())
                            .param("external", payload.get("external").asBoolean())
                            .param("url", payload.get("url").asString())
                            .build();
                    dispatcher.execute(new DMRAction(new Composite(addFederation, addIdentityProvider)),
                            new SimpleCallback<DMRResponse>() {
                                @Override
                                public void onFailure(final Throwable caught) {
                                    super.onFailure(caught);
                                    readFederations();
                                }

                                @Override
                                public void onSuccess(final DMRResponse dmrResponse) {
                                    Console.info(Console.MESSAGES.successfullyAdded((name)));
                                    readFederations();
                                }
                            });
                }
            },
            event -> dialog.hide()
    );

    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("fill-layout-width window-content");
    ContentDescription text = new ContentDescription(resourceDescription.get(DESCRIPTION).asString());
    layout.add(text);
    layout.add(assets.getHelp().asWidget());
    layout.add(assets.getForm().asWidget());

    ScrollPanel scroll = new ScrollPanel(layout);
    LayoutPanel content = new LayoutPanel();
    content.addStyleName("fill-layout");
    content.add(scroll);
    content.add(options);
    content.getElement().setAttribute("style", "margin-bottom:10px");
    content.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 92, Style.Unit.PCT);
    content.setWidgetBottomHeight(options, 0, Style.Unit.PX, 35, Style.Unit.PX);

    dialog.setWidth(640);
    dialog.setHeight(480);
    dialog.setWidget(new TrappedFocusPanel(content));
    dialog.setGlassEnabled(true);
    dialog.center();
}
 
Example 3
Source File: MainLayoutViewImpl.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Inject
public MainLayoutViewImpl(final Header header, Footer footer, MessageCenter messageCenter, PlaceManager placeManager) {

    this.messageCenter = messageCenter;
    this.header = header;
    this.placeManager = placeManager;

    mainContentPanel = new LayoutPanel();
    mainContentPanel.setStyleName("main-content-panel");
    mainContentPanel.addStyleName("animated");

    // see http://www.w3.org/TR/wai-aria/states_and_properties#aria-live
    mainContentPanel.getElement().setAttribute("role", "region");
    mainContentPanel.getElement().setAttribute("aria-live", "polite");
    mainContentPanel.getElement().setId("main-content-area");

    headerPanel = new LayoutPanel();
    headerPanel.setStyleName("header-panel");
    headerPanel.getElement().setId("header");

    footerPanel = new LayoutPanel();
    footerPanel.setStyleName("footer-panel");
    footerPanel.getElement().setId("footer");

    panel = new DockLayoutPanel(Style.Unit.PX);
    panel.getElement().setAttribute("id", "container");

    panel.addNorth(headerPanel, 80);
    panel.addSouth(footerPanel, 42);
    panel.add(mainContentPanel);

    getHeaderPanel().add(header.asWidget());
    getFooterPanel().add(footer.asWidget());

    // the application window
    window = new DefaultWindow("");
   // window.addStyleName("animated");

    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

            Console.getPlaceManager().revealRelativePlace(-1);
            // clearing the slot:
            // this is necessary to signal GWTP that the slot is not used
            // without subsequent attempts to reveal the same place twice would not succeed
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    presenter.clearSlot(MainLayoutPresenter.TYPE_Popup);
                }
            });

           /* window.removeStyleName(ACTIVE_CSS);
            window.addStyleName(INACTIVE_CSS);*/
        }
    });

    window.setWidth(640);
    window.setHeight(480);
    window.setAutoHideOnHistoryEventsEnabled(true);
    //window.setGlassStyleName("application-panel-glass");
    window.setGlassEnabled(true);
}