Example usage for com.google.gwt.user.client.ui DockPanel setCellWidth

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

Introduction

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

Prototype

@Override
    public void setCellWidth(Widget w, String width) 

Source Link

Usage

From source file:org.pentaho.pac.client.datasources.NewDataSourceDialogBox.java

License:Open Source License

public NewDataSourceDialogBox() {
    super(Messages.getString("addDataSource"), Messages.getString("ok"), Messages.getString("cancel"), false, //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
            true);/* www.ja  v  a2  s.c o m*/
    DockPanel dockPanel = new DockPanel();

    generalButton = new ToggleButton(Messages.getString("general"), Messages.getString("general")); //$NON-NLS-1$ //$NON-NLS-2$
    advanceButton = new ToggleButton(Messages.getString("advance"), Messages.getString("advance")); //$NON-NLS-1$ //$NON-NLS-2$
    testButton = new RoundedButton(Messages.getString("test")); //$NON-NLS-1$
    testButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            testDataSourceConnection();
        }
    });

    setTitle(Messages.getString("addDataSource")); //$NON-NLS-1$
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    dataSourceGeneralPanel = new DataSourceGeneralPanel();
    horizontalPanel.add(generalButton);
    dataSourceAdvancePanel = new DataSourceAdvancePanel();
    horizontalPanel.add(advanceButton);
    dockPanel.add(horizontalPanel, DockPanel.NORTH);
    dockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    dockPanel.setSpacing(10);
    generalButton.setTitle(Messages.getString("clickAddGeneral")); //$NON-NLS-1$
    advanceButton.setTitle(Messages.getString("clickAddAdvance")); //$NON-NLS-1$

    generalButton.setStylePrimaryName("generalToggleBtn"); //$NON-NLS-1$
    advanceButton.setStylePrimaryName("advanceToggleBtn"); //$NON-NLS-1$
    deckPanel = new DeckPanel();
    deckPanel.add(dataSourceGeneralPanel);
    deckPanel.add(dataSourceAdvancePanel);
    dockPanel.add(deckPanel, DockPanel.CENTER);
    dockPanel.setCellWidth(deckPanel, "100%"); //$NON-NLS-1$
    dockPanel.setCellHeight(deckPanel, "100%"); //$NON-NLS-1$
    deckPanel.setWidth("100%"); //$NON-NLS-1$
    deckPanel.setHeight("100%"); //$NON-NLS-1$
    deckPanel.setStyleName("newDataSourceDialogBox.detailsPanel"); //$NON-NLS-1$
    deckPanel.showWidget(GENERAL_PANEL_ID);
    dockPanel.add(testButton, DockPanel.SOUTH);
    generalButton.setDown(true);
    advanceButton.setDown(false);
    generalButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (!generalButton.isDown()) {
                generalButton.setDown(true);
            } else {
                advanceButton.setDown(false);
                deckPanel.showWidget(GENERAL_PANEL_ID);
            }
        }
    });
    advanceButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (!advanceButton.isDown()) {
                advanceButton.setDown(true);
            } else {
                generalButton.setDown(false);
                deckPanel.showWidget(ADVANCE_PANEL_ID);
            }
        }
    });

    dataSourceGeneralPanel.setWidth("100%"); //$NON-NLS-1$
    dataSourceGeneralPanel.setHeight("100%"); //$NON-NLS-1$
    dataSourceAdvancePanel.setWidth("100%"); //$NON-NLS-1$
    dataSourceAdvancePanel.setHeight("100%"); //$NON-NLS-1$

    setContent(dockPanel);
    dockPanel.setWidth("350px");
}

From source file:org.pentaho.pac.client.roles.RolesPanel.java

License:Open Source License

