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

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

Introduction

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

Prototype

public DecoratorPanel() 

Source Link

Document

Create a new DecoratorPanel .

Usage

From source file:cc.kune.gspace.client.options.logo.EntityOptUploadButton.java

License:GNU Affero Public License

/**
 * Instantiates a new entity opt upload button.
 * //from   w  ww .  j a  va  2 s  .c  o  m
 * @param text
 *          the text
 */
public EntityOptUploadButton(final String text) {
    final DecoratorPanel decorator = new DecoratorPanel();
    btn = new CustomButton(text);
    btn.addStyleName("k-button");
    initWidget(decorator);
    decorator.setWidget(btn);
    decorator.setHeight("50px");
}

From source file:com.appspot.codsallarts.client.Application.java

License:Apache License

/**
 * Constructor.//from   w  ww. j  a  v a2s.  c  o  m
 */
public Application() {
    // Setup the main layout widget
    FlowPanel layout = new FlowPanel();
    initWidget(layout);

    // Setup the top panel with the title and links
    createTopPanel();
    layout.add(topPanel);

    // Add the main menu
    bottomPanel = new HorizontalPanel();
    bottomPanel.setWidth("100%");
    bottomPanel.setSpacing(0);
    bottomPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    layout.add(bottomPanel);

    // Setup the content layout
    contentLayout = new Grid(2, 1);
    contentLayout.setStyleName("Application-content-grid");
    contentLayout.setCellPadding(0);
    contentLayout.setCellSpacing(0);
    contentDecorator = new DecoratorPanel();
    contentDecorator.setWidget(contentLayout);
    contentDecorator.addStyleName(DEFAULT_STYLE_NAME + "-content-decorator");
    bottomPanel.add(contentDecorator);
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        bottomPanel.setCellHorizontalAlignment(contentDecorator, HasHorizontalAlignment.ALIGN_LEFT);
        contentDecorator.getElement().setAttribute("align", "LEFT");
    } else {
        bottomPanel.setCellHorizontalAlignment(contentDecorator, HasHorizontalAlignment.ALIGN_RIGHT);
        contentDecorator.getElement().setAttribute("align", "RIGHT");
    }
    CellFormatter formatter = contentLayout.getCellFormatter();

    // Add the content title
    setContentTitle(new HTML("Welcome"));
    formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-content-title");

    // Add the content wrapper
    contentWrapper = new SimplePanel();
    contentLayout.setWidget(1, 0, contentWrapper);
    formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-content-wrapper");
    setContent(null);

    //createMainMenu();
    //bottomPanel.add(mainMenu);
    navigationPanel = new SimplePanel();
    navigationPanel.addStyleName(DEFAULT_STYLE_NAME + "-nav");
    bottomPanel.add(navigationPanel);
    // Add a window resize handler
    Window.addResizeHandler(this);
}

From source file:com.cognitivemedicine.metricsdashboard.client.dashboard.DashboardMainPanel.java

License:Apache License

