Search in sources :

Example 1 with Panel

use of com.google.gwt.user.client.ui.Panel in project pentaho-platform by pentaho.

the class MantleXul method customizeAdminStyle.

public void customizeAdminStyle() {
    Timer t = new Timer() {

        public void run() {
            if (container != null) {
                cancel();
                // call this method when Elements are added to DOM
                GwtTree adminCatTree = (GwtTree) container.getDocumentRoot().getElementById("adminCatTree");
                adminCatTree.getTree().removeStyleName("gwt-Tree");
                Panel adminContentPanel = (Panel) container.getDocumentRoot().getElementById("adminContentPanel").getManagedObject();
                adminContentPanel.setWidth("100%");
                for (int i = 0; i < adminCatTree.getTree().getItemCount(); i++) {
                    TreeItem treeItem = adminCatTree.getTree().getItem(i);
                    Element e = treeItem.getElement();
                    e.getStyle().clearPadding();
                    e.addClassName("adminCatTreeItem");
                    if (i == adminCatTree.getTree().getItemCount() - 1) {
                        e.addClassName("adminCatTreeItemLast");
                    }
                }
                MantleXul.this.selectAdminCatTreeTreeItem(Messages.getString("manageUsersAndRoles").replaceAll("&amp;", "&"));
            }
        }
    };
    t.scheduleRepeating(250);
}
Also used : IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) Panel(com.google.gwt.user.client.ui.Panel) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) DeckPanel(com.google.gwt.user.client.ui.DeckPanel) Timer(com.google.gwt.user.client.Timer) TreeItem(com.google.gwt.user.client.ui.TreeItem) GwtTree(org.pentaho.ui.xul.gwt.tags.GwtTree) Element(com.google.gwt.user.client.Element)

Example 2 with Panel

use of com.google.gwt.user.client.ui.Panel in project data-access by pentaho.

the class MetadataImportDialogController method promptImportMetadata.

/**
 * Shows a promt dialog
 *
 * @param title
 * @param message
 * @param radioDSWLabel
 * @param radioMetaLabel
 * @param onResulthandler
 */
private void promptImportMetadata(final String title, final String message, final String radioDSWLabel, final String radioMetaLabel, final AsyncCallback<Boolean> onResulthandler) {
    final VerticalPanel panel = new VerticalPanel();
    // $NON-NLS-1$
    panel.add(new Label(message));
    VerticalPanel vp = new VerticalPanel();
    HorizontalPanel hp = new HorizontalPanel();
    hp.getElement().getStyle().setMarginBottom(10, Style.Unit.PX);
    hp.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
    final RadioButton dswRadio = new RadioButton("importMetadata");
    RadioButton metadataRadio = new RadioButton("importMetadata");
    dswRadio.setEnabled(true);
    dswRadio.setValue(true);
    hp.add(dswRadio);
    hp.add(new Label(radioDSWLabel));
    vp.add(hp);
    HorizontalPanel hp2 = new HorizontalPanel();
    hp2.add(metadataRadio);
    hp2.add(new Label(radioMetaLabel));
    vp.add(hp2);
    panel.add(vp);
    XulPromptBox promptBox = new GwtPromptBox() {

        @Override
        public Panel getDialogContents() {
            return panel;
        }

        @Override
        public int open() {
            super.show();
            dswRadio.setFocus(true);
            return 0;
        }

        @Override
        public Panel getButtonPanel() {
            Panel button = super.getButtonPanel();
            return button;
        }
    };
    promptBox.setTitle(title);
    promptBox.setAcceptLabel(resBundle.getString("importDialog.DIALOG_OK", "OK"));
    promptBox.setCancelLabel(resBundle.getString("importDialog.DIALOG_Cancel", "Cancel"));
    promptBox.addDialogCallback(new XulDialogCallback<String>() {

        @Override
        public void onClose(XulComponent component, Status status, String value) {
            if (status == Status.CANCEL) {
                onImportCancel();
                reShowDialog();
                return;
            }
            if (onResulthandler != null) {
                onResulthandler.onSuccess(dswRadio.getValue());
            }
        }

        @Override
        public void onError(XulComponent xulComponent, Throwable throwable) {
            onResulthandler.onFailure(throwable);
        }
    });
    promptBox.setWidth(460);
    promptBox.setHeight(140);
    promptBox.open();
}
Also used : HttpStatus(org.apache.http.HttpStatus) Label(com.google.gwt.user.client.ui.Label) XulLabel(org.pentaho.ui.xul.components.XulLabel) RadioButton(com.google.gwt.user.client.ui.RadioButton) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) RootPanel(com.google.gwt.user.client.ui.RootPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) FormPanel(com.google.gwt.user.client.ui.FormPanel) Panel(com.google.gwt.user.client.ui.Panel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) GwtPromptBox(org.pentaho.ui.xul.gwt.tags.GwtPromptBox) XulPromptBox(org.pentaho.ui.xul.components.XulPromptBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) XulComponent(org.pentaho.ui.xul.XulComponent)

