List of usage examples for com.google.gwt.user.client.ui LayoutPanel add
protected void add(Widget child, Element container)
From source file:main.client.ui.SimpleCrudPortlet.java
License:Open Source License
public SimpleCrudPortlet() { LayoutPanel panel = new LayoutPanel(); initWidget(panel);/*from w ww .ja v a 2s . c om*/ FormBuilder b = new FormBuilder(); b.caption("ID").caption("Name").caption("Mobile").endRow(); grid = b.getForm(); grid.addStyleName("data"); grid.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { HTMLTable.Cell cell = grid.getCellForEvent(clickEvent); setSelection(cell == null ? -1 : cell.getRowIndex()); } }); FlowPanel p = new FlowPanel(); p.add(new CssButton("Add", new ClickHandler() { public void onClick(ClickEvent clickEvent) { showContactDialog(new Contact()); } })); p.add(edit); p.add(delete); panel.add(p, 24); panel.add(b.getFormInPanel()); }
From source file:org.jboss.bpm.console.client.monitor.ExecutionHistoryView.java
License:Apache License
public void provideWidget(ProvisioningCallback callback) { this.controller = Registry.get(Controller.class); controller.addView(ID, this); controller.addAction(GetProcessDefinitionsAction.ID, new GetProcessDefinitionsAction()); controller.addAction(LoadDatasetsAction.ID, new LoadDatasetsAction()); controller.addAction(LoadChartProcessInstancesAction.ID, new LoadChartProcessInstancesAction()); LayoutPanel panel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL)); final ToolBar toolBar = new ToolBar(); panel.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL)); // -----//from www . j a v a 2s.c om menuButton = new ToolButton("Open", new ClickHandler() { public void onClick(ClickEvent clickEvent) { controller.handleEvent(new Event(GetProcessDefinitionsAction.ID, null)); } }); toolBar.add(menuButton); // ----- title = new HTML(); title.getElement().setAttribute("style", "font-size:24px; font-weight:BOLD"); // ------------ BoxLayout boxLayout = new BoxLayout(BoxLayout.Orientation.HORIZONTAL); timespanPanel = new LayoutPanel(boxLayout); timespanPanel.setPadding(0); timespan = new HTML(); timespan.getElement().setAttribute("style", "padding-left:10px;padding-top:2px; color:#C8C8C8;font-size:16px;text-align:left;"); timespanButton = new ToolButton(); timespanButton.setStyle(ToolButton.ToolButtonStyle.MENU); timespanButton.getElement().setAttribute("style", "padding-right:0px;background-image:none;"); timespanButton.setVisible(false); final PopupMenu timeBtnMenu = new PopupMenu(); for (final TimespanValues ts : TimespanValues.values()) { timeBtnMenu.addItem(ts.getCanonicalName(), new Command() { public void execute() { LoadDatasetEvent theEvent = new LoadDatasetEvent(); String theDefinitionId = getDefinitionId(currentProcDef); if (theDefinitionId == null) { return; } theEvent.setDefinitionId(theDefinitionId); theEvent.setTimespan(ts); currentTimespan = ts; if (includeFailed.getValue()) { theEvent.setIncludedFailed(true); } else { theEvent.setIncludedFailed(false); } LoadingOverlay.on(chartArea, true); controller.handleEvent(new Event(LoadDatasetsAction.ID, theEvent)); } }); } ; timespanButton.setMenu(timeBtnMenu); timespanPanel.add(timespanButton, new BoxLayoutData("20px", "20px")); timespanPanel.add(timespan, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL)); // ------------ final LayoutPanel contents = new LayoutPanel(new RowLayout()); LayoutPanel headerPanel = new LayoutPanel(new ColumnLayout()); headerPanel.setPadding(0); headerPanel.add(title, new ColumnLayoutData("55%")); headerPanel.add(timespanPanel, new ColumnLayoutData("45%")); // ------------ chartArea = new LayoutPanel(); chartArea.setPadding(15); chartArea.setLayout(new BorderLayout()); instancePanel = new LayoutPanel(); listBox = new org.gwt.mosaic.ui.client.ListBox(new String[] { "Process Instance" }); instancePanel.add(listBox); contents.add(headerPanel, new RowLayoutData("100")); contents.add(chartArea, new RowLayoutData(true)); // ------------ includeFailed = new CheckBox("Incl. failed / terminated?"); includeFailed.setValue(false); includeFailed.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> isEnabled) { LoadDatasetEvent theEvent = new LoadDatasetEvent(); String theDefinitionId = getDefinitionId(currentProcDef); if (theDefinitionId == null) { return; } theEvent.setDefinitionId(theDefinitionId); theEvent.setTimespan(currentTimespan); if (includeFailed.getValue()) { theEvent.setIncludedFailed(true); } else { theEvent.setIncludedFailed(false); } LoadingOverlay.on(chartArea, true); controller.handleEvent(new Event(LoadDatasetsAction.ID, theEvent)); } }); buttonPanel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL)); buttonPanel.add(includeFailed); // ------------ panel.add(contents, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH)); ErraiBus.get().subscribe("process.execution.history", new MessageCallback() { public void callback(Message message) { String processName = message.get(String.class, "processName"); String processDefinitionId = message.get(String.class, "processDefinitionId"); update(processName, processDefinitionId); } }); callback.onSuccess(panel); }
From source file:org.jboss.bpm.console.client.monitor.ExecutionHistoryView.java
License:Apache License
private void initChartPanel(Dataset[] datasets) { int[] dim = calcChartDimension(); // ------/* w w w . j ava 2s. c om*/ chartPanel = Chronoscope.createTimeseriesChart(datasets, dim[0], dim[1]); // marker final XYPlot plot = chartPanel.getChart().getPlot(); plot.addPlotFocusHandler(new PlotFocusHandler() { public void onFocus(final PlotFocusEvent event) { if (event.getFocusDataset() >= 0) // zooming { ChronoDate chronoDate = ChronoDate.get(event.getDomain()); Date date = new Date(); date.setTime((long) chronoDate.getTime()); LoadChartProcessInstanceEvent theEvent = new LoadChartProcessInstanceEvent(); String theDefinitionId = getDefinitionId(currentProcDef); if (theDefinitionId == null) { return; } theEvent.setDefinitionId(theDefinitionId); theEvent.setDate(date); theEvent.setDatasetType(event.getFocusDataset()); theEvent.setTimespan(currentTimespan); controller.handleEvent(new Event(LoadChartProcessInstancesAction.ID, theEvent)); } } }); // ------ final ViewReadyCallback callback = new ViewReadyCallback() { public void onViewReady(View view) { resizeChartArea(view); } }; chartPanel.setViewReadyCallback(callback); final LayoutPanel wrapper = new LayoutPanel(); wrapper.setLayout(new ColumnLayout()); wrapper.add(chartPanel, new ColumnLayoutData("70%")); wrapper.add(new Label("More..."), new ColumnLayoutData("30%")); chartArea.add(chartPanel); chartArea.add(buttonPanel, new BorderLayoutData(BorderLayout.Region.EAST, "150px")); instancePanel.getElement().setAttribute("style", "margin-top:15px"); chartArea.add(instancePanel, new BorderLayoutData(BorderLayout.Region.SOUTH, "150px")); // ------ ResizableWidgetCollection.get().add(new ResizableWidget() { public Element getElement() { return chartPanel.getElement(); } public boolean isAttached() { return chartPanel.isAttached(); } public void onResize(int width, int height) { View view = resizeChartView(); } }); }
From source file:org.jboss.bpm.console.client.process.v2.Explorer.java
License:Apache License
public void provideWidget(ProvisioningCallback callback) { initController();/*from w ww .ja v a 2 s . com*/ // ----------------------- layout = new LayoutPanel(new BorderLayout()); // ----------------------- definitionPanel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL)); definitionPanel.setPadding(0); final ToolBar toolBar = new ToolBar(); definitionPanel.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL)); // ----------------------- menuButton = new ToolButton("Open", new ClickHandler() { public void onClick(ClickEvent clickEvent) { controller.handleEvent(new Event(UpdateDefinitionsAction.ID, null)); } }); // ----------------------- toolBar.add(menuButton); title = new HTML(); title.getElement().setAttribute("style", "font-size:24px; font-weight:BOLD"); // ----------------------- LayoutPanel headerPanel = new LayoutPanel(new ColumnLayout()); headerPanel.add(title, new ColumnLayoutData("70%")); LayoutPanel actionPanel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL)); actionPanel.getElement().setAttribute("style", "margin-right:10px;"); ToolButton actions = new ToolButton("More ..."); actions.setStyle(ToolButton.ToolButtonStyle.MENU); final Command blank = new Command() { public void execute() { } }; // ----------------------- PopupMenu actionMenu = new PopupMenu(); /*actionMenu.addItem("Process Diagram", new Command() { public void execute() { DeferredCommand.addCommand(new Command() { public void execute() { controller.handleEvent( new Event(LoadActivityDiagramAction.ID, "instance id") ); } } ); } });*/ actionMenu.addItem("Execution History", new Command() { public void execute() { if (getActiveDefinition() != null) { // open the tool MessageBuilder.createMessage().toSubject(Workspace.SUBJECT).command(LayoutCommands.ActivateTool) .with(LayoutParts.TOOL, "Execution_History.2") .with(LayoutParts.TOOLSET, "ToolSet_Processes").noErrorHandling() .sendNowWith(ErraiBus.get()); // load process data ProcessDefinitionRef ref = getActiveDefinition(); MessageBuilder.createMessage().toSubject("process.execution.history").signalling() .with("processName", ref.getName() + "-" + ref.getVersion())// hacky .with("processDefinitionId", ref.getId()).noErrorHandling().sendNowWith(ErraiBus.get()); } } }); actionMenu.addItem("Change Version", new Command() { public void execute() { if (getActiveDefinition() != null) { selectVersion(); } } }); actions.setMenu(actionMenu); actions.getElement().setAttribute("style", "widht:30px; height:12px; padding-right:0px;background-image:none;"); actionPanel.add(actions, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL)); headerPanel.add(actionPanel, new ColumnLayoutData("30%")); definitionPanel.add(headerPanel, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH)); // ----------------------- InstanceListView instanceView = new InstanceListView(); final DecoratedTabLayoutPanel tabPanel = new DecoratedTabLayoutPanel(false); instanceView.provideWidget(new ProvisioningCallback() { public void onSuccess(Widget instance) { tabPanel.add(instance, "Running"); } public void onUnavailable() { } }); layout.add(definitionPanel, new BorderLayoutData(BorderLayout.Region.NORTH, 130)); layout.add(tabPanel); callback.onSuccess(layout); }