private void initUi() {
    mainPanel = new VerticalPanel();
    mainPanel.setWidth("300px");
    mainPanel.setSpacing(4);//from  ww w .  j a v  a  2 s  . c  o m

    VerticalPanel titlePanel = new VerticalPanel();
    titlePanel.setWidth("100%");
    HorizontalPanel logoutPanel = new HorizontalPanel();
    Image logoutImage = new Image(MdConstants.IMG_LOGOUT);
    logoutImage.getElement().getStyle().setCursor(Cursor.POINTER);
    logoutImage.setSize("16px", "16px");
    logoutImage.setTitle("Log Out");
    logoutImage.getElement().getStyle().setProperty("cursor", "hand");
    logoutImage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    HTML logOutLabel = new HTML("<u><font size=-2>Log Out </font></u>");
    logOutLabel.setHeight("10px");
    // logOutLabel.setStyleName("logoutButton");
    logOutLabel.setStylePrimaryName("logoutButton");
    logOutLabel.getElement().getStyle().setProperty("right", "5px");
    // logOutLabel.getElement().getStyle().setProperty("cursor", "hand");
    logOutLabel.getElement().getStyle().setCursor(Cursor.POINTER);
    logOutLabel.setWidth("100%");
    logOutLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    logoutPanel.add(logOutLabel);
    logoutPanel.add(logoutImage);
    logoutPanel.setSpacing(2);

    logoutPanel.setCellHorizontalAlignment(logoutImage, HasHorizontalAlignment.ALIGN_RIGHT);
    logoutPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);

    titlePanel.getElement().getStyle().setProperty("marginLeft", "50");
    titleLabel = new HTML("<font size=4>&nbsp;</font>");
    titleLabel.getElement().setId("dashboardTitleLabel");

    titlePanel.add(logoutPanel);
    titlePanel.add(titleLabel);

    titlePanel.setCellHorizontalAlignment(logoutPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    DecoratorPanel titleDecor = new DecoratorPanel();
    titleDecor.setWidth("250px");
    titleDecor.setHeight("30px");
    mainPanel.add(titlePanel);

    mainPanel.setCellVerticalAlignment(logOutLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_LEFT);
    mainPanel.setCellVerticalAlignment(titleLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    Image image = new Image(MdConstants.IMG_TOOLS);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    adminConsoleButton = new PushButton(image);
    adminConsoleButton.getElement().setId("adminConsoleButton");
    adminConsoleButton.setSize("50px", MdConstants.IMG_SIZE);
    adminConsoleButton.setTitle("Show Admin Console");
    adminConsoleButton.setEnabled(false);
    adminConsoleButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            AdminConsole console = new AdminConsole(controller);
        }
    });

    editorDecorator = new DecoratorPanel();
    editorDecorator.setTitle("Dashboard Editor");
    editorDecorator.setWidth("315px");

    toolstripPanel = new DashboardToolStripBar(this);

    dashboardListBox = new ListBox(false);
    dashboardListBox.getElement().setId("dashboardListBox");
    dashboardListBox.setWidth("295px");
    dashboardListBox.setVisibleItemCount(10);
    dashboardListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            dashboardListChanged();
        }
    });

    notesArea = new TextArea();
    notesArea.setVisibleLines(2);
    notesArea.setWidth("290px");
    notesArea.setHeight("50px");
    notesArea.getElement().setId("notesTextArea");

    VerticalPanel editorVerticalPanel = new VerticalPanel();
    editorVerticalPanel.setSpacing(4);
    editorVerticalPanel.add(toolstripPanel);
    editorVerticalPanel.add(dashboardListBox);
    editorVerticalPanel.add(new HTML("<font size=-1><b>Dashboard Notes:</b></font></br>"));
    editorVerticalPanel.add(notesArea);
    editorVerticalPanel.setCellVerticalAlignment(toolstripPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    editorVerticalPanel.setCellHorizontalAlignment(toolstripPanel, HasHorizontalAlignment.ALIGN_CENTER);
    editorDecorator.setWidget(editorVerticalPanel);

    settingsPanel = new DashboardSettingsPanel(this);

    mainPanel.add(editorDecorator);
    mainPanel.add(settingsPanel);
    // mainPanel.add(adminConsoleButton);

    mainPanel.setCellVerticalAlignment(editorDecorator, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(editorDecorator, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(settingsPanel, HasVerticalAlignment.ALIGN_TOP);
    mainPanel.setCellHorizontalAlignment(settingsPanel, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(adminConsoleButton, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(adminConsoleButton, HasHorizontalAlignment.ALIGN_CENTER);

    this.add(mainPanel);
}

From source file:com.goodow.web.ui.client.nav.NavUi.java

License:Apache License

@Inject
NavUi(final TopNavUi top, final TagsUi tags) {
    logger.finest("init start");
    this.top = top;
    this.tags = tags;

    DecoratorPanel panel = new DecoratorPanel();
    panel.setWidget(top);/*from  w  w w . j  av a2s  . c  o  m*/
    // flowPanel.add(panel);
    DecoratorPanel panel2 = new DecoratorPanel();
    panel2.setWidget(tags);
    flowPanel.add(panel2);

    top.setWidth(Nav.WIDTH - PX * 2 - 10 + Unit.PX.getType());
    tags.setWidth(Nav.WIDTH - PX * 2 - 10 + Unit.PX.getType());
    layout.getElement().getStyle().setPadding(PX, Unit.PX);
    // tags.getElement().getStyle().setBorderColor("#E5E5E5");
    // tags.getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
    // tags.getElement().getStyle().setBorderWidth(1, Unit.PX);
    initWidget(layout);
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.HelloGData.java

License:Apache License

/**
 * Invoked when GData has loaded. Build the UI and display the default demo.
 *//*from   w w  w. j a  v  a  2s . c o m*/
public void onGDataLoad() {
    if (User.getStatus() == AuthSubStatus.LOGGING_IN) {
        /*
         * AuthSub causes a refresh of the browser, so if status is LOGGING_IN
         * don't render anything. An empty page refresh is friendlier.
         */
        return;
    }

    DecoratorPanel decorator = new DecoratorPanel();
    decorator.add(outerPanel);

    RootPanel.get().setStylePrimaryName("hm-body");
    RootPanel.get().add(new HTML("<img src='logo-small.png' alt='gwt logo' "
            + "align='absmiddle'><span class='hm-title'>Google GData API Library " + "for GWT Demo</span>"));
    RootPanel.get().add(decorator);

    innerPanel.setStylePrimaryName("hm-innerpanel");
    innerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    innerPanel.setSpacing(10);

    outerPanel.setStylePrimaryName("hm-outerpanel");
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);

    outerPanel.addCell(0);
    outerPanel.addCell(1);
    outerPanel.addCell(2);
    outerPanel.addCell(3);

    outerPanel.setWidget(0, 0,
            new HTML("This GData-enabled application was built using the GData " + "API Library for GWT, "
                    + "<a href=\"http://code.google.com/p/gwt-gdata/\">"
                    + "http://code.google.com/p/gwt-gdata/</a>. "
                    + "The drop down list below allows you to select a scenario that "
                    + "demonstrates a particular capability of the GData support."));

    outerPanel.setWidget(1, 0, innerPanel);

    HorizontalPanel horizPanel = new HorizontalPanel();
    list.setStylePrimaryName("hm-demolistbox");
    list.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            GDataDemoInfo info = list.getGDataDemoSelection();
            if (info == null) {
                showInfo();
            } else {
                show(info);
            }
        }
    });
    description.setStylePrimaryName("hm-description");
    innerPanel.clear();
    innerPanel.add(horizPanel);
    innerPanel.add(description);
    horizPanel.add(new Label("Select Demo: "));
    horizPanel.add(list);
    loadGDataDemos();
    showInfo();
}

From source file:com.google.gwt.gears.sample.workerpool.client.WorkerPoolDemo.java

License:Apache License

private Widget buildControlPanel() {
    VerticalPanel outerPanel = new VerticalPanel();
    DecoratorPanel tableWrapper = new DecoratorPanel();
    FlexTable resultTable = new FlexTable();

    numDigitsListBox.addItem("1,000", "1000");
    numDigitsListBox.addItem("5,000", "5000");
    numDigitsListBox.addItem("10,000", "10000");
    numDigitsListBox.addItem("20,000", "20000");
    numDigitsListBox.addItem("100,000", "100000");
    buildControlPanelRow(resultTable, "Number of Digits to compute: ", numDigitsListBox);

    buildControlPanelRow(resultTable, "Execute calculation using:", syncCalc);
    syncCalc.setChecked(true);/*  w  w w  .  j  av a  2 s .  c  o m*/
    buildControlPanelRow(resultTable, "", asyncCalc);

    startStopButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            if (calculationInProgress) {
                statusLabel.setText(statusLabel.getText() + "...Cancelled");
                stopCalculation();
                return;
            }
            htmlResults.setText("");
            statusLabel.setText("Starting calculation");
            calculationInProgress = true;
            startStopButton.setEnabled(false);
            startStopButton.setText("Working...");

            startTime = System.currentTimeMillis();
            final int numDigits = Integer
                    .valueOf(numDigitsListBox.getValue(numDigitsListBox.getSelectedIndex()));
            if (syncCalc.isChecked()) {
                /*
                 * A DeferredCommand is used here so that the previous updates to the
                 * user interface will appear. The synchronous computation will block
                 * until the calculation is complete, freezing the user interface.
                 */
                DeferredCommand.addCommand(new Command() {
                    public void execute() {
                        doSyncCalculation(numDigits);
                    }
                });
            } else {
                doAsyncCalculation(numDigits);
            }
        }
    });

    buildControlPanelRow(resultTable, "", startStopButton);
    tableWrapper.setWidget(resultTable);

    // Position the Animation so that it looks centered. 
    Widget toy = new AnimationToy();
    AbsolutePanel toyWrapper = new AbsolutePanel();
    toyWrapper.setSize("450px", "210px");
    toyWrapper.add(toy, 70, 0);
    outerPanel.add(toyWrapper);

    HTML desc = new HTML(INTERACTION_DESC);
    desc.setWidth("450px");
    outerPanel.add(desc);
    outerPanel.add(tableWrapper);
    return outerPanel;
}