Example 3 with Panel

use of com.google.gwt.user.client.ui.Panel in project ovirt-engine by oVirt.

the class NetworkPanel method getContents.

@Override
protected Widget getContents() {
    Image mgmtNetworkImage;
    Image defaultRouteImage;
    Image vmImage;
    Image monitorImage;
    Image migrationImage;
    Image notSyncImage;
    Image alertImage;
    Image glusterNwImage;
    if (!item.isManaged()) {
        monitorImage = null;
        mgmtNetworkImage = null;
        defaultRouteImage = null;
        vmImage = null;
        migrationImage = null;
        glusterNwImage = null;
        notSyncImage = null;
        alertImage = null;
    } else {
        NetworkCluster networkCluster = item.getNetwork().getCluster();
        monitorImage = networkCluster.isDisplay() ? new Image(resources.networkMonitor()) : null;
        mgmtNetworkImage = item.isManagement() ? new Image(resources.mgmtNetwork()) : null;
        defaultRouteImage = networkCluster.isDefaultRoute() ? new Image(resources.defaultRouteNetwork()) : null;
        vmImage = item.getNetwork().isVmNetwork() ? new Image(resources.networkVm()) : null;
        migrationImage = networkCluster.isMigration() ? new Image(resources.migrationNetwork()) : null;
        glusterNwImage = networkCluster.isGluster() ? new Image(resources.glusterNetwork()) : null;
        notSyncImage = !item.isInSync() ? new Image(resources.networkNotSyncImage()) : null;
        alertImage = item.getErrorMessage() != null ? new Image(resources.alertImage()) : null;
        if (item.isManagement()) {
            mgmtNetworkImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (item.getNetwork().isVmNetwork()) {
            vmImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (networkCluster.isDisplay()) {
            monitorImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (networkCluster.isMigration()) {
            migrationImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (networkCluster.isDefaultRoute()) {
            defaultRouteImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (networkCluster.isGluster()) {
            glusterNwImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (!item.isInSync()) {
            notSyncImage.setStylePrimaryName(style.syncImageBorder());
        }
    }
    actionButton.setVisible(item.getAttachedToNic() != null && (item.isManaged() || !item.isAttachedViaLabel()));
    Grid rowPanel = new Grid(item.hasVlan() ? 2 : 1, 10);
    rowPanel.setCellSpacing(0);
    // $NON-NLS-1$
    rowPanel.setWidth("100%");
    // $NON-NLS-1$
    rowPanel.setHeight("100%");
    ColumnFormatter columnFormatter = rowPanel.getColumnFormatter();
    // $NON-NLS-1$
    columnFormatter.setWidth(0, "5px");
    // $NON-NLS-1$
    columnFormatter.setWidth(1, "20px");
    // $NON-NLS-1$
    columnFormatter.setWidth(2, "100%");
    rowPanel.setWidget(0, 0, dragImage);
    Panel statusPanel = new HorizontalPanel();
    statusPanel.setStylePrimaryName(style.networkStatusPanel());
    rowPanel.setWidget(0, 1, statusPanel);
    if (alertImage != null) {
        statusPanel.add(alertImage);
    }
    ImageResource statusImage = getStatusImage();
    if (statusImage != null) {
        statusPanel.add(new Image(statusImage));
    }
    if (notSyncImage != null) {
        statusPanel.add(notSyncImage);
    }
    rowPanel.setWidget(0, 2, createTitlePanel());
    rowPanel.setWidget(0, 3, mgmtNetworkImage);
    rowPanel.setWidget(0, 4, monitorImage);
    rowPanel.setWidget(0, 5, vmImage);
    rowPanel.setWidget(0, 6, migrationImage);
    rowPanel.setWidget(0, 7, glusterNwImage);
    rowPanel.setWidget(0, 8, defaultRouteImage);
    rowPanel.setWidget(0, 9, actionButton);
    if (item.hasVlan()) {
        rowPanel.setWidget(1, 2, createVlanPanel());
        for (int i = 3; i < rowPanel.getColumnCount(); i++) {
            // we need to clear the unused widgets, otherwise there will be few pixels wide empty space
            rowPanel.setWidget(1, i, null);
        }
    }
    return rowPanel;
}
Also used : Panel(com.google.gwt.user.client.ui.Panel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ImageResource(com.google.gwt.resources.client.ImageResource) Grid(com.google.gwt.user.client.ui.Grid) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Image(com.google.gwt.user.client.ui.Image) ColumnFormatter(com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter)

Example 4 with Panel

use of com.google.gwt.user.client.ui.Panel in project ovirt-engine by oVirt.

the class NetworkPanel method createVlanPanel.

private Panel createVlanPanel() {
    Panel vlanPanel = new HorizontalPanel();
    Label vlanLabel = new Label(messages.vlanNetwork(item.getVlanId()));
    vlanLabel.getElement().addClassName(style.vlanLabel());
    vlanPanel.getElement().addClassName(style.fixedTable());
    vlanPanel.add(vlanLabel);
    return vlanPanel;
}
Also used : Panel(com.google.gwt.user.client.ui.Panel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label)

Example 5 with Panel

use of com.google.gwt.user.client.ui.Panel in project libgdx by libgdx.

the class GwtApplication method getPreloaderCallback.

public PreloaderCallback getPreloaderCallback() {
    final Panel preloaderPanel = new VerticalPanel();
    preloaderPanel.setStyleName("gdx-preloader");
    final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png");
    logo.setStyleName("logo");
    preloaderPanel.add(logo);
    final Panel meterPanel = new SimplePanel();
    meterPanel.setStyleName("gdx-meter");
    meterPanel.addStyleName("red");
    final InlineHTML meter = new InlineHTML();
    final Style meterStyle = meter.getElement().getStyle();
    meterStyle.setWidth(0, Unit.PCT);
    meterPanel.add(meter);
    preloaderPanel.add(meterPanel);
    getRootPanel().add(preloaderPanel);
    return new PreloaderCallback() {

        @Override
        public void error(String file) {
            System.out.println("error: " + file);
        }

        @Override
        public void update(PreloaderState state) {
            meterStyle.setWidth(100f * state.getProgress(), Unit.PCT);
        }
    };
}
Also used : PreloaderCallback(com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderCallback) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Panel(com.google.gwt.user.client.ui.Panel) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) RootPanel(com.google.gwt.user.client.ui.RootPanel) PreloaderState(com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderState) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) InlineHTML(com.google.gwt.user.client.ui.InlineHTML) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) Style(com.google.gwt.dom.client.Style) Image(com.google.gwt.user.client.ui.Image)

Aggregations

Panel (com.google.gwt.user.client.ui.Panel)8 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)4 Label (com.google.gwt.user.client.ui.Label)3 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)3 DeckPanel (com.google.gwt.user.client.ui.DeckPanel)2 Image (com.google.gwt.user.client.ui.Image)2 RootPanel (com.google.gwt.user.client.ui.RootPanel)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 IFrameTabPanel (org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel)2 PreloaderCallback (com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderCallback)1 PreloaderState (com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderState)1 GWT (com.google.gwt.core.client.GWT)1 Style (com.google.gwt.dom.client.Style)1 Request (com.google.gwt.http.client.Request)1 RequestBuilder (com.google.gwt.http.client.RequestBuilder)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 ImageResource (com.google.gwt.resources.client.ImageResource)1 Element (com.google.gwt.user.client.Element)1