List of usage examples for com.google.gwt.user.client.ui TabPanel selectTab
public void selectTab(int index)
From source file:org.jboss.as.console.client.administration.audit.AuditLogView.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Widget createWidget() { // table// ww w. j a v a 2 s. c o m DefaultCellTable<AuditLogItem> table = new DefaultCellTable<AuditLogItem>(6, new AuditLogItemKeyProvider()); AuditLogItemDataProvider dataProvider = new AuditLogItemDataProvider(beanFactory); dataProvider.addDataDisplay(table); final SingleSelectionModel<AuditLogItem> selectionModel = new SingleSelectionModel<AuditLogItem>(); table.setSelectionModel(selectionModel); table.setRowCount(dataProvider.store.size(), true); DefaultPager pager = new DefaultPager(); pager.setDisplay(table); // columns TextColumn<AuditLogItem> dateColumn = new TextColumn<AuditLogItem>() { @Override public String getValue(final AuditLogItem item) { return item.getDate(); } }; TextColumn<AuditLogItem> userColumn = new TextColumn<AuditLogItem>() { @Override public String getValue(final AuditLogItem item) { return item.getUser() == null ? "" : item.getUser(); } }; TextColumn<AuditLogItem> accessColumn = new TextColumn<AuditLogItem>() { @Override public String getValue(final AuditLogItem item) { return item.getAccess() == null ? "" : item.getAccess(); } }; TextColumn<AuditLogItem> remoteAddressColumn = new TextColumn<AuditLogItem>() { @Override public String getValue(final AuditLogItem item) { return item.getRemoteAddress() == null ? "" : item.getRemoteAddress(); } }; table.addColumn(dateColumn, Console.CONSTANTS.common_label_date()); table.addColumn(userColumn, Console.CONSTANTS.common_label_user()); table.addColumn(accessColumn, "Access"); table.addColumn(remoteAddressColumn, "Remote Address"); // basic attributes Form<AuditLogItem> basicsForm = new Form<AuditLogItem>(AuditLogItem.class); TextItem dateField = new TextItem("date", Console.CONSTANTS.common_label_date()); TextItem userField = new TextItem("user", Console.CONSTANTS.common_label_user()); TextItem accessField = new TextItem("access", "Access"); TextItem domainUUIDField = new TextItem("domainUUID", "Domain UUID"); TextItem remoteAddressField = new TextItem("remote-address", "Remote Address"); CheckBoxItem booting = new CheckBoxItem("booting", "Booting"); CheckBoxItem readOnly = new CheckBoxItem("r/o", "Read-only"); CheckBoxItem success = new CheckBoxItem("success", "Success"); basicsForm.setFields(dateField, userField, accessField, domainUUIDField, remoteAddressField, booting, readOnly, success); basicsForm.setEnabled(false); basicsForm.bind(table); VerticalPanel basicsPanel = new VerticalPanel(); basicsPanel.setStyleName("fill-layout-width"); basicsPanel.add(new AuditHelpPanel().asWidget()); basicsPanel.add(basicsForm); // operations VerticalPanel operationsPanel = new VerticalPanel(); operationsPanel.setStyleName("fill-layout-width"); final Code code = new Code(Code.Language.JAVASCRIPT, false); operationsPanel.add(code); // form tabs TabPanel forms = new TabPanel(); forms.setStyleName("default-tabpanel"); forms.addStyleName("master_detail-detail"); forms.add(basicsPanel, Console.CONSTANTS.common_label_attributes()); forms.add(operationsPanel, Console.CONSTANTS.common_label_operations()); forms.selectTab(0); // update operations upon selection selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(final SelectionChangeEvent event) { code.clear(); AuditLogItem item = selectionModel.getSelectedObject(); if (item != null) { JSONArray jsonArray = JSONParser.parseStrict(item.getOperations().getPayload()).isArray(); if (jsonArray != null) { String stringify = stringify(jsonArray.getJavaScriptObject()); code.setValue(SafeHtmlUtils.fromString(stringify)); } } } }); // setup layout VerticalPanel main = new VerticalPanel(); main.setStyleName("rhs-content-panel"); main.add(new ContentHeaderLabel("Audit Log")); main.add(new ContentDescription(Console.CONSTANTS.administration_audit_log_desc())); main.add(table); main.add(pager); main.add(forms); ScrollPanel scroll = new ScrollPanel(main); LayoutPanel layout = new LayoutPanel(); layout.add(scroll); layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT); DefaultTabLayoutPanel root = new DefaultTabLayoutPanel(40, Style.Unit.PX); root.addStyleName("default-tabpanel"); root.add(layout, "Audit Log"); root.selectTab(0); return root; }
From source file:org.jboss.as.console.client.administration.role.ui.RoleEditor.java
License:Open Source License
@Override public Widget asWidget() { if (!presenter.isStandalone()) { VerticalPanel panel = new VerticalPanel(); panel.setStyleName("rhs-content-panel"); panel.add(new ContentHeaderLabel("Role Management")); TabPanel tabs = new TabPanel(); tabs.setStyleName("default-tabpanel"); tabs.addStyleName("master_detail-detail"); tabs.getElement().setAttribute("style", "margin-top:15px;"); tabs.add(standardRoleEditor.asWidget(), "Standard Roles"); tabs.add(scopedRoleEditor.asWidget(), "Scoped Roles"); tabs.selectTab(0); panel.add(tabs);/* www .j a v a 2 s. com*/ return new ScrollPanel(panel); } else { return new ScrollPanel(standardRoleEditor.asWidget()); } }
From source file:org.jboss.as.console.client.domain.hosts.ServerInstancesView.java
License:Open Source License
@Override public Widget createWidget() { LayoutPanel layout = new LayoutPanel(); FakeTabPanel titleBar = new FakeTabPanel(Console.CONSTANTS.common_label_serverInstances()); layout.add(titleBar);/*w ww .j a va 2 s. com*/ VerticalPanel vpanel = new VerticalPanel(); vpanel.setStyleName("rhs-content-panel"); // ---------------------------------------------------------------------- nameLabel = new ContentHeaderLabel(Console.CONSTANTS.common_label_runtimeStatus()); vpanel.add(nameLabel); vpanel.add(new ContentDescription( "Server instances represent the server runtime state. This includes the virtual machine status, as well as deployments and subsystem specific state (i.e. datasource pool sizes).")); // ---------------------------------------------------------------------- HorizontalPanel tableOptions = new HorizontalPanel(); tableOptions.getElement().setAttribute("cellpadding", "2px"); groupFilter = new ComboBox(); groupFilter.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { presenter.onFilterByGroup(event.getValue()); } }); Widget typeFilterWidget = groupFilter.asWidget(); typeFilterWidget.getElement().setAttribute("width", "200px;"); tableOptions.add(new Label(Console.CONSTANTS.common_label_serverGroup() + ":")); tableOptions.add(typeFilterWidget); tableOptions.getElement().setAttribute("style", "float:right;"); //TODO: Fixme vpanel.add(tableOptions); // ---------------------------------------------------------------------- instanceTable = new DefaultCellTable<ServerInstance>(10); instanceProvider = new ListDataProvider<ServerInstance>(); instanceProvider.addDataDisplay(instanceTable); // Create columns Column<ServerInstance, String> nameColumn = new Column<ServerInstance, String>(new TextCell()) { @Override public String getValue(ServerInstance object) { return object.getName(); } }; Column<ServerInstance, String> groupColumn = new Column<ServerInstance, String>(new TextCell()) { @Override public String getValue(ServerInstance object) { return object.getGroup(); } }; Column<ServerInstance, ImageResource> statusColumn = new Column<ServerInstance, ImageResource>( new ImageResourceCell()) { @Override public ImageResource getValue(ServerInstance instance) { ImageResource res = null; if (instance.isRunning()) res = Icons.INSTANCE.statusGreen_small(); else res = Icons.INSTANCE.statusRed_small(); return res; } }; instanceTable.addColumn(nameColumn, Console.CONSTANTS.common_label_server()); instanceTable.addColumn(groupColumn, Console.CONSTANTS.common_label_serverGroup()); instanceTable.addColumn(statusColumn, Console.CONSTANTS.common_label_status()); vpanel.add(instanceTable); DefaultPager pager = new DefaultPager(); pager.setDisplay(instanceTable); vpanel.add(pager); // scroll enabled ScrollPanel scroll = new ScrollPanel(); scroll.add(vpanel); layout.add(scroll); layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 40, Style.Unit.PX); layout.setWidgetTopHeight(scroll, 28, Style.Unit.PX, 100, Style.Unit.PCT); // ---------------------------------------------------------------------- VerticalPanel formPanel = new VerticalPanel(); formPanel.setStyleName("fill-layout-width"); final Form<ServerInstance> form = new Form<ServerInstance>(ServerInstance.class); form.setNumColumns(2); ToolStrip formTools = new ToolStrip(); startBtn = new ToolButton("Start/Stop", new ClickHandler() { @Override public void onClick(ClickEvent event) { String state = form.getEditedEntity().isRunning() ? "stop" : "start"; Feedback.confirm(Console.CONSTANTS.common_label_serverInstances(), Console.MESSAGES.changeServerStatus(state, form.getEditedEntity().getName()), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { ServerInstance instance = form.getEditedEntity(); presenter.startServer(hostName, instance.getServer(), !instance.isRunning()); } } }); } }); formTools.addToolButtonRight(startBtn); form.addEditListener(new EditListener<ServerInstance>( ) { @Override public void editingBean(ServerInstance serverInstance) { String label = serverInstance.isRunning() ? "Stop" : "Start"; startBtn.setText(label); } }); /* https://issues.jboss.org/browse/AS7-953 formTools.addToolButtonRight(new ToolButton("Reload", new ClickHandler() { @Override public void onClick(ClickEvent event) { Feedback.confirm("Reload server configuration", "Do you want ot reload the server configuration for server "+form.getEditedEntity().getName()+"?", new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if(isConfirmed) { ServerInstance instance = form.getEditedEntity(); presenter.reloadServer(instance.getServer()); } } }); } })); */ formPanel.add(formTools); // ----- TextItem nameItem = new TextItem("name", Console.CONSTANTS.common_label_serverInstance()); TextItem serverItem = new TextItem("server", Console.CONSTANTS.common_label_serverConfig()); StatusItem enableItem = new StatusItem("running", "Running?"); form.setFields(nameItem, serverItem, enableItem); form.bind(instanceTable); form.setEnabled(false); Widget formWidget = form.asWidget(); formWidget.getElement().setAttribute("style", "margin-top:15px;"); formPanel.add(formWidget); // ---------------------------------------------------------- TabPanel bottomLayout = new TabPanel(); bottomLayout.addStyleName("default-tabpanel"); bottomLayout.add(formPanel, "Availability"); bottomLayout.selectTab(0); vpanel.add(new ContentGroupLabel("Status")); vpanel.add(bottomLayout); return layout; }
From source file:org.jboss.as.console.client.shared.deployment.DeploymentStep1.java
License:Open Source License
public Widget asWidget() { final TabPanel tabs = new TabPanel(); tabs.setStyleName("default-tabpanel"); // -------//from www . j a va2s.com VerticalPanel layout = new VerticalPanel(); layout.setStyleName("window-content"); // Create a FormPanel and point it at a service. final FormPanel form = new FormPanel(); String url = Console.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API); form.setAction(url); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); // Create a panel to hold all of the form widgets. VerticalPanel panel = new VerticalPanel(); panel.getElement().setAttribute("style", "width:100%"); form.setWidget(panel); // Create a FileUpload widget. final FileUpload upload = new FileUpload(); upload.setName("uploadFormElement"); panel.add(upload); final HTML errorMessages = new HTML("Please chose a file!"); errorMessages.setStyleName("error-panel"); errorMessages.setVisible(false); panel.add(errorMessages); // Add a 'submit' button. ClickHandler cancelHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { window.hide(); } }; ClickHandler submitHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { errorMessages.setVisible(false); // verify form String filename = upload.getFilename(); if (tabs.getTabBar().getSelectedTab() == 1) { // unmanaged content if (unmanagedForm.validate().hasErrors()) { return; } else { wizard.onCreateUnmanaged(unmanagedForm.getUpdatedEntity()); } } else if (filename != null && !filename.equals("")) { loading = Feedback.loading(Console.CONSTANTS.common_label_plaseWait(), Console.CONSTANTS.common_label_requestProcessed(), new Feedback.LoadingCallback() { @Override public void onCancel() { } }); form.submit(); } else { errorMessages.setVisible(true); } } }; DialogueOptions options = new DialogueOptions(Console.CONSTANTS.common_label_next(), submitHandler, Console.CONSTANTS.common_label_cancel(), cancelHandler); // Add an event handler to the form. form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { getLoading().hide(); String html = event.getResults(); // Step 1: upload content, retrieve hash value try { String json = html; try { if (!GWT.isScript()) // TODO: Formpanel weirdness json = html.substring(html.indexOf(">") + 1, html.lastIndexOf("<")); } catch (StringIndexOutOfBoundsException e) { // if I get this exception it means I shouldn't strip out the html // this issue still needs more research Log.debug("Failed to strip out HTML. This should be preferred?"); } JSONObject response = JSONParser.parseLenient(json).isObject(); JSONObject result = response.get("result").isObject(); String hash = result.get("BYTES_VALUE").isString().stringValue(); // step2: assign name and group wizard.onUploadComplete(upload.getFilename(), hash); } catch (Exception e) { Log.error(Console.CONSTANTS.common_error_failedToDecode() + ": " + html, e); } // Option 2: Unmanaged content } }); String stepText = "<h3>" + Console.CONSTANTS.common_label_step() + "1/2: " + Console.CONSTANTS.common_label_deploymentSelection() + "</h3>"; layout.add(new HTML(stepText)); HTML description = new HTML(); description.setHTML(Console.CONSTANTS.common_label_chooseFile()); description.getElement().setAttribute("style", "padding-bottom:15px;"); layout.add(description); layout.add(form); // Unmanaged form VerticalPanel unmanagedPanel = new VerticalPanel(); unmanagedPanel.setStyleName("window-content"); String unmanagedText = "<h3>" + Console.CONSTANTS.common_label_step() + "1/1: Specify Deployment</h3>"; unmanagedPanel.add(new HTML(unmanagedText)); unmanagedForm = new Form<DeploymentRecord>(DeploymentRecord.class); TextAreaItem path = new TextAreaItem("path", "Path"); TextBoxItem relativeTo = new TextBoxItem("relativeTo", "Relative To", false); TextBoxItem name = new TextBoxItem("name", "Name"); TextBoxItem runtimeName = new TextBoxItem("runtimeName", "Runtime Name"); CheckBoxItem archive = new CheckBoxItem("archive", "Is Archive?"); archive.setValue(true); unmanagedForm.setFields(path, relativeTo, archive, name, runtimeName); unmanagedPanel.add(unmanagedForm.asWidget()); // Composite view tabs.add(layout, "Managed"); tabs.add(unmanagedPanel, "Unmanaged"); tabs.selectTab(0); return new WindowContentBuilder(tabs, options).build(); }
From source file:org.jboss.as.console.client.shared.subsys.activemq.CoreQueueEditor.java
License:Open Source License
public Widget asWidget() { LayoutPanel layout = new LayoutPanel(); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("rhs-content-panel"); ScrollPanel scroll = new ScrollPanel(panel); layout.add(scroll);/*from w ww. j ava 2 s . c o m*/ layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT); serverName = new HTML("Replace me"); serverName.setStyleName("content-header-label"); panel.add(serverName); panel.add(new ContentDescription("Configuration for core queues.")); TabPanel bottomLayout = new TabPanel(); bottomLayout.addStyleName("default-tabpanel"); bottomLayout.addStyleName("master_detail-detail"); queueList = new CoreQueueList(presenter); bottomLayout.add(queueList.asWidget(), "Queues"); bottomLayout.selectTab(0); panel.add(bottomLayout); return layout; }
From source file:org.jboss.as.console.client.shared.subsys.activemq.JMSEditor.java
License:Open Source License
public Widget asWidget() { LayoutPanel layout = new LayoutPanel(); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("rhs-content-panel"); ScrollPanel scroll = new ScrollPanel(panel); layout.add(scroll);/*from w w w.j a v a 2s . c o m*/ layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT); serverName = new HTML("Replace me"); serverName.setStyleName("content-header-label"); panel.add(serverName); panel.add(new ContentDescription("Configuration for JMS queues and topics.")); TabPanel bottomLayout = new TabPanel(); bottomLayout.addStyleName("default-tabpanel"); bottomLayout.addStyleName("master_detail-detail"); queueList = new JMSQueueList(presenter); bottomLayout.add(queueList.asWidget(), "Queues"); topicList = new JMSTopicList(presenter); bottomLayout.add(topicList.asWidget(), "Topics"); bottomLayout.selectTab(0); panel.add(bottomLayout); return layout; }
From source file:org.jboss.as.console.client.shared.subsys.ejb3.ServicesView.java
License:Open Source License
@Override public Widget createWidget() { VerticalPanel vpanel = new VerticalPanel(); vpanel.setStyleName("rhs-content-panel"); vpanel.add(new ContentHeaderLabel(Console.CONSTANTS.subsys_ejb3_ejbServices())); vpanel.add(new ContentDescription(Console.CONSTANTS.subsys_ejb3_services_desc())); TabPanel bottomPanel = new TabPanel(); bottomPanel.setStyleName("default-tabpanel"); bottomPanel.add(timerServiceView.asWidget(), timerServiceView.getEntityDisplayName()); bottomPanel.add(asyncServiceView.asWidget(), asyncServiceView.getEntityDisplayName()); bottomPanel.add(remoteServiceView.asWidget(), remoteServiceView.getEntityDisplayName()); bottomPanel.selectTab(0); vpanel.add(bottomPanel);/*from ww w . j a v a 2 s.com*/ return new ScrollPanel(vpanel); }
From source file:org.jboss.as.console.client.shared.subsys.jca.DataSourceEditor.java
License:Open Source License
public Widget asWidget() { LayoutPanel layout = new LayoutPanel(); ToolStrip topLevelTools = new ToolStrip(); topLevelTools.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() { @Override/*from w ww. j a v a 2 s . co m*/ public void onClick(ClickEvent event) { presenter.launchNewDatasourceWizard(); } })); ClickHandler clickHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { final DataSource currentSelection = details.getCurrentSelection(); if (currentSelection != null) { Feedback.confirm(Console.MESSAGES.deleteTitle("Datasource"), Console.MESSAGES.deleteConfirm("Datasource " + currentSelection.getName()), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { presenter.onDelete(currentSelection); } } }); } } }; ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete()); deleteBtn.addClickHandler(clickHandler); topLevelTools.addToolButtonRight(deleteBtn); // ---- VerticalPanel vpanel = new VerticalPanel(); vpanel.setStyleName("rhs-content-panel"); ScrollPanel scroll = new ScrollPanel(vpanel); layout.add(scroll); layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT); // --- vpanel.add(new ContentHeaderLabel("JDBC Datasources")); vpanel.add(new ContentDescription(Console.CONSTANTS.subsys_jca_dataSources_desc())); dataSourceTable = new DatasourceTable(); vpanel.add(new ContentGroupLabel(Console.MESSAGES.available("Datasources"))); vpanel.add(topLevelTools.asWidget()); vpanel.add(dataSourceTable.asWidget()); // ----------- details = new DataSourceDetails(presenter); details.bind(dataSourceTable.getCellTable()); SingleSelectionModel<DataSource> selectionModel = (SingleSelectionModel<DataSource>) dataSourceTable .getCellTable().getSelectionModel(); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { DataSource selectedObject = ((SingleSelectionModel<DataSource>) dataSourceTable.getCellTable() .getSelectionModel()).getSelectedObject(); presenter.loadPoolConfig(false, selectedObject.getName()); presenter.onLoadConnectionProperties(selectedObject.getName()); } }); // ----------------- TabPanel bottomPanel = new TabPanel(); bottomPanel.setStyleName("default-tabpanel"); bottomPanel.add(details.asWidget(), "Attributes"); // ----------------- final FormToolStrip.FormCallback<DataSource> formCallback = new FormToolStrip.FormCallback<DataSource>() { @Override public void onSave(Map<String, Object> changeset) { DataSource ds = getCurrentSelection(); presenter.onSaveDSDetails(ds.getName(), changeset); } @Override public void onDelete(DataSource entity) { // n/a } }; connectionEditor = new DataSourceConnectionEditor(presenter, formCallback); connectionEditor.getForm().bind(dataSourceTable.getCellTable()); bottomPanel.add(connectionEditor.asWidget(), "Connection"); securityEditor = new DataSourceSecurityEditor(formCallback); securityEditor.getForm().bind(dataSourceTable.getCellTable()); bottomPanel.add(securityEditor.asWidget(), "Security"); // ----------------- connectionProps = new ConnectionProperties(presenter); bottomPanel.add(connectionProps.asWidget(), "Properties"); // ----------------- poolConfig = new PoolConfigurationView(new PoolManagement() { @Override public void onSavePoolConfig(String parentName, Map<String, Object> changeset) { presenter.onSavePoolConfig(parentName, changeset, false); } @Override public void onResetPoolConfig(String parentName, PoolConfig entity) { presenter.onDeletePoolConfig(parentName, entity, false); } @Override public void onDoFlush(String editedName) { if (getCurrentSelection().isEnabled()) presenter.onDoFlush(false, editedName); else Console.error(Console.CONSTANTS.subsys_jca_error_datasource_notenabled()); } }); bottomPanel.add(poolConfig.asWidget(), "Pool"); poolConfig.getForm().bind(dataSourceTable.getCellTable()); // ---- validationEditor = new DataSourceValidationEditor(formCallback); validationEditor.getForm().bind(dataSourceTable.getCellTable()); bottomPanel.add(validationEditor.asWidget(), "Validation"); bottomPanel.selectTab(0); // ----------------- vpanel.add(new ContentGroupLabel(Console.CONSTANTS.common_label_selection())); // -- ClickHandler disableHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { final DataSource selection = getCurrentSelection(); final boolean nextState = !selection.isEnabled(); Feedback.confirm(Console.MESSAGES.modify("datasource"), Console.MESSAGES.modifyConfirm("Datasource " + selection.getName()), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { presenter.onDisable(selection, nextState); } } }); } }; disableBtn = new ToolButton(Console.CONSTANTS.common_label_enOrDisable(), disableHandler); disableBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_enOrDisable_dataSourceDetails()); // ----- // handle modifications to the model dataSourceTable.getCellTable().getSelectionModel() .addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { String nextState = getCurrentSelection().isEnabled() ? Console.CONSTANTS.common_label_disable() : Console.CONSTANTS.common_label_enable(); disableBtn.setText(nextState); } }); topLevelTools.addToolButtonRight(disableBtn); // -- vpanel.add(bottomPanel); return layout; }
From source file:org.jboss.as.console.client.shared.subsys.jca.wizard.DatasourceStep2.java
License:Open Source License
Widget asWidget() { VerticalPanel layout = new VerticalPanel(); layout.getElement().setAttribute("style", "margin:10px; vertical-align:center;width:95%"); HTML desc = new HTML("<h3>" + Console.CONSTANTS.subsys_jca_dataSource_step2() + "</h3>"); desc.getElement().setAttribute("style", "padding-bottom:10px;"); layout.add(desc);/* w w w.j a v a 2s. c om*/ layout.add(new ContentDescription("Select one of the deployed JDBC driver.")); // --- table = new DefaultCellTable<JDBCDriver>(5); TextColumn<JDBCDriver> nameColumn = new TextColumn<JDBCDriver>() { @Override public String getValue(JDBCDriver record) { return record.getName(); } }; TextColumn<JDBCDriver> groupColumn = new TextColumn<JDBCDriver>() { @Override public String getValue(JDBCDriver record) { return record.getGroup(); } }; table.addColumn(nameColumn, "Name"); if (!isStandalone) table.addColumn(groupColumn, "Server Group"); selectionModel = new SingleSelectionModel<JDBCDriver>(); table.setSelectionModel(selectionModel); provisionTable(table); DefaultPager pager = new DefaultPager(); pager.setDisplay(table); VerticalPanel driverPanel = new VerticalPanel(); driverPanel.add(table); driverPanel.add(pager); // -- final Form<JDBCDriver> form = new Form<JDBCDriver>(JDBCDriver.class); TextBoxItem name = new TextBoxItem("name", "Name"); TextBoxItem driverClass = new TextBoxItem("driverClass", "Driver Class"); NumberBoxItem major = new NumberBoxItem("majorVersion", "Major Version"); NumberBoxItem minor = new NumberBoxItem("minorVersion", "Minor Version"); form.setFields(name, driverClass, major, minor); // -- TabPanel tabs = new TabPanel(); tabs.setStyleName("default-tabpanel"); tabs.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { selectedTab = event.getSelectedItem(); } }); tabs.add(driverPanel, "Chose Driver"); //tabs.add(form.asWidget(), "Specify Driver"); layout.add(tabs); tabs.selectTab(0); // ---- ClickHandler submitHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { JDBCDriver driver = null; if (selectedTab == 0) { // reset state form.clearValues(); SingleSelectionModel<JDBCDriver> selection = (SingleSelectionModel<JDBCDriver>) table .getSelectionModel(); driver = selection.getSelectedObject(); } else { FormValidation formValidation = form.validate(); if (!formValidation.hasErrors()) { driver = form.getUpdatedEntity(); } } if (driver != null) { // force selected driver editedEntity.setDriverName(driver.getName()); editedEntity.setDriverClass(driver.getDriverClass()); editedEntity.setMajorVersion(driver.getMajorVersion()); editedEntity.setMinorVersion(driver.getMinorVersion()); wizard.onConfigureDriver(editedEntity); } else { Console.warning(Console.CONSTANTS.subsys_jca_dataSource_select_driver(), "If no driver is available you may need to deploy one!"); } } }; ClickHandler cancelHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { wizard.getPresenter().closeDialogue(); } }; DialogueOptions options = new DialogueOptions(Console.CONSTANTS.common_label_next(), submitHandler, Console.CONSTANTS.common_label_cancel(), cancelHandler); return new WindowContentBuilder(layout, options).build(); }
From source file:org.jboss.as.console.client.shared.subsys.jca.wizard.DriverStep.java
License:Open Source License
@Override @SuppressWarnings("unchecked") protected Widget asWidget(final Context<T> context) { // first tab: driver form form = new Form<>(JDBCDriver.class); TextBoxItem driverName = new TextBoxItem("name", "Name", true); TextBoxItem moduleName = new TextBoxItem("driverModuleName", "Module Name", true); TextBoxItem driverClass = new TextBoxItem("driverClass", "Driver Class", false); TextBoxItem xaDataSource = new TextBoxItem("xaDataSourceClass", "XA DataSource Class", false); if (context.xa) { form.setFields(driverName, moduleName, driverClass, xaDataSource); } else {/*from ww w . java 2 s . c om*/ form.setFields(driverName, moduleName, driverClass); } FlowPanel formPanel = new FlowPanel(); formPanel.add(new FormHelpPanel(context.jdbcDriverHelp, form).asWidget()); formPanel.add(form); // second tab: existing drivers table = new DefaultCellTable<>(5); TextColumn<JDBCDriver> nameColumn = new TextColumn<JDBCDriver>() { @Override public String getValue(JDBCDriver record) { return record.getName(); } }; TextColumn<JDBCDriver> moduleColumn = new TextColumn<JDBCDriver>() { @Override public String getValue(JDBCDriver record) { return record.getDriverModuleName(); } }; table.addColumn(nameColumn, "Name"); if (!context.standalone) { table.addColumn(moduleColumn, "Module"); } selectionModel = new SingleSelectionModel<>(); table.setSelectionModel(selectionModel); provisionTable(table); DefaultPager pager = new DefaultPager(); pager.setDisplay(table); FlowPanel driverPanel = new FlowPanel(); driverPanel.add(table); driverPanel.add(pager); // tabs TabPanel tabs = new TabPanel(); tabs.setStyleName("default-tabpanel"); tabs.addSelectionHandler(event -> selectedTab = event.getSelectedItem()); tabs.add(formPanel, "Specify Driver"); tabs.add(driverPanel, "Detected Driver"); // body FlowPanel body = new FlowPanel(); body.add(new ContentDescription( "Select one of the installed JDBC drivers. If you do not see your driver, make sure that it is deployed as a module and properly registered.")); body.add(tabs); tabs.selectTab(0); return body; }