From source file:com.google.gwt.gears.sample.workerpooldemo.client.WorkerPoolDemo.java

License:Apache License

private Widget buildControlPanel() {
    VerticalPanel outerPanel = new VerticalPanel();
    DecoratorPanel tableWrapper = new DecoratorPanel();
    FlexTable resultTable = new FlexTable();

    numDigitsListBox.addItem("1,000", "1000");
    numDigitsListBox.addItem("5,000", "5000");
    numDigitsListBox.addItem("10,000", "10000");
    numDigitsListBox.addItem("20,000", "20000");
    numDigitsListBox.addItem("100,000", "100000");
    buildControlPanelRow(resultTable, "Number of Digits to compute: ", numDigitsListBox);

    buildControlPanelRow(resultTable, "Execute calculation using:", syncCalc);
    syncCalc.setValue(true);//w  ww.  j  ava  2  s  .  c om
    buildControlPanelRow(resultTable, "", asyncCalc);

    startStopButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (calculationInProgress) {
                statusLabel.setText(statusLabel.getText() + "...Cancelled");
                stopCalculation();
                return;
            }
            htmlResults.setText("");
            statusLabel.setText("Starting calculation");
            calculationInProgress = true;
            startStopButton.setEnabled(false);
            startStopButton.setText("Working...");

            startTime = System.currentTimeMillis();
            final int numDigits = Integer
                    .valueOf(numDigitsListBox.getValue(numDigitsListBox.getSelectedIndex()));
            if (syncCalc.getValue()) {
                /*
                 * A DeferredCommand is used here so that the previous updates to the
                 * user interface will appear. The synchronous computation will block
                 * until the calculation is complete, freezing the user interface.
                 */
                DeferredCommand.addCommand(new Command() {
                    public void execute() {
                        doSyncCalculation(numDigits);
                    }
                });
            } else {
                doAsyncCalculation(numDigits);
            }
        }
    });

    buildControlPanelRow(resultTable, "", startStopButton);
    tableWrapper.setWidget(resultTable);

    // Position the Animation so that it looks centered.
    Widget toy = new AnimationToy();
    AbsolutePanel toyWrapper = new AbsolutePanel();
    toyWrapper.setSize("450px", "210px");
    toyWrapper.add(toy, 70, 0);
    outerPanel.add(toyWrapper);

    HTML desc = new HTML(INTERACTION_DESC);
    desc.setWidth("450px");
    outerPanel.add(desc);
    outerPanel.add(tableWrapper);
    return outerPanel;
}

