Example usage for com.google.gwt.user.client.ui SplitLayoutPanel addEast

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

Introduction

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

Prototype

public void addEast(Widget widget, double size) 

Source Link

Document

Adds a widget to the east edge of the dock.

Usage

From source file:com.google.gwt.sample.showcase.client.content.panels.CwSplitLayoutPanel.java

License:Apache License

/**
 * Initialize this example.//from www . j ava 2s.  c  o m
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a Split Panel
    SplitLayoutPanel splitPanel = new SplitLayoutPanel(5);
    splitPanel.ensureDebugId("cwSplitLayoutPanel");
    splitPanel.getElement().getStyle().setProperty("border", "3px solid #e7e7e7");

    // Add text all around.
    splitPanel.addNorth(new Label(constants.cwSplitLayoutPanelNorth1()), 50);
    splitPanel.addSouth(new Label(constants.cwSplitLayoutPanelSouth1()), 50);
    splitPanel.addEast(new Label(constants.cwSplitLayoutPanelEast()), 100);
    splitPanel.addWest(new Label(constants.cwSplitLayoutPanelWest()), 100);
    splitPanel.addNorth(new Label(constants.cwSplitLayoutPanelNorth2()), 50);
    splitPanel.addSouth(new Label(constants.cwSplitLayoutPanelSouth2()), 50);

    // Add scrollable text to the center.
    String centerText = constants.cwSplitLayoutPanelCenter();
    for (int i = 0; i < 3; i++) {
        centerText += " " + centerText;
    }
    Label centerLabel = new Label(centerText);
    ScrollPanel centerScrollable = new ScrollPanel(centerLabel);
    splitPanel.add(centerScrollable);

    // Return the content
    return splitPanel;
}

From source file:eml.studio.client.mvp.view.MonitorView.java

License:Open Source License

@Override
public Widget createMainLayout() {
    SplitLayoutPanel splitLayout = new SplitLayoutPanel();

    StackLayoutPanel stack = new StackLayoutPanel(Unit.EM);
    stack.setStyleName("sp");
    ScrollPanel leftcrp = new ScrollPanel();
    leftcrp.setSize("100%", "100%");
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setWidth("100%");

    programTree = ProgramTreeLoader.load(AppController.email);
    datasetTree = DatasetTreeLoader.load(AppController.email);
    jobTree = JobTreeLoader.load(AppController.email);
    resultTree = new SearchTree();
    initTabPanel();/*w  w  w. j a va2  s.  co m*/
    DisclosurePanel distackleft = new DisclosureStackPanel("Search").asWidget();
    searchGrid = new SearchGrid(programTree, datasetTree, jobTree, resultTree);
    distackleft.setContent(searchGrid);
    SimplePanel tabSimPanel = new SimplePanel();
    tabSimPanel.add(tabPanel);

    vPanel.add(tabSimPanel);
    vPanel.add(distackleft);
    leftcrp.add(vPanel);
    stack.add(leftcrp, "", 0);

    StackLayoutPanel stackright = new StackLayoutPanel(Unit.EM);
    stackright.setStyleName("sp");
    DisclosurePanel distackright1 = new DisclosureStackPanel(Constants.studioUIMsg.jobPanelTitle()).asWidget();
    DisclosurePanel distackright2 = new DisclosureStackPanel(Constants.studioUIMsg.modulePanelTitle())
            .asWidget();
    ScrollPanel scvp = new ScrollPanel();
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setWidth("100%");

    HorizontalPanel btnPanel = new HorizontalPanel();
    historyBtn.removeStyleName("gwt-Button");
    historyBtn.addStyleName("history-button-style");
    submitBtn.setEnabled(false);
    submitBtn.removeStyleName("gwt-Button");
    submitBtn.addStyleName("button-style");
    clearBtn.removeStyleName("gwt-Button");
    clearBtn.addStyleName("button-style");
    cloneBtn.removeStyleName("gwt-Button");
    cloneBtn.addStyleName("button-style");
    refreshBtn.removeStyleName("gwt-Button");
    refreshBtn.addStyleName("button-style");
    stopBtn.removeStyleName("gwt-Button");
    stopBtn.addStyleName("button-style");

    btnPanel.add(historyBtn);
    btnPanel.add(new HTML("&nbsp;&nbsp;"));
    btnPanel.add(submitBtn);
    btnPanel.add(new HTML("&nbsp;&nbsp;"));
    btnPanel.add(clearBtn);
    btnPanel.add(new HTML("&nbsp;&nbsp;"));
    btnPanel.add(cloneBtn);
    btnPanel.add(new HTML("&nbsp;&nbsp;"));
    btnPanel.add(stopBtn);
    btnPanel.add(new HTML("&nbsp;&nbsp;"));
    btnPanel.add(refreshBtn);

    btnPanel2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    btnPanel2.add(btnPanel);
    btnPanel2.addStyleName("btnPanel");

    splitLayout.addWest(stack, 200);

    jobDescGrid = new MonitorJobDescGrid();

    distackright1.setContent(jobDescGrid);
    distackright2.setContent(propPanel);
    verticalPanel.add(distackright1);
    verticalPanel.add(distackright2);
    scvp.add(verticalPanel);
    stackright.add(scvp, "", 0);
    splitLayout.addEast(stackright, 287);

    // Use different controllers in different classes
    setController(new MonitorController(Constants.CONTROLLER_WIDTH, Constants.CONTROLLER_HEIGHT));
    rebuiltLayoutPanel(getController());
    splitLayout.add(layoutPanel);

    return splitLayout;
}