public DockPanel buildRoleDetailsPanel() {

    DockPanel assignedRolesPanel = buildAssignedUsersPanel();

    DockPanel dockPanel = new DockPanel();
    dockPanel.add(new Label(Messages.getString("userDetails")), DockPanel.NORTH); //$NON-NLS-1$
    dockPanel.add(roleDetailsPanel, DockPanel.NORTH);
    dockPanel.add(updateRoleBtn, DockPanel.NORTH);

    SimplePanel spacerPanel = new SimplePanel();
    spacerPanel.add(new Label(" ")); //$NON-NLS-1$
    dockPanel.add(spacerPanel, DockPanel.NORTH);
    dockPanel.setCellHeight(spacerPanel, "10px"); //$NON-NLS-1$

    dockPanel.add(assignedRolesPanel, DockPanel.CENTER);

    dockPanel.setCellHorizontalAlignment(updateRoleBtn, HasHorizontalAlignment.ALIGN_RIGHT);

    dockPanel.setCellWidth(roleDetailsPanel, "100%"); //$NON-NLS-1$
    dockPanel.setCellHeight(assignedRolesPanel, "100%"); //$NON-NLS-1$
    dockPanel.setCellWidth(assignedRolesPanel, "100%"); //$NON-NLS-1$

    roleDetailsPanel.setWidth("100%"); //$NON-NLS-1$
    assignedRolesPanel.setWidth("100%"); //$NON-NLS-1$
    assignedRolesPanel.setHeight("100%"); //$NON-NLS-1$

    updateRoleBtn.addClickListener(this);
    return dockPanel;
}

From source file:org.pentaho.pac.client.roles.RolesPanel.java

License:Open Source License

public DockPanel buildRolesListPanel() {
    DockPanel headerDockPanel = new DockPanel();
    headerDockPanel.add(deleteRoleBtn, DockPanel.EAST);
    VerticalPanel spacer = new VerticalPanel();
    spacer.setWidth("2"); //$NON-NLS-1$
    headerDockPanel.add(spacer, DockPanel.EAST);
    headerDockPanel.add(addRoleBtn, DockPanel.EAST);
    Label label = new Label(Messages.getString("roles")); //$NON-NLS-1$
    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); //$NON-NLS-1$
    DockPanel roleListPanel = new DockPanel();
    roleListPanel.add(headerDockPanel, DockPanel.NORTH);
    roleListPanel.add(rolesList, DockPanel.CENTER);
    roleListPanel.add(filterTextBox, DockPanel.SOUTH);
    roleListPanel.add(new Label(Messages.getString("filter")), DockPanel.SOUTH); //$NON-NLS-1$

    roleListPanel.setCellHeight(rolesList, "100%"); //$NON-NLS-1$
    roleListPanel.setCellWidth(rolesList, "100%"); //$NON-NLS-1$
    roleListPanel.setHeight("100%"); //$NON-NLS-1$
    roleListPanel.setWidth("100%"); //$NON-NLS-1$
    rolesList.setHeight("100%"); //$NON-NLS-1$
    rolesList.setWidth("100%"); //$NON-NLS-1$
    filterTextBox.setWidth("100%"); //$NON-NLS-1$
    deleteRoleBtn.setEnabled(false);//from   ww  w  .  ja  v  a  2 s  . c o m

    filterTextBox.addKeyboardListener(this);
    rolesList.addChangeListener(this);
    addRoleBtn.addClickListener(this);
    deleteRoleBtn.addClickListener(this);
    return roleListPanel;
}

From source file:org.pentaho.pac.client.roles.RolesPanel.java

License:Open Source License

public DockPanel buildAssignedUsersPanel() {
    DockPanel headerDockPanel = new DockPanel();
    headerDockPanel.add(deleteRoleAssignmentBtn, DockPanel.EAST);
    VerticalPanel spacer = new VerticalPanel();
    spacer.setWidth("2"); //$NON-NLS-1$
    headerDockPanel.add(spacer, DockPanel.EAST);
    headerDockPanel.add(addRoleAssignmentBtn, DockPanel.EAST);
    Label label = new Label(Messages.getString("assignedUsers")); //$NON-NLS-1$
    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); //$NON-NLS-1$

    DockPanel assignedUsersPanel = new DockPanel();
    assignedUsersPanel.add(headerDockPanel, DockPanel.NORTH);
    assignedUsersPanel.add(assignedUsersList, DockPanel.CENTER);
    assignedUsersPanel.setCellHeight(assignedUsersList, "100%"); //$NON-NLS-1$
    assignedUsersPanel.setCellWidth(assignedUsersList, "100%"); //$NON-NLS-1$
    assignedUsersList.setHeight("100%"); //$NON-NLS-1$
    assignedUsersList.setWidth("100%"); //$NON-NLS-1$

    assignedUsersList.addChangeListener(this);
    deleteRoleAssignmentBtn.addClickListener(this);
    addRoleAssignmentBtn.addClickListener(this);
    return assignedUsersPanel;
}