From source file:com.google.gwt.maps.sample.hellomaps.client.HelloMaps.java

License:Apache License

public void onModuleLoad() {

    if (!Maps.isLoaded()) {
        Window.alert("The Maps API is not installed."
                + "  The <script> tag that loads the Maps API may be missing or your Maps key may be wrong.");
        return;//from   w  ww  .  ja  v  a2s . c o  m
    }

    if (!Maps.isBrowserCompatible()) {
        Window.alert("The Maps API is not compatible with this browser.");
        return;
    }

    // Load all the MapsDemos.
    loadMapsDemos();

    innerPanel.setStylePrimaryName("hm-mapinnerpanel");
    innerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizPanel = new HorizontalPanel();
    list.setStylePrimaryName("hm-demolistbox");
    horizPanel.add(new Label("Select Demo: "));
    horizPanel.add(list);
    innerPanel.add(horizPanel);
    innerPanel.add(description);
    innerPanel.setSpacing(10);

    History.addHistoryListener(this);

    outerPanel.setStylePrimaryName("hm-outerpanel");
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);

    outerPanel.addCell(0);
    outerPanel.addCell(1);
    outerPanel.addCell(2);
    outerPanel.addCell(3);
    outerPanel.addCell(4);

    outerPanel.setWidget(0, 0,
            new HTML("This Maps-enabled application was built using the Google " + "API Library for GWT, "
                    + "<a href=\"http://code.google.com/p/gwt-google-apis/\">"
                    + "http://code.google.com/p/gwt-google-apis/</a>. "
                    + "The drop down list below allows you to select a scenario that "
                    + "demonstrates a particular capability of the Maps support."));

    outerPanel.setWidget(1, 0, innerPanel);

    DecoratorPanel decorator = new DecoratorPanel();
    decorator.add(outerPanel);

    RootPanel.get("hm-map").add(decorator);

    // Show the initial screen.
    String initToken = History.getToken();
    if (initToken.length() > 0) {
        onHistoryChanged(initToken);
    } else {
        showInfo();
    }
}

