List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setVerticalAlignment
public void setVerticalAlignment(VerticalAlignmentConstant align)
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.endpoint.EndpointProfilesViewImpl.java
License:Apache License
public EndpointProfilesViewImpl() { super(false); int column = 0; FlexTable flexTable = new FlexTable(); flexTable.setStyleName(Utils.avroUiStyle.fieldWidget()); resetButton = new Button(Utils.constants.reset()); flexTable.setWidget(0, column, resetButton); flexTable.getFlexCellFormatter().setVerticalAlignment(0, column++, HasVerticalAlignment.ALIGN_MIDDLE); endpointGroupButton = new RadioButton("filter", Utils.constants.endpointGroup()); listBox = new EndpointGroupsInfoListBox(); listBox.getElement().getStyle().setPropertyPx("minWidth", 100); HorizontalPanel groupPanel = new HorizontalPanel(); groupPanel.setSpacing(15);/*from w ww . j a v a2 s . c o m*/ groupPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); groupPanel.add(endpointGroupButton); groupPanel.add(listBox); flexTable.setWidget(0, column++, groupPanel); HorizontalPanel keyHashPanel = new HorizontalPanel(); keyHashPanel.setSpacing(15); keyHashPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); endpointKeyHashButton = new RadioButton("filter", Utils.constants.endpointKeyHash()); endpointKeyHash = new TextBox(); endpointKeyHash.setWidth("100%"); findButton = new Button(Utils.constants.find()); findButton.addStyleName(Utils.avroUiStyle.buttonSmall()); keyHashPanel.add(endpointKeyHashButton); keyHashPanel.add(endpointKeyHash); keyHashPanel.add(findButton); flexTable.setWidget(0, column, keyHashPanel); filterPanel.add(flexTable); endpointGroupButton.setValue(true); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.endpoint.EndpointProfileViewImpl.java
License:Apache License
@Override protected void initDetailsTable() { detailsTable.getColumnFormatter().setWidth(0, "200px"); detailsTable.getColumnFormatter().setWidth(1, "550px"); detailsTable.getColumnFormatter().setWidth(2, "0px"); getSaveButtonWidget().removeFromParent(); getCancelButtonWidget().removeFromParent(); requiredFieldsNoteLabel.setVisible(false); int row = 0;//from ww w . j ava 2 s. c o m Label keyHashLabel = new Label(Utils.constants.endpointKeyHash()); endpointKeyHash = new KaaAdminSizedTextBox(-1, false); endpointKeyHash.setWidth("100%"); detailsTable.setWidget(row, 0, keyHashLabel); detailsTable.setWidget(row, 1, endpointKeyHash); userInfoList = new ArrayList<>(); Label userIDLabel = new Label(Utils.constants.userId()); userID = new KaaAdminSizedTextBox(-1, false); userID.setWidth("100%"); detailsTable.setWidget(++row, 0, userIDLabel); detailsTable.setWidget(row, 1, userID); userInfoList.add(userIDLabel); userInfoList.add(userID); Label userExternalIDLabel = new Label(Utils.constants.userExternalId()); userExternalID = new KaaAdminSizedTextBox(-1, false); userExternalID.setWidth("100%"); detailsTable.setWidget(++row, 0, userExternalIDLabel); detailsTable.setWidget(row, 1, userExternalID); userInfoList.add(userExternalIDLabel); userInfoList.add(userExternalID); Label sdkLabel = new Label(Utils.constants.sdkProfile()); sdkAnchor = new Anchor(); sdkAnchor.getElement().getStyle().setCursor(Style.Cursor.POINTER); sdkAnchor.setWidth("100%"); detailsTable.getFlexCellFormatter().setHeight(row, 0, "40px"); detailsTable.setWidget(row, 0, sdkLabel); detailsTable.setWidget(row++, 1, sdkAnchor); SpanElement span = Document.get().createSpanElement(); span.appendChild(Document.get().createTextNode(Utils.constants.endpointProfile())); span.addClassName("gwt-Label"); CaptionPanel formPanel = new CaptionPanel(span.getString(), true); FlexTable recordTable = new FlexTable(); recordTable.setWidth("100%"); Label endpointProfSchemaLabel = new Label(Utils.constants.schemaName()); endpointProfSchemaName = new Anchor(); endpointProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER); HorizontalPanel schemaNamePanel = new HorizontalPanel(); schemaNamePanel.setHeight("40px"); schemaNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); schemaNamePanel.add(endpointProfSchemaLabel); schemaNamePanel.add(endpointProfSchemaName); schemaNamePanel.setCellWidth(endpointProfSchemaName, "200px"); endpointProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX); HorizontalPanel schemaButtonsPanel = new HorizontalPanel(); schemaButtonsPanel.setSpacing(6); downloadEndpointProfileJsonButton = new ImageTextButton(Utils.resources.download(), Utils.constants.downloadJson()); schemaButtonsPanel.add(downloadEndpointProfileJsonButton); schemaNamePanel.add(schemaButtonsPanel); schemaButtonsPanel.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX); recordTable.setWidget(0, 0, schemaNamePanel); endpointProfForm = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(), Utils.constants.profile(), this, true, true); endpointProfForm.getRecordWidget().setForceNavigation(true); endpointProfForm.setPreferredHeightPx(200); recordTable.setWidget(1, 0, endpointProfForm); recordTable.getFlexCellFormatter().setColSpan(1, 0, 2); formPanel.add(recordTable); detailsTable.setWidget(++row, 0, formPanel); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); formPanel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); span = Document.get().createSpanElement(); span.appendChild(Document.get().createTextNode(Utils.constants.serverProfile())); span.addClassName("gwt-Label"); CaptionPanel serverFormPanel = new CaptionPanel(span.getString(), true); FlexTable serverRecordTable = new FlexTable(); serverRecordTable.setWidth("100%"); Label serverProfSchemaLabel = new Label(Utils.constants.schemaName()); serverProfSchemaName = new Anchor(); serverProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER); schemaNamePanel = new HorizontalPanel(); schemaNamePanel.setHeight("40px"); schemaNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); schemaNamePanel.add(serverProfSchemaLabel); schemaNamePanel.add(serverProfSchemaName); schemaNamePanel.setCellWidth(serverProfSchemaName, "200px"); serverProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX); schemaButtonsPanel = new HorizontalPanel(); schemaButtonsPanel.setSpacing(6); downloadServerProfileJsonButton = new ImageTextButton(Utils.resources.download(), Utils.constants.downloadJson()); schemaButtonsPanel.add(downloadServerProfileJsonButton); editServerProfileButton = new Button(Utils.constants.edit()); schemaButtonsPanel.add(editServerProfileButton); schemaNamePanel.add(schemaButtonsPanel); schemaButtonsPanel.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX); serverRecordTable.setWidget(0, 0, schemaNamePanel); serverProfForm = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(), Utils.constants.profile(), this, true, true); serverProfForm.getRecordWidget().setForceNavigation(true); serverProfForm.setPreferredHeightPx(200); serverRecordTable.setWidget(1, 0, serverProfForm); serverRecordTable.getFlexCellFormatter().setColSpan(1, 0, 2); serverFormPanel.add(serverRecordTable); detailsTable.setWidget(++row, 0, serverFormPanel); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); serverFormPanel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); groupsGrid = new EndpointGroupGrid(true); groupsGrid.setSize("100%", "200px"); Label groupsLabel = new Label(Utils.constants.endpointGroups()); detailsTable.setWidget(++row, 0, groupsLabel); groupsLabel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); detailsTable.setWidget(++row, 0, groupsGrid); groupsGrid.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); topicsGrid = new TopicGrid(false, true); topicsGrid.setSize("100%", "200px"); Label topicLabel = new Label(Utils.constants.subscribedOnNfTopics()); topicLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitleLabel()); detailsTable.setWidget(++row, 0, topicLabel); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); topicLabel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); detailsTable.setWidget(++row, 0, topicsGrid); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); topicsGrid.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); }
From source file:org.kie.guvnor.guided.dtable.client.widget.GuidedDecisionTableWidget.java
License:Apache License
private void refreshAttributeWidget() { this.attributeConfigWidget.clear(); if (model.getMetadataCols().size() > 0) { HorizontalPanel hp = new HorizontalPanel(); hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.Metadata1())); attributeConfigWidget.add(hp);/*from w w w . j ava2s . c o m*/ } for (MetadataCol52 atc : model.getMetadataCols()) { HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.add(new HTML(" ")); if (!isReadOnly) { hp.add(removeMeta(atc)); } final SmallLabel label = makeColumnLabel(atc); hp.add(label); final MetadataCol52 at = atc; final CheckBox hide = new CheckBox(Constants.INSTANCE.HideThisColumn()); hide.setStyleName("form-field"); hide.setValue(atc.isHideColumn()); hide.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setHideColumn(hide.getValue()); dtable.setColumnVisibility(at, !at.isHideColumn()); setColumnLabelStyleWhenHidden(label, hide.getValue()); } }); hp.add(new HTML(" ")); hp.add(hide); attributeConfigWidget.add(hp); } if (model.getAttributeCols().size() > 0) { HorizontalPanel hp = new HorizontalPanel(); hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.Attributes())); attributeConfigWidget.add(hp); } for (AttributeCol52 atc : model.getAttributeCols()) { final AttributeCol52 at = atc; HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.add(new HTML(" ")); if (!isReadOnly) { hp.add(removeAttr(at)); } final SmallLabel label = makeColumnLabel(atc); hp.add(label); final TextBox defaultValue = new TextBox(); final DTCellValue52 dcv = at.getDefaultValue(); defaultValue.setStyleName("form-field"); defaultValue.setText((dcv == null ? "" : dcv.getStringValue())); defaultValue.setEnabled(!isReadOnly); defaultValue.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { at.setDefaultValue(new DTCellValue52(defaultValue.getText())); } }); if (at.getAttribute().equals(RuleAttributeWidget.SALIENCE_ATTR)) { hp.add(new HTML(" ")); final CheckBox useRowNumber = new CheckBox(Constants.INSTANCE.UseRowNumber()); useRowNumber.setStyleName("form-field"); useRowNumber.setValue(at.isUseRowNumber()); useRowNumber.setEnabled(!isReadOnly); hp.add(useRowNumber); hp.add(new SmallLabel("(")); final CheckBox reverseOrder = new CheckBox(Constants.INSTANCE.ReverseOrder()); reverseOrder.setStyleName("form-field"); reverseOrder.setValue(at.isReverseOrder()); reverseOrder.setEnabled(at.isUseRowNumber() && !isReadOnly); useRowNumber.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setUseRowNumber(useRowNumber.getValue()); reverseOrder.setEnabled(useRowNumber.getValue()); dtable.updateSystemControlledColumnValues(); } }); reverseOrder.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setReverseOrder(reverseOrder.getValue()); dtable.updateSystemControlledColumnValues(); } }); hp.add(reverseOrder); hp.add(new SmallLabel(")")); } hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.DefaultValue())); hp.add(defaultValue); final CheckBox hide = new CheckBox(Constants.INSTANCE.HideThisColumn()); hide.setStyleName("form-field"); hide.setValue(at.isHideColumn()); hide.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setHideColumn(hide.getValue()); dtable.setColumnVisibility(at, !at.isHideColumn()); setColumnLabelStyleWhenHidden(label, hide.getValue()); } }); hp.add(new HTML(" ")); hp.add(hide); attributeConfigWidget.add(hp); setupColumnsNote(); } }
From source file:org.kie.guvnor.guided.rule.client.editor.factPattern.Connectives.java
License:Apache License
public Widget connectives(SingleFieldConstraint c, String factClass) { HorizontalPanel hp = new HorizontalPanel(); if (c.getConnectives() != null && c.getConnectives().length > 0) { hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); for (int i = 0; i < c.getConnectives().length; i++) { ConnectiveConstraint con = c.getConnectives()[i]; hp.add(connectiveOperatorDropDown(con)); hp.add(connectiveValueEditor(con)); if (!isReadOnly) { Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall(); clear.setAltText(Constants.INSTANCE.RemoveThisRestriction()); clear.setTitle(Constants.INSTANCE.RemoveThisRestriction()); clear.addClickHandler(createClickHandlerForClearImageButton(c, i)); hp.add(clear);// w ww .j a v a 2 s . co m } } } return hp; }
From source file:org.kie.uberfire.client.tables.UberfireSimplePager.java
License:Apache License
/** * Construct a {@link SimplePager} with the specified resources. * @param location the location of the text relative to the buttons * @param resources the {@link UberfireSimplePagerResources} to use * @param showFastForwardButton if true, show a fast-forward button that advances by a larger * increment than a single page/* ww w . j a v a 2s .com*/ * @param fastForwardRows the number of rows to jump when fast forwarding * @param showLastPageButton if true, show a button to go the the last page */ public UberfireSimplePager(TextLocation location, UberfireSimplePagerResources resources, boolean showFastForwardButton, final int fastForwardRows, boolean showLastPageButton) { this.resources = resources; this.fastForwardRows = fastForwardRows; this.style = resources.simplePagerStyle(); this.style.ensureInjected(); // Create the buttons. String disabledStyle = style.disabledButton(); firstPage = new ImageButton(resources.simplePagerFirstPage(), resources.simplePagerFirstPageDisabled(), disabledStyle); firstPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { firstPage(); } }); nextPage = new ImageButton(resources.simplePagerNextPage(), resources.simplePagerNextPageDisabled(), disabledStyle); nextPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { nextPage(); } }); prevPage = new ImageButton(resources.simplePagerPreviousPage(), resources.simplePagerPreviousPageDisabled(), disabledStyle); prevPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { previousPage(); } }); if (showLastPageButton) { lastPage = new ImageButton(resources.simplePagerLastPage(), resources.simplePagerLastPageDisabled(), disabledStyle); lastPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { lastPage(); } }); } else { lastPage = null; } if (showFastForwardButton) { fastForward = new ImageButton(resources.simplePagerFastForward(), resources.simplePagerFastForwardDisabled(), disabledStyle); fastForward.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(getPage() + getFastForwardPages()); } }); } else { fastForward = null; } // Construct the widget. HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); initWidget(layout); if (location == TextLocation.RIGHT) { layout.add(label); } layout.add(firstPage); layout.add(prevPage); if (location == TextLocation.CENTER) { layout.add(label); } layout.add(nextPage); if (showFastForwardButton) { layout.add(fastForward); } if (showLastPageButton) { layout.add(lastPage); } if (location == TextLocation.LEFT) { layout.add(label); } // Add style names to the cells. firstPage.getElement().getParentElement().addClassName(style.button()); prevPage.getElement().getParentElement().addClassName(style.button()); label.getElement().getParentElement().addClassName(style.pageDetails()); nextPage.getElement().getParentElement().addClassName(style.button()); if (showFastForwardButton) { fastForward.getElement().getParentElement().addClassName(style.button()); } if (showLastPageButton) { lastPage.getElement().getParentElement().addClassName(style.button()); } // Disable the buttons by default. setDisplay(null); }
From source file:org.kino.client.clean.CleantProjectsWidget.java
public CleantProjectsWidget(String clinet_id) { try {/*from w ww . ja va2 s. co m*/ int id = Integer.parseInt(clinet_id); current_id = id; } catch (NumberFormatException e) { CenterLayoutContainer msg_bg = new CenterLayoutContainer(); HTML html = new HTML( "<font color='red'>? ?</font>"); msg_bg.add(html); cartLay.add(msg_bg); cartLay.setActiveWidget(msg_bg); return; } CenterLayoutContainer msg_bg = new CenterLayoutContainer(); VerticalPanel panel = new VerticalPanel(); panel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); panel.add(new HTML("?...")); panel.add(new Image(Resources.INSTANCE.loading_bar())); msg_bg.add(panel, new MarginData(15)); cartLay.add(msg_bg); cartLay.add(border); HorizontalPanel hor = new HorizontalPanel(); hor.setHeight("40px"); hor.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); hor.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); hor.add(new HTML("? ?")); hor.getElement().getStyle().setBackgroundColor("#FDD"); border.setNorthWidget(hor, new BorderLayoutContainer.BorderLayoutData(25)); final ContentPanel cenPanel = new ContentPanel(); cenPanel.setHeaderVisible(false); cenPanel.add(vert); cenPanel.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { vert.forceLayout(); } }); border.setCenterWidget(cenPanel); GWTServiceAsync.instance.getTheaterMainData(current_id, new CallbackWithFailureDialog<TheaterW.TheaterMainData>( "? ? ") { @Override public void onSuccess(TheaterW.TheaterMainData result) { if (result != null) { init(result); cartLay.setActiveWidget(border); cartLay.forceLayout(); } else { CenterLayoutContainer msg_bg = new CenterLayoutContainer(); HTML html = new HTML("<font color='red'> </font>"); msg_bg.add(html); cartLay.add(msg_bg); cartLay.setActiveWidget(msg_bg); } } }); }
From source file:org.kino.client.monitoring.ConreteProjectInfo.java
public ConreteProjectInfo(String project_id) { try {//from w ww . ja v a 2s .c om int id = Integer.parseInt(project_id); current_id = id; } catch (NumberFormatException e) { CenterLayoutContainer msg_bg = new CenterLayoutContainer(); HTML html = new HTML( "<font color='red'>? </font>"); msg_bg.add(html); cartLay.add(msg_bg); cartLay.setActiveWidget(msg_bg); return; } CenterLayoutContainer msg_bg = new CenterLayoutContainer(); VerticalPanel panel = new VerticalPanel(); panel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); panel.add(new HTML("?...")); panel.add(new Image(Resources.INSTANCE.loading_bar())); msg_bg.add(panel, new MarginData(15)); cartLay.add(msg_bg); cartLay.add(border); HorizontalPanel hor = new HorizontalPanel(); hor.setHeight("40px"); hor.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); hor.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); hor.add(new HTML("? ? ")); hor.getElement().getStyle().setBackgroundColor("#DFD"); border.setNorthWidget(hor, new BorderLayoutContainer.BorderLayoutData(25)); final ContentPanel cenPanel = new ContentPanel(); cenPanel.setHeaderVisible(false); cenPanel.add(vert); cenPanel.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { vert.forceLayout(); } }); border.setCenterWidget(cenPanel); GWTServiceAsync.instance.getProject(current_id, new CallbackWithFailureDialog<ConreteProjectInfo.ConcreteInfo>( "? ? ") { @Override public void onSuccess(ConreteProjectInfo.ConcreteInfo result) { if (result != null) { init(result); cartLay.setActiveWidget(border); cartLay.forceLayout(); } else { CenterLayoutContainer msg_bg = new CenterLayoutContainer(); HTML html = new HTML("<font color='red'> </font>"); msg_bg.add(html); cartLay.add(msg_bg); cartLay.setActiveWidget(msg_bg); } } }); }
From source file:org.komodo.web.client.widgets.table.TeiidSimplePager.java
License:Apache License
/** * Construct a {@link SimplePager} with the specified resources. * @param location the location of the text relative to the buttons * @param resources the {@link TeiidSimplePagerResources} to use * @param showFastForwardButton if true, show a fast-forward button that advances by a larger * increment than a single page/*from w w w.j a va 2s . c o m*/ * @param fastForwardRows the number of rows to jump when fast forwarding * @param showLastPageButton if true, show a button to go the the last page */ public TeiidSimplePager(TextLocation location, TeiidSimplePagerResources resources, boolean showFastForwardButton, final int fastForwardRows, boolean showLastPageButton) { this.resources = resources; this.fastForwardRows = fastForwardRows; this.style = resources.simplePagerStyle(); this.style.ensureInjected(); // Create the buttons. String disabledStyle = style.disabledButton(); firstPage = new ImageButton(resources.simplePagerFirstPage(), resources.simplePagerFirstPageDisabled(), disabledStyle); firstPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { firstPage(); } }); nextPage = new ImageButton(resources.simplePagerNextPage(), resources.simplePagerNextPageDisabled(), disabledStyle); nextPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { nextPage(); } }); prevPage = new ImageButton(resources.simplePagerPreviousPage(), resources.simplePagerPreviousPageDisabled(), disabledStyle); prevPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { previousPage(); } }); if (showLastPageButton) { lastPage = new ImageButton(resources.simplePagerLastPage(), resources.simplePagerLastPageDisabled(), disabledStyle); lastPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { lastPage(); } }); } else { lastPage = null; } if (showFastForwardButton) { fastForward = new ImageButton(resources.simplePagerFastForward(), resources.simplePagerFastForwardDisabled(), disabledStyle); fastForward.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(getPage() + getFastForwardPages()); } }); } else { fastForward = null; } // Construct the widget. HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); initWidget(layout); if (location == TextLocation.RIGHT) { layout.add(label); } layout.add(firstPage); layout.add(prevPage); if (location == TextLocation.CENTER) { layout.add(label); } layout.add(nextPage); if (showFastForwardButton) { layout.add(fastForward); } if (showLastPageButton) { layout.add(lastPage); } if (location == TextLocation.LEFT) { layout.add(label); } // Add style names to the cells. firstPage.getElement().getParentElement().addClassName(style.button()); prevPage.getElement().getParentElement().addClassName(style.button()); label.getElement().getParentElement().addClassName(style.pageDetails()); nextPage.getElement().getParentElement().addClassName(style.button()); if (showFastForwardButton) { fastForward.getElement().getParentElement().addClassName(style.button()); } if (showLastPageButton) { lastPage.getElement().getParentElement().addClassName(style.button()); } // Disable the buttons by default. setDisplay(null); }
From source file:org.kuali.continuity.admin.main.client.ActivityLog.java
License:Educational Community License
public void onModuleLoad() { // Grid//from w w w. ja v a2 s .c o m String proxyUrl = "./items.lst"; final DateTimeFormat dateFormater = DateTimeFormat.getFormat(datePattern); startDatePicker.setMinimalDate(dateFormater.parse("01/01/1901")); endDatePicker.setMinimalDate(dateFormater.parse("01/01/1901")); // set default dates Date startDefDate = new Date(); Date endDefDate = new Date(); int startDefMonth = startDefDate.getMonth() - 1; startDefDate.setMonth(startDefMonth); startDatePicker.setSelectedDate(startDefDate); endDatePicker.setSelectedDate(endDefDate); startDate.setText(DateTimeFormat.getFormat("MM/dd/yyyy").format(startDefDate)); endDate.setText(DateTimeFormat.getFormat("MM/dd/yyyy").format(endDefDate)); startDatePicker.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { Date date = startDatePicker.getSelectedDate(); startDate.setText(dateFormater.format(date)); startDatePicker.hide(); } }); endDatePicker.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { Date date = endDatePicker.getSelectedDate(); endDate.setText(dateFormater.format(date)); endDatePicker.hide(); } }); startDate.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { Date d1 = getDateFromString(((TextBox) sender).getText()); ((TextBox) sender).setText(formatDate(d1)); } }); endDate.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { Date d1 = getDateFromString(((TextBox) sender).getText()); ((TextBox) sender).setText(formatDate(d1)); } }); ClickListener startDateClickListener = new ClickListener() { public void onClick(Widget sender) { startDatePicker.show(); } }; ClickListener endDateClickListener = new ClickListener() { public void onClick(Widget sender) { endDatePicker.show(); } }; dateChooserS.addClickListener(startDateClickListener); dateChooserE.addClickListener(endDateClickListener); this.formController = sf; this.showButtonRow = false; String formItemName = this.setElementNames(columnModel, recordDef); planSearchStatus.setStyleName("ShowInfoClass"); // Form Label lab1 = new Label("Plan Name"); lab1.setWidth(w[0]); Label lab2 = new Label("Start"); lab2.setWidth(w[1]); Label lab3 = new Label("End"); lab3.setWidth(w[2]); // flexForm.addFormItem("",lab1); // flexForm.addFormItem("",lab2); // flexForm.addFormItem("",lab3); // // flexForm.addRow(); // textBox.setMaxLength(120); planListBox.setWidth(w[0]); textBox.setWidth(w[0]); startDate.setMaxLength(10); startDate.setWidth(w[1]); String marginstr = " "; HTML margin = new HTML(marginstr); HorizontalPanel sdp = new HorizontalPanel(); sdp.setWidth(w2[1]); HorizontalPanel edp = new HorizontalPanel(); HorizontalPanel bdp = new HorizontalPanel(); bdp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); sdp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); sdp.add(startDate); sdp.add(margin); sdp.add(dateChooserS); sdp.add(margin); edp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); edp.add(endDate); edp.add(margin); edp.add(dateChooserE); edp.add(margin); edp.setWidth(w2[2]); endDate.setMaxLength(10); endDate.setWidth(w[2]); ((FlexFormPanel) flexForm).currentMargin = " "; flexForm.setWidth("621px"); HorizontalPanel pdp = new HorizontalPanel(); pdp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); pdp.setWidth(w[0]); pdp.add(planListBox); flexForm.addVerticalItem("Plan Name", pdp, w[0]); flexForm.addVerticalItem(marginstr, margin, "2px"); flexForm.addVerticalItem("Start", sdp, w2[1]); flexForm.addVerticalItem(marginstr, margin, "2px"); flexForm.addVerticalItem("End", edp, w2[2]); flexForm.addVerticalItem(marginstr, margin, "2px"); bdp.add(showActivityButton); HorizontalPanel fdp = new HorizontalPanel(); fdp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); fdp.setWidth("" + showActivityButton.getWidth() + "px"); fdp.add(showActivityButton); flexForm.addVerticalItem(" ", fdp, "60px"); // flexForm.addFormItem(" ",textBox); // flexForm.addFormItem(" ", startDate); // flexForm.addFormItem(" ", endDate); // flexForm.add(showActivityButton); flexForm.addRow(); flexForm.add(planSearchStatus); // planSearchStatus.setText(getPlanStatus("Complete")); planSearchStatus.setText(""); planSearchStatus.setStylePrimaryName("ShowInfoClass"); showActivityButton.addClickListener(new ClickListener() { public void onClick(final Widget sender) { showErr(false); boolean oktogo = Window.confirm("Search for Activities: from" + startDate.getText() + " through " + endDate.getText() + "?"); if (oktogo) { String planId = planListBox.getValue(planListBox.getSelectedIndex()); String planStatusId = (String) statusMap.get(planId); String planStatus = "Complete"; if (!planStatusId.equals("C")) { planStatus = "In-Progress"; } planSearchStatus.setText(getPlanStatus(planStatus)); gridLoad(1, 1, "id", "activitylog", store); } } }); itemRootName = "deptplan"; planListBox.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { // display status String planId = planListBox.getValue(planListBox.getSelectedIndex()); if ("0".equals(planId)) { planSearchStatus.setText(""); return; } String planStatusId = (String) statusMap.get(planId); String planStatus = "In-Progress"; if ("C".equals(planStatusId)) planStatus = "Complete"; else if ("D".equals(planStatusId)) planStatus = "Deleted"; planSearchStatus.setText(getPlanStatus(planStatus)); } }); itemService.getStringArray(itemRootName, institutionId, callbackPload); }
From source file:org.kuali.continuity.admin.main.client.Setting.java
License:Educational Community License
public void onModuleLoad() { RootPanel rootPanel = RootPanel.get("gwtRoot"); rootPanel.setWidth("760px"); VerticalPanel vp = new VerticalPanel(); vp.add(new HTML("<h1>Setup System Parameters</h1>")); switchAccessOnoffHTML.setWidth("282px"); vp.add(switchAccessOnoffHTML);// w w w . ja v a 2s . c o m HorizontalPanel switchAccessPanel = new HorizontalPanel(); switchAccessPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); switchAccessPanel.setWidth("700px"); switchAccessPanel.add(locationLabel); locationTextLabel.setWidth("151px"); locationTextLabel.setText(""); locationTextLabel.addStyleName("settings-read-only"); locationTextBox.setText(""); locationTextBox.setReadOnly(true); locationTextBox.setStyleName("SettingsLocationTextBox"); locationTextBox.setWidth("300px"); // locationTextBox.addStyleName("SettingsLocationTextBox"); // locationTextBox.setStylePrimaryName("SettingsLocationTextBox"); // switchAccessPanel.add(locationTextLabel); switchAccessPanel.add(locationTextBox); switchAccessPanel.add(accessLabel); switchAccessPanel.add(accessListBox); switchAccessPanel.setCellVerticalAlignment(locationLabel, HasVerticalAlignment.ALIGN_MIDDLE); switchAccessPanel.setCellVerticalAlignment(accessLabel, HasVerticalAlignment.ALIGN_MIDDLE); switchAccessPanel.setCellVerticalAlignment(locationTextBox, HasVerticalAlignment.ALIGN_MIDDLE); switchAccessPanel.setCellVerticalAlignment(accessListBox, HasVerticalAlignment.ALIGN_MIDDLE); vp.add(switchAccessPanel); final Label usingThisControlLabel = new HTML( "<p class='StandardWidth'>Using this control, an Institution Administrator or Local Administrator can specify who may access this planning tool, at any location under his/her control. One use of this is to \"turn off\" access to end-users (\"Local Users\") while customization is being done to the application</p>"); vp.add(usingThisControlLabel); // --- test mode vp.add(testModePanel); testModePanel.add(new HTML("<hr style='margin-top:10px;'/>")); testModePanel.add(new HTML("<h3>Testing mode:</h3>")); testModePanel.add(testModeCheckBox); testModeCheckBox.setHTML( "<span class=\"gwt-HTML-location\"> Check here to place the system in Testing Mode. Testing Mode temporarily disables the automated email messages that are generated when you add a person's name onto the Add/Remove User screen, or when you approve/deny a password request on the Moderator's Approval screen. Do this when testing, troubleshooting, setting up plans, etc. to avoid sending unwanted emails. Uncheck to turn back on.</span>"); FlexTable testModeTable = new FlexTable(); testModeTable.setWidth("700px"); testModeTable.getFlexCellFormatter().setColSpan(0, 0, 2); testModeTable.setHTML(0, 0, "<span class=\"gwt-HTML-location\"> </span>"); testModeTable.getFlexCellFormatter().setColSpan(1, 0, 2); testModeTable.setHTML(1, 0, "<span class=\"gwt-HTML-location\">Please note:</span>"); testModeTable.setHTML(2, 0, "<span class=\"gwt-HTML-location\">(1) </span>"); testModeTable.setHTML(2, 1, "<span class=\"gwt-HTML-location\">Testing Mode disables only the emails that would be generated by YOU. Testing Mode has no impact on other users: they will continue to experience normal system behavior.</span>"); testModeTable.setHTML(3, 0, "<span class=\"gwt-HTML-location\">(2) </span>"); testModeTable.setHTML(3, 1, "<span class=\"gwt-HTML-location\">Testing Mode disables only those emails generated by the Add/Remove User screen and by the Moderator's Approval screen. Emails generated by the login screens (to create a new account, or replace a forgotten password) will continue to be generated as normal.</span>"); testModeTable.setHTML(4, 0, "<span class=\"gwt-HTML-location\">(3) </span>"); testModeTable.setHTML(4, 1, "<span class=\"gwt-HTML-location\">Emails are never generated by the Manage User Accounts screen, so that screen is not of concern.</span>"); testModePanel.add(testModeTable); // -- email VerticalPanel emailVPanel = new VerticalPanel(); vp.add(emailVPanel); emailVPanel.add(new HTML("<hr style='margin-top:10px;'/>")); emailVPanel.add(new HTML("<h3>Return Address for System-Generated Emails:</h3>")); emailVPanel.add(new HTML( "<p class=\"StandardWidth\">Under certain circumstances, this tool will generate & send emails to users (details are given in the Administrator's Manual).</p>" + "<p class=\"StandardWidth\">Please choose here the <span style='font-weight:bold;'>return address</span> that will be displayed on these emails.</p>" + "<ul class=\"bulletlist\">" + "<li>You might use the email address of one of your Local Administrators</li>" + "<li>You might use the address of a departmental email account, if you have one; or</li>" + "<li>You might create a special email account for this purpose.</li>" + "</ul><p>" + "<p class=\"StandardWidth\">Keep in mind that recipients are often reluctant to open emails that have odd-looking return addresses.</p>" + "<p class=\"StandardWidth\">You may change this return address at any time in future by simply entering a new address here.</p>")); emailVPanel.add(emailPanel); emailPanel.setWidth("700px"); HTML emailLabel = new HTML( "<span style='font-weight:bold;'>Return address for system-generated emails:</span>"); emailTextBox.setStyleName("SettingDomainTextBox"); emailTextBox.setWidth("300px"); emailPanel.add(emailLabel); emailPanel.add(emailTextBox); // -- screen options vp.add(new HTML("<hr style='margin-top:10px;'/>")); vp.add(screenOptionsHTML); vp.add(showTeamsCheckBox); showTeamsCheckBox.setText("Show Teams"); showTeamsCheckBox.addStyleName("optional-screen-list"); vp.add(showSkillsCheckBox); showSkillsCheckBox.setText("Show Skills"); showSkillsCheckBox.addStyleName("optional-screen-list"); vp.add(showStaffingBox); showStaffingBox.setText("Show Staffing Requirements"); showStaffingBox.addStyleName("optional-screen-list"); vp.add(showExamplesOfCheckBox); showExamplesOfCheckBox.setWidth("240px"); showExamplesOfCheckBox.setText("Show Examples of Critical Functions"); showExamplesOfCheckBox.addStyleName("optional-screen-list"); vp.add(replaceStep4); replaceStep4.setSize("455px", "22px"); replaceStep4.setText("Replace Step 4: Instruction with Step 4: Faculty Preparedness"); replaceStep4.addStyleName("optional-screen-list"); final HTML theseSettingsControlLabel = new HTML( "<p class=\"StandardWidth\">These settings control the display or non-display of certain screens. When checked, the screen in question will appear for ALL users at a location. When un-checked, the screen will be hidden from ALL users at that location.</p>" + "<p class=\"StandardWidth\">These settings apply to one location (campus) only. In a multi-campus institution, the settings would have to be done separately for each campus - they cannot be done for the whole institution.</p>" + "<p class=\"StandardWidth\">These settings do not affect the data in the database. Hence when you switch a screen off, any data displayed on that screen remains in the database and will re-appear if you switch the screen on again at some future time.</p>"); vp.add(theseSettingsControlLabel); theseSettingsControlLabel.setSize("709px", "107px"); // --- select other optional features vp.add(otherPanel); otherPanel.add(new HTML("<hr style='margin-top:10px;'/>")); otherPanel.add(new HTML("<h3>Select Other Optional Features:</h3>")); otherPanel.add(showCriticalLevelCheckBox); showCriticalLevelCheckBox.setHTML( " <span style='font-weight:bold;'>Detail Screens:</span> In Step 2 Critical Functions, display the detail screens for ALL functions, " + "regardless of criticality level. If unchecked, the detail screens will be displayed for functions whose criticality level is one of " + "the top three levels, but will NOT be displayed for functions assigned the fourth (lowest) level of criticality."); // --- select the rule for issuing passwords vp.add(modPanel); modPanel.setVisible(false); modPanel.add(new HTML("<hr style='margin-top:10px;'/>")); modPanel.add(new HTML("<h3>Select the Rule for Issuing Passwords:</h3>")); modPanel.add(new HTML( "<p class='StandardWidth'>This selection applies only when the location (campus) is configured for Direct Login (i.e., when Ariah Continuity issues passwords to users via email). </p>")); modPanel.add(radioFull); radioFull.setText( "Full Moderation (every password request is submitted to the Moderator for approval before a password is issued)"); radioFull.addStyleName("password-rules-list"); radioFull.setChecked(true); modPanel.add(radioPartial); radioPartial.setText( "Partial Moderation (issue passwords to users from the following email domains, submit other requests to Moderator):"); radioPartial.addStyleName("password-rules-list"); // set token String token = Cookies.getCookie(CSRF_TOKEN); csrfToken.setValue(token); vp.add(csrfToken); rootPanel.add(vp); // rootPanel.setStyleName("delText"); // Buttons backButton.setStyleName("BackButtonClass"); saveSettingsButton.setStyleName("SaveButtonClass"); // SimplePanel rootPanel = new SimplePanel(); itemService = (SimpleServiceAsync) GWT.create(SimpleService.class); backButton.setStyleName("BackButtonClass"); backButton.setText("Back"); backButton.addClickListener(new ClickListener() { public void onClick(final Widget sender) { showErr(false); redirect("/continuity/admin/adminHome"); } }); saveSettingsButton.setStyleName("SaveButtonClass"); saveSettingsButton.setText("Save Settings"); saveSettingsButton.addClickListener(new ClickListener() { public void onClick(final Widget sender) { showErr(false); invalidEmailHTML.setVisible(false); String retEmailAddr = emailTextBox.getText(); if (retEmailAddr != null && retEmailAddr.trim().length() != 0 && !retEmailAddr.matches("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$")) { invalidEmailHTML.setVisible(true); return; } domainList = new ArrayList(); for (Iterator i = tableRoot.iterator(); i.hasNext();) { HorizontalPanel hp = (HorizontalPanel) i.next(); Label dl = (Label) hp.getWidget(0); // Window.alert("Adding "+(String) dl.getText() ); domainList.add((String) dl.getText()); } boolean ok = true; // if (domainList.size() > 0 && radioFull.isChecked()) { // // radioPartial.setChecked(false); // radioFull.setChecked(true); // ok = true; // } if (domainList.size() == 0 && radioPartial.isChecked()) { ok = false; boolean uncheck = Window.confirm( "You have selected partial moderation with no email domains. Do you wish to use full moderation instead?"); if (!uncheck) { Window.alert( "Please enter email domains for partial moderation, or select full moderation."); } else { radioPartial.setChecked(false); radioFull.setChecked(true); ok = true; } } if (ok) ok = Window.confirm("Update System Parameters: " + "are you sure?"); if (ok) { SettingItem item = new SettingItem(); item.setAccess(new Integer(accessListBox.getValue(accessListBox.getSelectedIndex()))); Boolean[] opts = { false, false, false, false, false, false }; opts[SettingItem.optionType.Teams.ordinal()] = showTeamsCheckBox.isChecked(); opts[SettingItem.optionType.Skills.ordinal()] = showSkillsCheckBox.isChecked(); opts[SettingItem.optionType.Staffing.ordinal()] = showStaffingBox.isChecked(); opts[SettingItem.optionType.Functions.ordinal()] = showExamplesOfCheckBox.isChecked(); opts[SettingItem.optionType.Replace.ordinal()] = !replaceStep4.isChecked(); opts[SettingItem.optionType.CriticalityLevel.ordinal()] = showCriticalLevelCheckBox.isChecked(); item.setOptions(opts); // ArrayList<String> domainList = new ArrayList(); // admin email disabled item.setInTestMode(testModeCheckBox.isChecked()); if (radioFull.isChecked()) { item.setFullModeration("1"); } else if (radioPartial.isChecked()) { item.setFullModeration("2"); } item.setSystemName(systemNameTextBox.getText()); item.setEmail(emailTextBox.getText()); item.setCsrfToken(csrfToken.getValue()); String str[] = new String[domainList.size()]; domainList.toArray(str); item.setDomainList(str); String[] str2 = item.getDomainList(); // String slist=""; // for (String s: str) { // slist+=s+" "; // } // Window.alert("Saving: "+slist); itemService.updateItem("setting", item, updateItemCallback); } } }); final HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.add(backButton); buttonPanel.add(saveSettingsButton); final HorizontalPanel domainPanel = new HorizontalPanel(); modPanel.add(domainPanel); // vp.add(domainPanel); final Label allowThisDomainLabel = new Label("Allow this domain (e.g. tufts.edu, tuftsfund.org):"); domainPanel.add(allowThisDomainLabel); allowThisDomainLabel.setWidth("284px"); allowThisDomainLabel.addStyleName("SettingAllowThisDomainLabel"); domainPanel.add(domainTextBox); domainTextBox.setSize("255px", "20px"); domainTextBox.setStyleName("SettingDomainTextBox"); final Button addButton = new Button(); domainPanel.add(addButton); addButton.setSize("103px", "22px"); addButton.addClickListener(new ClickListener() { public void onClick(final Widget sender) { // Label listItem = new Label(); // listItem.setText(domainTextBox.getText()); // domainList.add(listItem); addDomain(); } }); addButton.setStyleName("ButtonClass"); addButton.setText("Add to List"); // Setup test code: delete final Label domain1 = new Label("l1"); // rootPanel.add(domain1, 345, 460); domain1.setSize("255px", "15px"); final Label del1 = new Label("delete"); // rootPanel.add(del1, 620, 460); //del1.setStylePrimaryName("gwt-Labeld"); del1.setStyleName("SettingDomainDeleteLink"); del1.setSize("47px", "15px"); formLoad(); tableRoot = new VerticalPanel(); tableRoot.addStyleName("domain_list"); //tableRoot.addStyleName("partial-moderation-margin"); HTML allowedDomainLab = new HTML("<p><strong>Allowed Domains:</strong></p>"); allowedDomainLab.addStyleName("SettingAllowDomainLabel"); modPanel.add(allowedDomainLab); modPanel.add(tableRoot); tableRoot.setWidth("300px"); vp.add(new HTML("<hr style='margin-top:10px;'/>")); vp.add(new HTML("<h3>Create a Name for this Planning Tool:</h3>")); vp.add(new HTML( "<p class='StandardWidth'>Please enter here a name for your local version of the Ariah Continuity tool. This name will appear in the system-generated emails that notify users about new accounts, passwords, etc. Some possible examples: Indiana Ready, UBC Ready, Penn State Continuity Planner. For consistency, please use the same name as will appear in your custom graphics at the top of every page.</p>")); systemNameTextBox.setSize("644px", "20px"); systemNameTextBox.setMaxLength(1000); systemNameTextBox.setStyleName("SettingDomainTextBox"); vp.add(systemNameTextBox); vp.add(new HTML("<hr style='margin-top:10px;'/>")); invalidEmailHTML.setVisible(false); vp.add(invalidEmailHTML); vp.add(buttonPanel); }