From source file:org.pentaho.pac.client.users.UsersPanel.java

License:Open Source License

public VerticalPanel buildUsersListPanel() {
    DockPanel headerDockPanel = new DockPanel();
    headerDockPanel.add(deleteUserBtn, DockPanel.EAST);
    VerticalPanel spacer = new VerticalPanel();
    spacer.setWidth("2"); //$NON-NLS-1$
    headerDockPanel.add(spacer, DockPanel.EAST);
    headerDockPanel.add(addUserBtn, DockPanel.EAST);
    Label label = new Label("Users"); //$NON-NLS-1$
    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); //$NON-NLS-1$
    VerticalPanel userListPanel = new VerticalPanel();
    userListPanel.add(headerDockPanel);/*w  w w  .ja va 2  s .c om*/
    userListPanel.add(usersList);
    userListPanel.add(new Label(Messages.getString("filter"))); //$NON-NLS-1$
    userListPanel.add(filterTextBox);

    userListPanel.setCellHeight(usersList, "100%"); //$NON-NLS-1$
    userListPanel.setCellWidth(usersList, "100%"); //$NON-NLS-1$
    userListPanel.setHeight("100%"); //$NON-NLS-1$
    userListPanel.setWidth("100%"); //$NON-NLS-1$
    usersList.setHeight("100%"); //$NON-NLS-1$
    usersList.setWidth("100%"); //$NON-NLS-1$
    filterTextBox.setWidth("100%"); //$NON-NLS-1$
    deleteUserBtn.setEnabled(false);

    filterTextBox.addKeyboardListener(this);
    usersList.addChangeListener(this);
    addUserBtn.addClickListener(this);
    deleteUserBtn.addClickListener(this);
    return userListPanel;
}

From source file:org.pentaho.pac.client.users.UsersPanel.java

License:Open Source License

public VerticalPanel buildAssignedRolesPanel() {
    DockPanel headerDockPanel = new DockPanel();

    VerticalPanel fieldsetPanel = new VerticalPanel();

    Label label = new Label(Messages.getString("assignedRoles")); //$NON-NLS-1$
    Label spacer = new Label(""); //$NON-NLS-1$

    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); //$NON-NLS-1$
    headerDockPanel.add(deleteRoleAssignmentBtn, DockPanel.EAST);
    VerticalPanel spacer2 = new VerticalPanel();
    spacer2.setWidth("2"); //$NON-NLS-1$
    headerDockPanel.add(spacer2, DockPanel.EAST);
    headerDockPanel.add(addRoleAssignmentBtn, DockPanel.EAST);

    headerDockPanel.add(spacer, DockPanel.WEST);
    headerDockPanel.setCellWidth(spacer, "100%"); //$NON-NLS-1$

    DockPanel assignedRolesPanel = new DockPanel();
    assignedRolesPanel.add(headerDockPanel, DockPanel.NORTH);
    assignedRolesPanel.add(assignedRolesList, DockPanel.CENTER);
    assignedRolesPanel.setCellHeight(assignedRolesList, "100%"); //$NON-NLS-1$
    assignedRolesPanel.setCellWidth(assignedRolesList, "100%"); //$NON-NLS-1$
    assignedRolesList.setHeight("100%"); //$NON-NLS-1$
    assignedRolesList.setWidth("100%"); //$NON-NLS-1$

    assignedRolesList.addChangeListener(this);
    deleteRoleAssignmentBtn.addClickListener(this);
    addRoleAssignmentBtn.addClickListener(this);

    fieldsetPanel.add(assignedRolesPanel);
    assignedRolesPanel.setWidth("100%"); //$NON-NLS-1$
    assignedRolesPanel.setHeight("100%"); //$NON-NLS-1$
    return fieldsetPanel;
}