From source file:com.google.gwt.sample.contacts.client.view.EditContactView.java

public EditContactView() {
    DecoratorPanel contentDetailsDecorator = new DecoratorPanel();
    contentDetailsDecorator.setWidth("18em");
    initWidget(contentDetailsDecorator);

    VerticalPanel contentDetailsPanel = new VerticalPanel();
    contentDetailsPanel.setWidth("100%");

    // Create the contacts list
    ///*from   ww w. jav  a  2 s .c om*/
    detailsTable = new FlexTable();
    detailsTable.setCellSpacing(0);
    detailsTable.setWidth("100%");
    detailsTable.addStyleName("contacts-ListContainer");
    detailsTable.getColumnFormatter().addStyleName(1, "add-contact-input");
    firstName = new TextBox();
    lastName = new TextBox();
    emailAddress = new TextBox();
    initDetailsTable();
    contentDetailsPanel.add(detailsTable);

    HorizontalPanel menuPanel = new HorizontalPanel();
    saveButton = new Button("Save");
    cancelButton = new Button("Cancel");
    menuPanel.add(saveButton);
    menuPanel.add(cancelButton);
    contentDetailsPanel.add(menuPanel);
    contentDetailsDecorator.add(contentDetailsPanel);
}

From source file:com.google.gwt.sample.showcase.client.Application.java

License:Apache License

/**
 * Constructor.// ww  w.ja  v a  2s  .c om
 */
public Application() {
    // Setup the main layout widget
    FlowPanel layout = new FlowPanel();
    initWidget(layout);

    // Setup the top panel with the title and links
    createTopPanel();
    layout.add(topPanel);

    // Add the main menu
    bottomPanel = new HorizontalPanel();
    bottomPanel.setWidth("100%");
    bottomPanel.setSpacing(0);
    bottomPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    layout.add(bottomPanel);
    createMainMenu();
    bottomPanel.add(mainMenu);

    // Setup the content layout
    contentLayout = new Grid(2, 1);
    contentLayout.setCellPadding(0);
    contentLayout.setCellSpacing(0);
    contentDecorator = new DecoratorPanel();
    contentDecorator.setWidget(contentLayout);
    contentDecorator.addStyleName(DEFAULT_STYLE_NAME + "-content-decorator");
    bottomPanel.add(contentDecorator);
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        bottomPanel.setCellHorizontalAlignment(contentDecorator, HasHorizontalAlignment.ALIGN_LEFT);
        contentDecorator.getElement().setAttribute("align", "LEFT");
    } else {
        bottomPanel.setCellHorizontalAlignment(contentDecorator, HasHorizontalAlignment.ALIGN_RIGHT);
        contentDecorator.getElement().setAttribute("align", "RIGHT");
    }
    CellFormatter formatter = contentLayout.getCellFormatter();

    // Add the content title
    setContentTitle(new HTML("Content"));
    formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-content-title");

    // Add the content wrapper
    contentWrapper = new SimplePanel();
    contentLayout.setWidget(1, 0, contentWrapper);
    formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-content-wrapper");
    setContent(null);

    // Add a window resize handler
    Window.addResizeHandler(this);
}