List of usage examples for com.google.gwt.user.client.ui TabPanel TabPanel
public TabPanel()
From source file:org.freemedsoftware.gwt.client.screen.RemittBilling.java
License:Open Source License
public RemittBilling() { super(moduleName); tabPanel = new TabPanel(); initWidget(tabPanel);//from w ww .j a v a2 s . com // ///////////////////////////////////////////////////// tabPanel.add(getPerformBillingUI(), _("Perform Billing")); // tabPanel.add(getBillingStatusUI(), "Billing Status"); // tabPanel.add(getReBillingUI(), "Rebill"); tabPanel.add(getShowReportsUI(), _("Show Reports")); tabPanel.selectTab(0); // //////////////////////////////////// }
From source file:org.freemedsoftware.gwt.client.screen.ReportingLogScreen.java
License:Open Source License
public ReportingLogScreen() { super(moduleName); final VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel);// ww w .ja va 2s . co m final TabPanel tabPanel = new TabPanel(); verticalPanel.add(tabPanel); // Panel #2 final FlexTable groupListTable = new FlexTable(); tabPanel.add(groupListTable, _("Failed Reports")); groupListTable.setWidget(0, 0, printLogTable); printLogTable.setSize("100%", "100%"); printLogTable.addColumn(_("Report Name"), "report_name"); // col 0 printLogTable.addColumn(_("Format"), "report_format"); // col 1 printLogTable.addColumn(_("Date"), "stamp"); // col 2 printLogTable.addColumn(_("Action"), "action"); // col 2 printLogTable.setIndexName("id"); printLogTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() { public Widget setColumn(String columnName, HashMap<String, String> data) { // Render only action column, otherwise skip renderer if (columnName.compareToIgnoreCase("action") != 0) { return null; } final CustomActionBar actionBar = new CustomActionBar(data); actionBar.hideAction(HandleCustomAction.ADD); actionBar.hideAction(HandleCustomAction.LOCK); actionBar.hideAction(HandleCustomAction.MODIFY); actionBar.setHandleCustomAction(new HandleCustomAction() { @Override public void handleAction(int id, HashMap<String, String> data, int action) { if (action == HandleCustomAction.DELETE) deleteFailedReportsLog(id); else if (action == HandleCustomAction.PRINT) { Util.generateReportToPrinter(data.get("report_name"), data.get("report_format"), convertParamsToList(data.get("report_params")), false); } else if (action == HandleCustomAction.VIEW) { Util.generateReportToBrowser(data.get("report_name"), data.get("report_format"), convertParamsToList(data.get("report_params"))); } } }); // Push value back to table return actionBar; } }); printLogTable.setTableRowClickHandler(new TableRowClickHandler() { @Override public void handleRowClick(HashMap<String, String> data, int col) { } }); tabPanel.selectTab(0); // TODO:Backend needs to be fixed first retrieveFailedReportsLog(); }
From source file:org.freemedsoftware.gwt.client.screen.UserManagementScreen.java
License:Open Source License
public UserManagementScreen() { super(moduleName); final VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel);/*from w w w .ja va 2 s .c om*/ tabPanel = new TabPanel(); verticalPanel.add(tabPanel); addUserVPanel = new VerticalPanel(); // Panel #1 if (canWrite || canModify) { if (canWrite) tabPanel.add(addUserVPanel, _("Add User")); final FlexTable userAddTable = new FlexTable(); addUserVPanel.add(userAddTable); int row = 0; final Label usernameLabel = new Label(_("User Name")); userAddTable.setWidget(row, 0, usernameLabel); tbUsername = new TextBox(); userAddTable.setWidget(row, 1, tbUsername); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); tbUsername.setWidth("20em"); row++; final Label passwordLabel = new Label("Password"); userAddTable.setWidget(row, 0, passwordLabel); tbPassword = new PasswordTextBox(); userAddTable.setWidget(row, 1, tbPassword); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); tbPassword.setWidth("20em"); row++; final Label passwordverifyLabel = new Label(_("Password (Verify)")); userAddTable.setWidget(row, 0, passwordverifyLabel); final HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setWidth("100%"); userAddTable.setWidget(row, 1, horizontalPanel); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); tbPasswordverify = new PasswordTextBox(); tbPasswordverify.setWidth("20em"); horizontalPanel.add(tbPasswordverify); final String changePassString = "<a href='javascript:undefined'>" + _("Change Password") + "</a>"; final String donotChangePassString = "<a href='javascript:undefined'>" + _("Don't Change Password") + "</a>"; changePasswordLink = new HTML(changePassString); changePasswordLink.setVisible(false); changePasswordLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { if (tbPassword.isEnabled()) { tbPassword.setEnabled(false); tbPasswordverify.setEnabled(false); changePasswordLink.setHTML(changePassString); } else { tbPassword.setEnabled(true); tbPasswordverify.setEnabled(true); changePasswordLink.setHTML(donotChangePassString); } } }); horizontalPanel.add(changePasswordLink); row++; final Label descriptionLabel = new Label(_("Description")); userAddTable.setWidget(row, 0, descriptionLabel); tbDescription = new TextBox(); userAddTable.setWidget(row, 1, tbDescription); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); tbDescription.setWidth("100%"); row++; final Label userfnameLabel = new Label(_("First Name")); userAddTable.setWidget(row, 0, userfnameLabel); tbUserFirstName = new TextBox(); userAddTable.setWidget(row, 1, tbUserFirstName); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); tbUserFirstName.setWidth("20em"); row++; final Label userMiddlenameLabel = new Label(_("Middle Name")); userAddTable.setWidget(row, 0, userMiddlenameLabel); tbUserMiddleName = new TextBox(); userAddTable.setWidget(row, 1, tbUserMiddleName); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); tbUserMiddleName.setWidth("20em"); row++; final Label userLastNameLabel = new Label(_("Last Name")); userAddTable.setWidget(row, 0, userLastNameLabel); tbUserLastName = new TextBox(); userAddTable.setWidget(row, 1, tbUserLastName); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); tbUserLastName.setWidth("20em"); row++; final Label userTitleLabel = new Label(_("User Title")); userAddTable.setWidget(row, 0, userTitleLabel); tbUserTitle = new CustomRadioButtonGroup("title"); tbUserTitle.addItem("Mr"); tbUserTitle.addItem("Mrs"); tbUserTitle.addItem("Ms"); tbUserTitle.addItem("Dr"); tbUserTitle.addItem("Fr"); userAddTable.setWidget(row, 1, tbUserTitle); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); tbUserTitle.setWidth("20em"); row++; final Label userTypeLabel = new Label(_("User Type")); userAddTable.setWidget(row, 0, userTypeLabel); lbUserType = new CustomListBox(); userAddTable.setWidget(row, 1, lbUserType); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); lbUserType.addItem(_("Select User Type"), "null"); lbUserType.addItem(_("Miscellaneous"), "misc"); lbUserType.addItem(_("Provider"), "phy"); row++; final Label actualPhysicianLabel = new Label(_("Actual Physician")); userAddTable.setWidget(row, 0, actualPhysicianLabel); actualPhysicianLabel.setVisible(false); lbActualPhysician = new SupportModuleWidget("ProviderModule"); userAddTable.setWidget(row, 1, lbActualPhysician); userAddTable.getFlexCellFormatter().setColSpan(row, 1, 2); lbActualPhysician.setVisible(false); lbUserType.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent evt) { Widget sender = (Widget) evt.getSource(); String value = ((CustomListBox) sender).getWidgetValue(); if (value.compareTo("phy") == 0) { // Is provider lbActualPhysician.setVisible(true); actualPhysicianLabel.setVisible(true); } else { // Is not provider lbActualPhysician.setVisible(false); actualPhysicianLabel.setVisible(false); } } }); row++; final Label facilityLabel = new Label(_("Facility")); userAddTable.setWidget(row, 0, facilityLabel); VerticalPanel facilityVPanel = new VerticalPanel(); facilityVPanel.setStyleName("top-border-only"); userAddTable.setWidget(row, 1, facilityVPanel); final FlexTable facilityTable = new FlexTable(); facilityVPanel.add(facilityTable); Util.callModuleMethod("FacilityModule", "GetAll", (Integer) null, new CustomRequestCallback() { @Override public void onError() { // TODO Auto-generated method stub } @Override public void jsonifiedData(Object data) { // TODO Auto-generated method stub int tempRow = 0; int tempCol = 0; @SuppressWarnings("unchecked") HashMap<String, String>[] result = (HashMap<String, String>[]) data; for (int i = 0; i < result.length; i++) { HashMap<String, String> facilityMap = result[i]; CheckBox checkBox = new CheckBox(facilityMap.get("psrname")); Integer id = Integer.parseInt(facilityMap.get("id")); facilitiesCheckBoxesMap.put(id, checkBox); facilityTable.setWidget(tempRow, tempCol, checkBox); tempCol++; if (tempCol == 3) { tempCol = 0; tempRow++; } } } }, "HashMap<String,String>[]"); row++; final Label aclLabel = new Label(_("User Groups")); userAddTable.setWidget(row, 0, aclLabel); final VerticalPanel aclGroupsVpanel = new VerticalPanel(); aclGroupsVpanel.setStyleName("top-border-only"); aclGroupsVpanel.add(aclGroupsTable); userAddTable.setWidget(row, 1, aclGroupsVpanel); HorizontalPanel buttonsPanel = new HorizontalPanel(); addUserButton = new CustomButton(_("Add User"), AppConstants.ICON_ADD_PERSON); addUserButton.addClickHandler(this); buttonsPanel.add(addUserButton); copyButton = new CustomButton(_("Copy"), AppConstants.ICON_ADD); copyButton.addClickHandler(this); copyButton.setVisible(false); buttonsPanel.add(copyButton); buttonsPanel.add(customizePermissionsLink); deleteUserButton = new CustomButton(_("Delete User"), AppConstants.ICON_REMOVE_PERSON); deleteUserButton.addClickHandler(this); deleteUserButton.setVisible(false); buttonsPanel.add(deleteUserButton); clearButton = new CustomButton(_("Reset"), AppConstants.ICON_CLEAR); clearButton.addClickHandler(this); buttonsPanel.add(clearButton); row++; userAddTable.setWidget(row, 1, buttonsPanel); getACLGroups(); showEnhancedPermssions(false); customizePermissionsTable.removeTableStyle(); addUserVPanel.add(customizePermissionsTable); customizePermissionsLink.addClickHandler(new ClickHandler() { boolean show = false; @Override public void onClick(ClickEvent arg0) { show = !show; showEnhancedPermssions(show); }//End onlick });//End customizePermissionsLink AddClick Handler } // Panel #2 final FlexTable userListTable = new FlexTable(); tabPanel.add(userListTable, _("List Users")); userListTable.setWidget(0, 0, wUsers); wUsers.setSize("100%", "100%"); wUsers.addColumn(_("Username"), "username"); // col 0 wUsers.addColumn(_("Description"), "userdescrip"); // col 1 wUsers.addColumn(_("First Name"), "userfname"); // col 2 wUsers.addColumn(_("Last Name"), "userlname"); // col 3 wUsers.addColumn(_("Middle Name"), "usermname"); // col 4 wUsers.addColumn(_("Title"), "usertitle"); // col 5 wUsers.addColumn(_("Level"), "userlevel"); // col 6 wUsers.addColumn(_("Type"), "usertype"); // col 7 wUsers.setIndexName("id"); wUsers.setTableRowClickHandler(new TableRowClickHandler() { @Override public void handleRowClick(HashMap<String, String> data, int col) { if (canWrite || canModify) { if (!canWrite) { tabPanel.add(addUserVPanel, "Modify User"); tabPanel.selectTab(1); } else tabPanel.selectTab(0); clearForm(); userId = Integer.parseInt(data.get("id")); getUserDetails(userId); getUserGroup(userId); Util.callModuleMethod("ACL", "GetBlockedACOs", userId, new CustomRequestCallback() { @Override public void onError() { } @SuppressWarnings("unchecked") @Override public void jsonifiedData(Object data) { HashMap<String, List> result = (HashMap<String, List>) data; if (result != null && result.size() > 0) { alreadyShowingEnhancedPermissions = true; blockedPermissionsMap = (HashMap<String, List>) data; alreadyShowingEnhancedPermissions = false; //setCheckBoxesValue((HashMap<String, String[]>)data, false); } Util.callModuleMethod("ACL", "GetAllowedACOs", userId, new CustomRequestCallback() { @Override public void onError() { } @Override public void jsonifiedData(Object data) { HashMap<String, List> result = (HashMap<String, List>) data; if (result != null && result.size() > 0) { allowedPermissionsMap = (HashMap<String, List>) data; alreadyShowingEnhancedPermissions = false; //setCheckBoxesValue((HashMap<String, String[]>)data, false); } if (blockedPermissionsMap != null && blockedPermissionsMap.size() > 0 || allowedPermissionsMap != null && allowedPermissionsMap.size() > 0) showEnhancedPermssions(true); } }, "HashMap<String,List>"); } }, "HashMap<String,List>"); } } }); // TODO:Backend needs to be fixed first retrieveAllUsers(); tabPanel.selectTab(0); Util.setFocus(tbUsername); }
From source file:org.freemedsoftware.gwt.client.widget.EncounterTemplateWidget.java
License:Open Source License
public EncounterTemplateWidget(CustomRequestCallback cb) { currentTemplate = ""; callback = cb;//w w w. jav a2s. co m templateValueMap = new HashMap<String, String>(); sectionFieldsMap = new HashMap<String, List<String>>(); VerticalPanel vp = new VerticalPanel(); vp.setSize("100%", "100%"); initWidget(vp); tabPanel = new TabPanel(); vp.add(tabPanel); createEncTemplateAdditionTab(); createEncTemplateListTab(); tabPanel.selectTab(0); }
From source file:org.freemedsoftware.gwt.client.widget.EncounterWidget.java
License:Open Source License
private void initialize() { JsonUtil.debug("EncounterWidget.initialize()"); vPanel = new VerticalPanel(); initWidget(vPanel);//w w w . ja va 2 s . com vPanel.setWidth("100%"); vPanel.setSpacing(5); cbTabView = new CheckBox(_("Tab View")); cbTabView.setValue(true); vPanel.add(cbTabView); cbTabView.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> arg0) { switchTabView(); } }); tabPanel = new TabPanel(); actionPanel = new HorizontalPanel(); actionPanel.setSpacing(5); CustomButton prevBtn = new CustomButton(_("Previous"), AppConstants.ICON_PREV); prevBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { callback.jsonifiedData(EncounterCommandType.PREVIOUS); } }); if (formtype == EncounterFormType.TEMPLATE_VALUES) { actionPanel.add(prevBtn); } addBtn = null; if (formmode == EncounterFormMode.ADD) { addBtn = new CustomButton(_("Add"), AppConstants.ICON_ADD); if (!CurrentState.isActionAllowed("EncounterNotes", AppConstants.WRITE)) { //addBtn.setVisible(false); } } else { addBtn = new CustomButton(_("Modify"), AppConstants.ICON_CHANGE); if (!CurrentState.isActionAllowed("EncounterNotes", AppConstants.MODIFY)) { //addBtn.setVisible(false); } } addBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { if (formtype == EncounterFormType.ENCOUNTER_NOTE_VALUES) saveEncounterNote(); else { saveEncounterTemplate(); } } }); CustomButton cancelButton = null; if (formtype == EncounterFormType.TEMPLATE_VALUES) { cancelButton = new CustomButton(_("Cancel"), AppConstants.ICON_CANCEL); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { callback.jsonifiedData(EncounterCommandType.CLOSE); } }); } else { cancelButton = new CustomButton(_("Reset"), AppConstants.ICON_REFRESH); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { callback.jsonifiedData(EncounterCommandType.RESET); } }); } actionPanel.add(addBtn); actionPanel.add(cancelButton); tabPanel = new TabPanel(); vPanel.add(tabPanel); vPanel.add(actionPanel); billingFieldsWidgetsMap = new HashMap<String, BillInfoWidget>(); createTabs(); }
From source file:org.freemedsoftware.gwt.client.widget.FinancialWidget.java
License:Open Source License
public FinancialWidget() { super(moduleName); VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.setSpacing(1);/* w w w .j ava 2 s . c o m*/ initWidget(panel); tabPanel = new TabPanel(); tabPanel.setSize("100%", "100%"); tabPanel.setVisible(true); panel.add(tabPanel); TabBar tbar = tabPanel.getTabBar(); Element tabBarFirstChild = tbar.getElement().getFirstChildElement().getFirstChildElement() .getFirstChildElement(); tabBarFirstChild.setAttribute("width", "100%"); tabBarFirstChild.setInnerHTML(_("FINANCIAL INFORMATION")); tabBarFirstChild.setClassName("label_bold"); createCurrentTab(); }
From source file:org.freemedsoftware.gwt.client.widget.PatientProblemList.java
License:Open Source License
public PatientProblemList() { super(moduleName); SimplePanel panel = new SimplePanel(); tabPanel = new TabPanel(); tabPanel.setSize("100%", "100%"); tabPanel.setVisible(true);// w ww .j av a 2 s . c o m panel.setWidget(tabPanel); initWidget(panel); TabBar tbar = tabPanel.getTabBar(); Element tabBarFirstChild = tbar.getElement().getFirstChildElement().getFirstChildElement() .getFirstChildElement(); tabBarFirstChild.setAttribute("width", "100%"); tabBarFirstChild.setInnerHTML("HEALTH SUMMARY"); tabBarFirstChild.setClassName("label_bold"); // All Image allImage = new Image("resources/images/chart_full.16x16.png"); allImage.setTitle(_("All")); createSummaryTable(allImage, "all"); // Progress Notes Image notesImage = new Image("resources/images/chart.16x16.png"); notesImage.setTitle(_("Progress Notes")); createSummaryTable(notesImage, "pnotes"); // Letters Image lettersImage = new Image("resources/images/summary_envelope.16x16.png"); lettersImage.setTitle(_("Letters")); createSummaryTable(lettersImage, "letters,patletter"); tabPanel.selectTab(0); // Register on the event bus CurrentState.getEventBus().addHandler(SystemEvent.TYPE, this); }
From source file:org.jboss.as.console.client.administration.audit.AuditLogView.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Widget createWidget() { // table/*from www. ja 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);//from w w w.ja v a 2 s . c o m panel.add(tabs); 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);//from w ww.j a va 2 s .c o m 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; }