From source file:org.phrasebook.transword.client.CwAdminTerminBox.java

License:Apache License

/**
 * Initialize this example.//from ww w.  j a  v  a2 s  .c o m
 */
@Override
public Widget onInitialize() {

    // Top ToolBar panel
    final Button newFE = new Button(constants.cwNewFE());
    final Button newRefresh = new Button("Refresh");
    final Button newEdit = new Button("Edit");

    final TextBoxAdvanced searchFilter = new TextBoxAdvanced();

    newEdit.setEnabled(false);
    DockPanel admin = new DockPanel();

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(5);
    hPanel.add(newFE);

    HorizontalPanel sPanel = new HorizontalPanel();
    sPanel.setSpacing(5);
    sPanel.add(searchFilter);

    hPanel.add(newRefresh);
    hPanel.add(newEdit);

    VerticalPanel svPanel = new VerticalPanel();
    svPanel.add(hPanel);
    svPanel.add(sPanel);

    searchFilter.addValueChangeHandler(new IStringValueChanged() {
        public void valueChanged(String newValue) {
            dataProvider.setFilter(newValue);
            dataProvider.refresh();
        }
    });

    admin.add(svPanel, DockPanel.NORTH);

    NewFEHandler handler = new NewFEHandler();
    newFE.addClickHandler(handler);

    NewRefFEHandler refhandler = new NewRefFEHandler();

    NewEditFEHandler edithandler = new NewEditFEHandler();
    newRefresh.addClickHandler(refhandler);

    newEdit.addClickHandler(edithandler);

    // Create a DataGrid.
    /*
     * Set a key provider that provides a unique key for each contact. If
     * key is used to identify contacts when fields (such as the name and
     * address) change.
     */
    dataGrid = new DataGrid<FixedExpression>();
    dataGrid.setWidth("100%");

    /*
     * Do not refresh the headers every time the data is updated. The footer
     * depends on the current data, so we do not disable auto refresh on the
     * footer.
     */
    dataGrid.setAutoHeaderRefreshDisabled(true);
    // Set the message to display when the table is empty.

    // Create a Pager to control the table.
    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
    pager.setDisplay(dataGrid);
    pager.setVisible(true);

    //dataProvider = new FilteredListDataProvider<FixedExpression>();

    dataProvider.setList(new ArrayList<FixedExpression>());
    dataGrid.setEmptyTableWidget(new Label("Loading, please wait. There are no fixed expressions yet!"));

    // Attach a column sort handler to the ListDataProvider to sort the
    // list.
    final DialogBox dlgBox = new DialogBox();
    final HTML serverResponseLabel = new HTML();
    final Button clsButton = new Button("Close");

    dlgBox.setText("Fixed Expression Result");
    dlgBox.setAnimationEnabled(true);
    // We can set the id of a widget by accessing its
    // Element
    clsButton.getElement().setId("closeButton");
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(clsButton);
    dlgBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    clsButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dlgBox.hide();
        }
    });

    final List<FixedExpression> lst = new ArrayList<FixedExpression>();

    feService.listFixedExpression(new AsyncCallback<List<FixedExpression>>() {
        public void onFailure(Throwable caught) {
            // Show the RPC error message to the
            // user
            dlgBox.setText("Remote Procedure Call - Failure");
            serverResponseLabel.addStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(SERVER_ERROR + caught.toString());
            dlgBox.center();
            clsButton.setFocus(true);
        }

        public void onSuccess(List<FixedExpression> list) {

            for (FixedExpression f : list) {
                lst.add(f);
            }
            dlgBox.setText("Fixed Expression - Add Result");
            serverResponseLabel.removeStyleName("Server Response Label Error");
            serverResponseLabel.setHTML("OK" + lst.size());
            // dlgBox.center();
            clsButton.setFocus(true);
        }
    });
    ListHandler<FixedExpression> sortHandler = new ListHandler<FixedExpression>(dataProvider.getList());
    dataGrid.addColumnSortHandler(sortHandler);

    final NoSelectionModel<FixedExpression> selectionModel = new NoSelectionModel<FixedExpression>();

    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        public void onSelectionChange(SelectionChangeEvent event) {
            @SuppressWarnings("unchecked")
            NoSelectionModel<FixedExpression> sel = (NoSelectionModel<FixedExpression>) event.getSource();
            selExpression.setCoreString(sel.getLastSelectedObject().getCoreString());
            selExpression.setId(sel.getLastSelectedObject().getId());
            if (selExpression.getId() != null) {
                newEdit.setEnabled(true);
            } else {
                newEdit.setEnabled(false);
            }
        }
    });

    dataGrid.setSelectionModel(selectionModel);// ,
    // DefaultSelectionEventManager.<FixedExpression>
    // createCheckboxManager());
    // dataGrid.setSele
    dataGrid.setVisible(true);
    initTableColumns(selectionModel, sortHandler);
    dataProvider.addDataDisplay(dataGrid);
    dataGrid.addColumnSortHandler(sortHandler);

    // dataGrid.add

    admin.add(dataGrid, DockPanel.CENTER);
    admin.add(pager, DockPanel.SOUTH);

    admin.setWidth("100%");
    dataGrid.setHeight("450px");
    admin.setCellWidth(dataGrid, "100%");
    admin.setCellWidth(pager, "100%");

    Timer t = new Timer() {
        public void run() {
            dataList = lst;
            List<FixedExpression> list2 = dataProvider.getList();
            list2.addAll(dataList);
            dataProvider.refresh();
        }
    };

    // Schedule the timer to run once in 40 seconds.
    t.schedule(40000);
    return admin;
}