From source file:org.apache.luke.client.LukeInspector.java

License:Apache License

public void onModuleLoad() {
    final RootPanel rootPanel = RootPanel.get();

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("New panel");
    cptnpnlNewPanel.setCaptionHTML("Luke version 5.0");
    rootPanel.add(cptnpnlNewPanel, 10, 10);
    cptnpnlNewPanel.setSize("959px", "652px");

    TabPanel tabPanel = new TabPanel();
    cptnpnlNewPanel.setContentWidget(tabPanel);
    tabPanel.setSize("5cm", "636px");

    //LuceneIndexLoader.loadIndex(pName, this);

    SplitLayoutPanel splitLayoutPanel = new SplitLayoutPanel();
    tabPanel.add(splitLayoutPanel, "Index overview", false);
    tabPanel.setVisible(true);//from  w w w.ja  v a2  s  .  c o m
    splitLayoutPanel.setSize("652px", "590px");

    SplitLayoutPanel splitLayoutPanel_1 = new SplitLayoutPanel();
    splitLayoutPanel.addNorth(splitLayoutPanel_1, 288.0);

    Label lblIndexStatistics = new Label("Index statistics");
    lblIndexStatistics.setDirectionEstimator(true);
    lblIndexStatistics.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    splitLayoutPanel_1.addNorth(lblIndexStatistics, 26.0);

    VerticalPanel verticalPanel = new VerticalPanel();
    splitLayoutPanel_1.addWest(verticalPanel, 125.0);

    Label lblTest = new Label("Index name:");
    verticalPanel.add(lblTest);
    lblTest.setWidth("109px");

    Label lblTest_1 = new Label("# fields:");
    verticalPanel.add(lblTest_1);

    Label lblNumber = new Label("# documents:");
    verticalPanel.add(lblNumber);
    lblNumber.setWidth("101px");

    Label lblTerms = new Label("# terms:");
    verticalPanel.add(lblTerms);

    Label lblHasDeletions = new Label("Has deletions?");
    verticalPanel.add(lblHasDeletions);

    Label lblNewLabel = new Label("Optimised?");
    verticalPanel.add(lblNewLabel);

    Label lblIndexVersion = new Label("Index version:");
    verticalPanel.add(lblIndexVersion);

    SplitLayoutPanel splitLayoutPanel_2 = new SplitLayoutPanel();
    splitLayoutPanel.addWest(splitLayoutPanel_2, 240.0);

    // Create name column.
    TextColumn<Field> nameColumn = new TextColumn<Field>() {
        @Override
        public String getValue(Field field) {
            return field.getName();
        }
    };

    // Make the name column sortable.
    nameColumn.setSortable(true);

    // Create termCount column.
    TextColumn<Field> termCountColumn = new TextColumn<Field>() {
        @Override
        public String getValue(Field contact) {
            return contact.getTermCount();
        }
    };

    // Create decoder column.
    TextColumn<Field> decoderColumn = new TextColumn<Field>() {
        @Override
        public String getValue(Field contact) {
            return contact.getDecoder();
        }
    };

    final CellTable<Field> cellTable = new CellTable<Field>();

    cellTable.addColumn(nameColumn, "Name");
    cellTable.addColumn(termCountColumn, "Term count");
    cellTable.addColumn(decoderColumn, "Decoder");

    cellTable.setRowCount(FieldsDummyData.Fields.size(), true);
    // Set the range to display. In this case, our visible range is smaller than
    // the data set.
    cellTable.setVisibleRange(0, 3);

    // Create a data provider.
    AsyncDataProvider<Field> dataProvider = new AsyncDataProvider<Field>() {
        @Override
        protected void onRangeChanged(HasData<Field> display) {
            final Range range = display.getVisibleRange();

            // Get the ColumnSortInfo from the table.
            final ColumnSortList sortList = cellTable.getColumnSortList();

            // This timer is here to illustrate the asynchronous nature of this data
            // provider. In practice, you would use an asynchronous RPC call to
            // request data in the specified range.
            new Timer() {
                @Override
                public void run() {
                    int start = range.getStart();
                    int end = start + range.getLength();
                    // This sorting code is here so the example works. In practice, you
                    // would sort on the server.
                    Collections.sort(FieldsDummyData.Fields, new Comparator<Field>() {
                        public int compare(Field o1, Field o2) {
                            if (o1 == o2) {
                                return 0;
                            }

                            // Compare the name columns.
                            int diff = -1;
                            if (o1 != null) {
                                diff = (o2 != null) ? o1.getName().compareTo(o2.getName()) : 1;
                            }
                            return sortList.get(0).isAscending() ? diff : -diff;
                        }
                    });
                    List<Field> dataInRange = FieldsDummyData.Fields.subList(start, end);

                    // Push the data back into the list.
                    cellTable.setRowData(start, dataInRange);
                }
            }.schedule(2000);
        }
    };

    // Connect the list to the data provider.
    dataProvider.addDataDisplay(cellTable);

    // Add a ColumnSortEvent.AsyncHandler to connect sorting to the
    // AsyncDataPRrovider.
    AsyncHandler columnSortHandler = new AsyncHandler(cellTable);
    cellTable.addColumnSortHandler(columnSortHandler);

    // We know that the data is sorted alphabetically by default.
    cellTable.getColumnSortList().push(nameColumn);

    splitLayoutPanel_2.add(cellTable);

    SplitLayoutPanel splitLayoutPanel_3 = new SplitLayoutPanel();
    splitLayoutPanel.addEast(splitLayoutPanel_3, 215.0);

    StackPanel stackPanel = new StackPanel();
    rootPanel.add(stackPanel, 714, 184);
    stackPanel.setSize("259px", "239px");

    FlowPanel flowPanel = new FlowPanel();
    stackPanel.add(flowPanel, "Open index", false);
    flowPanel.setSize("100%", "100%");

    TextBox textBox = new TextBox();
    flowPanel.add(textBox);

    Button btnNewButton = new Button("...");
    btnNewButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            DirectoryLister directoryLister = new DirectoryLister();
            directoryLister.setPopupPosition(rootPanel.getAbsoluteLeft() + rootPanel.getOffsetWidth() / 2,
                    rootPanel.getAbsoluteTop() + rootPanel.getOffsetHeight() / 2);
            directoryLister.show();

        }
    });
    flowPanel.add(btnNewButton);

    // exception handling
    // credits: http://code.google.com/p/mgwt/source/browse/src/main/java/com/googlecode/mgwt/examples/showcase/client/ShowCaseEntryPoint.java?repo=showcase
    GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {

        @Override
        public void onUncaughtException(Throwable e) {
            Window.alert("uncaught: " + e.getMessage());
            String s = buildStackTrace(e, "RuntimeExceotion:\n");
            Window.alert(s);
            e.printStackTrace();

        }
    });

}