From source file:org.phrasebook.transword.client.CwDictionaryPanel.java

License:Apache License

/**
 * Initialize this example./*from www.jav  a  2 s  . c o  m*/
 */
@Override
public Widget onInitialize() {

    final Button understand = new Button(constants.cwUnderstandPhrase());

    final Button use = new Button(constants.cwUsePhrase());

    final Button mean = new Button(constants.cwSearchByMeanPhrase());

    final Button info = new Button(constants.cwAddInfo());

    HorizontalPanel sPanel = new HorizontalPanel();
    sPanel.setSpacing(5);
    sPanel.add(searchFilter);

    searchFilter.addValueChangeHandler(new IStringValueChanged() {
        public void valueChanged(String newValue) {
            dataProvider.setFilter(newValue);
            dataProvider.refresh();
        }
    });

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(5);

    hPanel.add(understand);
    hPanel.add(use);
    hPanel.add(mean);
    hPanel.add(info);

    VerticalPanel svPanel = new VerticalPanel();
    svPanel.add(sPanel);
    svPanel.add(hPanel);

    // Top ToolBar panel
    DockPanel admin = new DockPanel();
    admin.add(svPanel, DockPanel.NORTH);

    UnderstandHandler handler = new UnderstandHandler();
    understand.addClickHandler(handler);

    MeanHandler mhandler = new MeanHandler();
    mean.addClickHandler(mhandler);

    InfoHandler ihandler = new InfoHandler();
    info.addClickHandler(ihandler);

    UseHandler uhandler = new UseHandler();
    use.addClickHandler(uhandler);

    // DATA GRID OUT

    // Create a DataGrid.
    /*
     * Set a key provider that provides a unique key for each contact. If
     * key is used to identify contacts when fields (such as the name and
     * address) change.
     */
    dataGrid = new DataGrid<FixedExpression>();
    dataGrid.setWidth("100%");

    /*
     * Do not refresh the headers every time the data is updated. The footer
     * depends on the current data, so we do not disable auto refresh on the
     * footer.
     */
    // dataGrid.setAutoHeaderRefreshDisabled(true);
    // Set the message to display when the table is empty.

    // Create a Pager to control the table.
    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
    pager.setDisplay(dataGrid);
    pager.setVisible(true);

    // dataProvider = new FilteredListDataProvider<FixedExpression>();

    dataProvider.setList(new ArrayList<FixedExpression>());
    dataGrid.setEmptyTableWidget(new Label("Loading, please wait. There are no fixed expressions yet!"));

    sortHandler = new ListHandler<FixedExpression>(dataProvider.getList());
    dataGrid.addColumnSortHandler(sortHandler);

    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        public void onSelectionChange(SelectionChangeEvent event) {
            @SuppressWarnings("unchecked")
            NoSelectionModel<FixedExpression> sel = (NoSelectionModel<FixedExpression>) event.getSource();
            selExpression.setCoreString(sel.getLastSelectedObject().getCoreString());
            selExpression.setId(sel.getLastSelectedObject().getId());
            if (selExpression.getId() != null) {
                understand.setEnabled(true);
            } else {
                understand.setEnabled(false);
            }
        }
    });

    dataGrid.setSelectionModel(selectionModel);// ,
    // DefaultSelectionEventManager.<FixedExpression>
    // createCheckboxManager());
    // dataGrid.setSele
    dataGrid.setVisible(true);
    // initTableColumns(selectionModel, sortHandler);
    dataProvider.addDataDisplay(dataGrid);
    dataGrid.addColumnSortHandler(sortHandler);

    // dataGrid.add

    admin.add(dataGrid, DockPanel.CENTER);
    admin.add(pager, DockPanel.SOUTH);

    admin.setWidth("100%");
    dataGrid.setHeight("450px");
    admin.setCellWidth(dataGrid, "100%");
    admin.setCellWidth(pager, "100%");

    // Timer t = new Timer() {
    // public void run() {
    dataList = lst;
    List<FixedExpression> list2 = dataProvider.getList();
    list2.addAll(dataList);
    dataProvider.refresh();
    // }
    // };

    // Schedule the timer to run once in 40 seconds.
    // t.schedule(10000);
    return admin;
}

From source file:org.quartz.GWTQuartzManager.client.QuartzManager.java

License:Open Source License

public void onModuleLoad() {
    //catch exception
    GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable e) {
            log.log(Level.SEVERE, e.getMessage(), e);
        }//from   w w w .ja  v  a  2s  .  co m
    });
    Logger.getLogger("").addHandler(new ErrorDialog().getHandler());

    eventBus.addHandler(TriggerJobEvent.TYPE, new TriggerJobEvent.Handler() {
        @Override
        public void fireTrigger(GWTJobDetail jobDetail) {
            scheduler.triggerJob(jobDetail.getKey(), new GWTQuartzScheduler.nopAsynCallback<Void>());
        }
    });

    eventBus.addHandler(DeleteJobEvent.TYPE, new DeleteJobEvent.Handler() {

        @Override
        public void deleteJob(GWTJobDetail jobDetail) {
            scheduler.deleteJob(jobDetail.getKey(), new AsyncCallback<Boolean>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onSuccess(Boolean result) {
                    updateJobs();
                }
            });
        }
    });

    eventBus.addHandler(EditTriggerEvent.TYPE, new EditTriggerEvent.Handler() {

        @Override
        public void startEdit(GWTTrigger trigger) {
            //TODO in the future, there may be some subclasses of GWTTrigger other than WGTCronTrigger.
            //do instanceof check
            EditCronTriggerWorkflow newTriggerWorkflow = new EditCronTriggerWorkflow(scheduler);
            newTriggerWorkflow.edit((GWTCronTrigger) trigger);
        }
    });

    eventBus.addHandler(ToggleTriggerStateEvent.TYPE, new ToggleTriggerStateEvent.Handler() {

        @Override
        public void resume(GWTTrigger trigger) {
            scheduler.resumeTrigger(trigger.getKey(), new GWTQuartzScheduler.nopAsynCallback<Void>());
        }

        @Override
        public void pause(GWTTrigger trigger) {
            scheduler.pauseTrigger(trigger.getKey(), new GWTQuartzScheduler.nopAsynCallback<Void>());
        }
    });

    eventBus.addHandler(EditJobEvent.TYPE, new EditJobEvent.Handler() {

        @Override
        public void editJob(GWTJobDetail jobDetail, boolean create) {
            new EditJobDetailWorkflow(scheduler, create).edit(jobDetail);
        }
    });

    RootPanel rootPanel = RootPanel.get();
    rootPanel.setSize("100%", "100%");

    DockPanel dockPanel = new DockPanel();
    rootPanel.add(dockPanel);
    dockPanel.setSize("", "100%");

    SimplePanel simplePanel = new SimplePanel();
    simplePanel.add(new SchedulerAdminButtonsWidget(scheduler));
    dockPanel.add(simplePanel, DockPanel.NORTH);

    SimplePanel simplePanel_1 = new SimplePanel();
    dockPanel.add(simplePanel_1, DockPanel.EAST);
    dockPanel.setCellWidth(simplePanel_1, "20%");
    simplePanel_1.setWidth("");

    executedJobsTable = new CellTable<GWTQuartzJobExecutionContext>();
    simplePanel_1.setWidget(executedJobsTable);
    executedJobsTable.setSize("100%", "100%");
    executedJobsTable.setTableLayoutFixed(false);

    TextColumn<GWTQuartzJobExecutionContext> ejJobName = new TextColumn<GWTQuartzJobExecutionContext>() {
        @Override
        public String getValue(GWTQuartzJobExecutionContext object) {
            return object.getJobKey().getName();
        }
    };
    executedJobsTable.addColumn(ejJobName, "job name");

    TextColumn<GWTQuartzJobExecutionContext> ejTriggerName = new TextColumn<GWTQuartzJobExecutionContext>() {
        @Override
        public String getValue(GWTQuartzJobExecutionContext object) {
            return object.getTriggerKey().getName();
        }
    };
    executedJobsTable.addColumn(ejTriggerName, "trigger name");

    Column<GWTQuartzJobExecutionContext, Number> ejRunTime = new Column<GWTQuartzJobExecutionContext, Number>(
            new NumberCell()) {
        @Override
        public Number getValue(GWTQuartzJobExecutionContext object) {
            return new Long(object.getJobRunTime());
        }
    };
    executedJobsTable.addColumn(ejRunTime, "run time");
    jobExecuationContextsProvider.addDataDisplay(executedJobsTable);

    final TabPanel tabPanel = new TabPanel();
    dockPanel.add(tabPanel, DockPanel.CENTER);
    dockPanel.setCellHeight(tabPanel, "100%");
    tabPanel.setSize("100%", "100%");
    VerticalPanel verticalPanel = new VerticalPanel();
    tabPanel.add(verticalPanel, "Jobs", false);
    verticalPanel.setSize("100%", "100%");
    tabPanel.selectTab(0);

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    verticalPanel.add(horizontalPanel_1);
    verticalPanel.setCellHeight(horizontalPanel_1, "22");
    verticalPanel.setCellWidth(horizontalPanel_1, "100%");

    Label lblNewLabel = new Label("Job Group");
    horizontalPanel_1.add(lblNewLabel);
    lblNewLabel.setWidth("67px");

    cbGroupName = new ListBox();
    horizontalPanel_1.add(cbGroupName);

    cbGroupName.addItem(ALL_GROUPS);
    cbGroupName.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            updateJobs();
        }
    });

    final SimplePanel jobPanel = new SimplePanel();
    verticalPanel.add(jobPanel);
    verticalPanel.setCellHeight(jobPanel, "100%");
    verticalPanel.setCellWidth(jobPanel, "100%");
    jobPanel.setSize("100%", "");
    jobPanel.setStyleName("boxed");
    final JobsTable jobsTable = new JobsTable(jobsProvider, eventBus);
    jobPanel.add(jobsTable);
    jobsTable.setSize("100%", "397px");

    VerticalPanel verticalPanel_1 = new VerticalPanel();
    tabPanel.add(verticalPanel_1, "triggers", false);
    verticalPanel_1.setSize("100%", "100%");

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_2);
    verticalPanel_1.setCellWidth(horizontalPanel_2, "100%");
    verticalPanel_1.setCellHeight(horizontalPanel_2, "22");

    Label lblGroup = new Label("Trigger Group");
    horizontalPanel_2.add(lblGroup);

    cbTriggerGroup = new ListBox();
    cbTriggerGroup.addItem(ALL_GROUPS);
    cbTriggerGroup.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            updateTriggers();
        }
    });

    horizontalPanel_2.add(cbTriggerGroup);

    Button btnPauseAll = new Button("Pause All");
    btnPauseAll.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            scheduler.pauseAll(new AsyncCallback<Void>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onSuccess(Void result) {
                    // TODO Auto-generated method stub

                }
            });
        }
    });
    horizontalPanel_2.add(btnPauseAll);
    horizontalPanel_2.setCellHorizontalAlignment(btnPauseAll, HasHorizontalAlignment.ALIGN_RIGHT);

    Button btnResumeAll = new Button("Resume All");
    btnResumeAll.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            scheduler.resumeAll(new AsyncCallback<Void>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onSuccess(Void result) {
                    // TODO Auto-generated method stub

                }
            });
        }
    });
    horizontalPanel_2.add(btnResumeAll);

    Button btnPauseGroup = new Button("Pause Group");
    btnPauseGroup.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String selectedGroup = cbTriggerGroup.getItemText(cbTriggerGroup.getSelectedIndex());
            scheduler.pauseTriggers(selectedGroup, new AsyncCallback<Void>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onSuccess(Void result) {
                    // TODO Auto-generated method stub

                }
            });
        }
    });
    horizontalPanel_2.add(btnPauseGroup);

    Button btnResumeGroup = new Button("Resume Group");
    btnResumeGroup.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String selectedGroup = cbTriggerGroup.getItemText(cbTriggerGroup.getSelectedIndex());
            scheduler.resumeTriggers(selectedGroup, new AsyncCallback<Void>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onSuccess(Void result) {
                    // TODO Auto-generated method stub

                }
            });
        }
    });
    horizontalPanel_2.add(btnResumeGroup);

    SimplePanel triggerPanel = new SimplePanel();
    verticalPanel_1.add(triggerPanel);
    triggerPanel.setSize("100%", "390px");
    TriggersTable triggersTable = new TriggersTable(eventBus, triggersProvider);
    triggerPanel.add(triggersTable);
    triggersTable.setSize("100%", "100%");

    scheduler.getJobGroupNames(new AsyncCallback<ArrayList<String>>() {

        @Override
        public void onSuccess(ArrayList<String> result) {
            for (String name : result) {
                cbGroupName.addItem(name);
            }
            updateJobs();
        }

        @Override
        public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub

        }
    });

    //polling jobs, triggers and job executions status
    new com.google.gwt.user.client.Timer() {
        @Override
        public void run() {

            updateJobs();

            updateTriggers();

            updateJobExecutionContexts();
            this.schedule(2000);
        }
    }.schedule(2000);

    scheduler.getTriggerGroupNames(new AsyncCallback<List<String>>() {

        @Override
        public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onSuccess(List<String> result) {
            for (String group : result) {
                cbTriggerGroup.addItem(group);
            }
            updateTriggers();
        }
    });

    //update trigger group combo box

}

From source file:org.thechiselgroup.biomixer.client.core.visualization.CenterRightViewTopBarExtension.java

License:Apache License

@Override
protected void addWidgetToTopBar(Widget realWidget, DockPanel topBar) {
    topBar.add(realWidget, DockPanel.CENTER);
    topBar.setCellHorizontalAlignment(realWidget, HasAlignment.ALIGN_RIGHT);
    topBar.setCellWidth(realWidget, "100%"); // eats up all
}