public void setLayerModel(LayerModelDto model) { this.layerModel = model; name.setValue(model.getName()); publicLayer.setValue(model.isPublic()); active.setValue(model.isActive()); visible.setValue(model.isDefaultVisible()); }
public DynamicLayerConfiguration getData() { layerConfig.getClientLayerInfo().setLabel(name.getValueAsString()); layerConfig.getClientLayerInfo().setVisible(visible.getValueAsBoolean()); extraLayerInfo.setPublic(publicLayer.getValueAsBoolean()); extraLayerInfo.setActive(active.getValueAsBoolean()); return layerConfig; }
public LayerModelDto getLayerModel() { layerModel.setActive(active.getValueAsBoolean()); layerModel.setDefaultVisible(visible.getValueAsBoolean()); layerModel.setName(name.getValueAsString()); layerModel.setPublic(publicLayer.getValueAsBoolean()); return layerModel; }
public EvaluateOrFinishForm() { super(); reportValues.setName("reportValues"); reportValues.setTitle("Report values"); setFields(reportValues); }
/** * Get content for bookmark popup * * @return */ private HLayout getPopupContent() { HLayout hlayout = new HLayout(); hlayout.setWidth100(); hlayout.setHeight100(); DynamicForm form = new DynamicForm(); form.setHeight100(); form.setWidth(260); form.setTitleWidth(100); bookmarkTitle = new TextItem(); bookmarkTitle.setTitle("Title"); if (!view.getSettings().inSingleEndpointMode()) { includeEndpoint = new CheckboxItem(); includeEndpoint.setTitle("Include endpoint"); includeEndpoint.setLabelAsTitle(true); form.setItems(bookmarkTitle, includeEndpoint); } else { form.setItems(bookmarkTitle); } Button bookmarkButton = new Button("Bookmark"); bookmarkButton.setHeight100(); bookmarkButton.setWidth(60); bookmarkButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Bookmark bookmark = new Bookmark(); if (includeEndpoint != null && includeEndpoint.getValueAsBoolean()) { bookmark.setEndpoint(view.getSelectedTabSettings().getEndpoint()); } bookmark.setQuery(view.getSelectedTabSettings().getQueryString()); bookmark.setTitle(bookmarkTitle.getValueAsString()); window.clear(); setSrc(Imgs.get(Imgs.LOADING)); view.getRemoteService() .addBookmark( bookmark, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { setSrc(Imgs.get(Imgs.BOOKMARK_QUERY)); if (caught instanceof OpenIdException) { view.getElements().onError(caught.getMessage() + ". Logging out"); view.getOpenId().logOut(); } else { view.getElements().onError(caught); } } @Override public void onSuccess(Void result) { setSrc(Imgs.get(Imgs.BOOKMARK_QUERY)); } }); } }); hlayout.addMembers(form, Helper.getHSpacer(), bookmarkButton); return hlayout; }
public void setData(DynamicLayerConfiguration layerConfig) { this.layerConfig = layerConfig; this.extraLayerInfo = (DeskmanagerClientLayerInfo) layerConfig.getClientLayerInfo().getUserData(); name.setValue(layerConfig.getClientLayerInfo().getLabel()); publicLayer.setValue(extraLayerInfo.isPublic()); active.setValue(extraLayerInfo.isActive()); visible.setValue(layerConfig.getClientLayerInfo().isVisible()); }
@Override public Map<String, String> getVariables() { Map<String, String> result = new HashMap<String, String>(); result.put( KtunaxaBpmConstant.VAR_REPORT_VALUES + KtunaxaBpmConstant.SET_BOOLEAN, nullSafeToString(reportValues.getValue())); return result; }
public LayerSettingsForm() { // setWidth100(); setColWidths("125", "*"); name = new TextItem(); name.setTitle(MESSAGES.layerSettingsLayerName()); name.setWidth(250); name.setRequired(true); publicLayer = new CheckboxItem(); publicLayer.setTitle(MESSAGES.layerSettingsPublic()); publicLayer.setTooltip(MESSAGES.layerSettingsPublicTooltip()); active = new CheckboxItem(); active.setTitle(MESSAGES.layerSettingsActive()); active.setTooltip(MESSAGES.layerSettingsActiveTooltip()); visible = new CheckboxItem(); visible.setTitle(MESSAGES.layerSettingsVisibleByDefault()); visible.setTooltip(MESSAGES.layerSettingsVisibleByDefaultTooltip()); // ------------------------------------------------- setFields(name, publicLayer, active, visible); }
private void search() { try { String calendar_state_id = calendarStateItem.getValueAsString(); Criteria criteria = new Criteria(); if (calendar_state_id != null && !calendar_state_id.trim().equals("")) { criteria.setAttribute("calendar_state_id", new Integer(calendar_state_id)); } String calendar_event_id = secCalendarTypeItem.getValueAsString(); if (calendar_event_id != null && !calendar_event_id.trim().equals("")) { criteria.setAttribute("calendar_event_id", new Integer(calendar_event_id)); } boolean checkedDate = byCalendarDayItem.getValueAsBoolean(); if (checkedDate) { Date calendar_day = calendarDayItem.getValueAsDate(); if (calendar_day != null) { criteria.setAttribute("calendar_day", calendar_day); } } String calendar_description = descriptionItem.getValueAsString(); if (calendar_description != null && !calendar_description.trim().equals("")) { criteria.setAttribute("calendar_description", calendar_description); } String calendar_comment = commentItem.getValueAsString(); if (calendar_comment != null && !calendar_comment.trim().equals("")) { criteria.setAttribute("calendar_comment", calendar_comment); } DSRequest dsRequest = new DSRequest(); dsRequest.setAttribute("operationId", "searchAllSecularCalendars"); listGrid.invalidateCache(); listGrid.filterData( criteria, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) {} }, dsRequest); } catch (Exception e) { SC.say(e.toString()); } }
public UserDetailTabPane(DataSource userDS, final ItemListGrid userListGrid) { this.userListGrid = userListGrid; setStyleName("defaultBorder"); userViewer = new DetailViewer(); userViewer.setDataSource(userDS); userViewer.setWidth100(); userViewer.setMargin(25); userViewer.setEmptyMessage("Select an user to view its details"); editorLabel = new Label(); editorLabel.setWidth100(); editorLabel.setHeight100(); editorLabel.setAlign(Alignment.CENTER); editorLabel.setContents("Select an user to edit, or insert a new user into"); insertLabel = new Label(); insertLabel.setWidth100(); insertLabel.setHeight100(); insertLabel.setAlign(Alignment.CENTER); insertLabel.setContents("Insert a new user into"); // update form editorForm = new DynamicForm(); editorForm.setWidth(650); editorForm.setMargin(25); editorForm.setNumCols(4); editorForm.setCellPadding(5); editorForm.setAutoFocus(false); editorForm.setDataSource(userDS); editorForm.setUseAllDataSourceFields(true); userId = new StaticTextItem("userId", "User ID"); userName = new TextItem("userName", "User Name"); password = new PasswordItem("password", "Password"); enabled = new CheckboxItem("enabled", "Enabled"); userName.setRequired(true); password.setRequired(true); ButtonItem saveButton = new ButtonItem("saveUser", "Update user info."); saveButton.setAlign(Alignment.CENTER); saveButton.setWidth(100); saveButton.setColSpan(4); saveButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // editorForm.saveData(); if (userId.getValue() == null) { return; } if (!editorForm.validate(false)) { return; } User user = new User(); user.setUserId((String) userId.getValue()); user.setUserName(userName.getValueAsString()); user.setPassword(password.getValueAsString()); user.setEnabled(enabled.getValueAsBoolean()); userService.updateUser( user, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { SC.say("Error", "Server side error occured. Contact your administrator."); } public void onSuccess(Void noAnswer) { SC.say("Updated", "User info. is updated."); userListGrid.invalidateCache(); } }); } }); editorForm.setFields(userId, userName, password, enabled, saveButton); editorForm.setColWidths(100, 200, 100, 200); // insert form insertForm = new DynamicForm(); insertForm.setWidth(650); insertForm.setMargin(25); insertForm.setNumCols(4); insertForm.setCellPadding(5); insertForm.setAutoFocus(false); insertForm.setDataSource(userDS); insertForm.setUseAllDataSourceFields(true); userId4add = new TextItem("userId", "User ID"); userName4add = new TextItem("userName", "User Name"); password4add = new PasswordItem("password", "Password"); enabled4add = new CheckboxItem("enabled", "Enabled"); enabled4add.setValue(true); userId4add.setRequired(true); userName4add.setRequired(true); password4add.setRequired(true); ButtonItem addButton = new ButtonItem("addUser", "Add user info."); addButton.setAlign(Alignment.CENTER); addButton.setWidth(100); addButton.setColSpan(4); addButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (!insertForm.validate(false)) { return; } User user = new User(); user.setUserId(userId4add.getValueAsString()); user.setUserName(userName4add.getValueAsString()); user.setPassword(password4add.getValueAsString()); user.setEnabled(enabled4add.getValueAsBoolean()); userService.addUser( user, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { SC.say("Error", "Server side error occured. Contact your administrator."); } public void onSuccess(Void noAnswer) { SC.say("Added", "User info. is added."); userListGrid.invalidateCache(); insertForm.clearValues(); } }); } }); insertForm.setFields(userId4add, userName4add, password4add, enabled4add, addButton); insertForm.setColWidths(100, 200, 100, 200); // tab Tab viewTab = new Tab("View"); viewTab.setIcon("silk/application_form.png"); viewTab.setWidth(70); viewTab.setPane(userViewer); Tab editTab = new Tab("Edit"); editTab.setIcon("demoApp/icon_edit.png"); editTab.setWidth(70); editTab.setPane(editorForm); Tab insertTab = new Tab("Add"); insertTab.setIcon("demoApp/icon_add.png"); insertTab.setWidth(70); insertTab.setPane(insertForm); setTabs(viewTab, editTab, insertTab); addTabSelectedHandler( new TabSelectedHandler() { public void onTabSelected(TabSelectedEvent event) { updateDetails(); } }); }
public TabCalendar() { try { setTitle(CallCenter.constants.menuCalendar()); setCanClose(true); datasource = DataSource.get("CalSecDS"); mainLayout = new VLayout(5); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setMargin(5); searchForm = new DynamicForm(); searchForm.setAutoFocus(true); searchForm.setWidth(780); searchForm.setTitleWidth(300); searchForm.setNumCols(4); mainLayout.addMember(searchForm); calendarStateItem = new ComboBoxItem(); calendarStateItem.setTitle(CallCenter.constants.type()); calendarStateItem.setWidth(300); calendarStateItem.setName("calendar_state_id"); calendarStateItem.setValueMap(ClientMapUtil.getInstance().getCalendarStates()); calendarStateItem.setAddUnknownValues(false); secCalendarTypeItem = new ComboBoxItem(); secCalendarTypeItem.setTitle(CallCenter.constants.moonPhase()); secCalendarTypeItem.setWidth(300); secCalendarTypeItem.setName("calendar_event_id"); secCalendarTypeItem.setValueMap(ClientMapUtil.getInstance().getSecCalendarTypes()); secCalendarTypeItem.setAddUnknownValues(false); calendarDayItem = new DateItem(); calendarDayItem.setTitle(CallCenter.constants.date()); calendarDayItem.setWidth(300); calendarDayItem.setValue(new Date()); calendarDayItem.setName("calendar_day"); calendarDayItem.setHint(CallCenter.constants.choose()); descriptionItem = new TextItem(); descriptionItem.setTitle(CallCenter.constants.description()); descriptionItem.setName("calendar_description"); descriptionItem.setWidth(300); commentItem = new TextItem(); commentItem.setTitle(CallCenter.constants.comment()); commentItem.setName("calendar_comment"); commentItem.setWidth(300); byCalendarDayItem = new CheckboxItem(); byCalendarDayItem.setTitle(CallCenter.constants.searchByDate()); byCalendarDayItem.setWidth(300); byCalendarDayItem.setName("buCalDaySearch"); byCalendarDayItem.setValue(false); searchForm.setFields( calendarStateItem, secCalendarTypeItem, descriptionItem, commentItem, byCalendarDayItem, calendarDayItem); HLayout buttonLayout = new HLayout(5); buttonLayout.setWidth(780); buttonLayout.setHeight(30); buttonLayout.setAlign(Alignment.RIGHT); clearButton = new IButton(); clearButton.setTitle(CallCenter.constants.clear()); findButton = new IButton(); findButton.setTitle(CallCenter.constants.find()); buttonLayout.setMembers(findButton, clearButton); mainLayout.addMember(buttonLayout); ToolStrip toolStrip = new ToolStrip(); toolStrip.setWidth(780); toolStrip.setPadding(5); mainLayout.addMember(toolStrip); addBtn = new ToolStripButton(CallCenter.constants.add(), "addIcon.png"); addBtn.setLayoutAlign(Alignment.LEFT); addBtn.setWidth(50); toolStrip.addButton(addBtn); editBtn = new ToolStripButton(CallCenter.constants.modify(), "editIcon.png"); editBtn.setLayoutAlign(Alignment.LEFT); editBtn.setWidth(50); toolStrip.addButton(editBtn); disableBtn = new ToolStripButton(CallCenter.constants.disable(), "deleteIcon.png"); disableBtn.setLayoutAlign(Alignment.LEFT); disableBtn.setWidth(50); toolStrip.addButton(disableBtn); activateBtn = new ToolStripButton(CallCenter.constants.enable(), "restoreIcon.gif"); activateBtn.setLayoutAlign(Alignment.LEFT); activateBtn.setWidth(50); toolStrip.addButton(activateBtn); toolStrip.addSeparator(); copyBtn = new ToolStripButton(CallCenter.constants.copy(), "copy.png"); copyBtn.setLayoutAlign(Alignment.LEFT); copyBtn.setWidth(50); toolStrip.addButton(copyBtn); listGrid = new ListGrid() { protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { ListGridRecord countryRecord = (ListGridRecord) record; if (countryRecord == null) { return super.getCellCSSText(record, rowNum, colNum); } Integer deleted = countryRecord.getAttributeAsInt("deleted"); if (deleted != null && !deleted.equals(0)) { return "color:red;"; } else { return super.getCellCSSText(record, rowNum, colNum); } }; }; listGrid.setWidth(780); listGrid.setHeight(260); listGrid.setAlternateRecordStyles(true); listGrid.setDataSource(datasource); listGrid.setAutoFetchData(false); listGrid.setShowFilterEditor(false); listGrid.setCanEdit(false); listGrid.setCanRemoveRecords(false); listGrid.setFetchOperation("searchAllSecularCalendars"); listGrid.setShowRowNumbers(true); listGrid.setCanHover(true); listGrid.setShowHover(true); listGrid.setShowHoverComponents(true); datasource.getField("calendar_day").setTitle(CallCenter.constants.date()); datasource.getField("event").setTitle(CallCenter.constants.moonPhase()); datasource.getField("state").setTitle(CallCenter.constants.type()); datasource.getField("sun_rise").setTitle(CallCenter.constants.order()); datasource.getField("calendar_description").setTitle(CallCenter.constants.description()); datasource.getField("calendar_comment").setTitle(CallCenter.constants.comment()); datasource.getField("rec_date").setTitle(CallCenter.constants.recDate()); datasource.getField("rec_user").setTitle(CallCenter.constants.recUser()); datasource.getField("upd_date").setTitle(CallCenter.constants.updDate()); datasource.getField("upd_user").setTitle(CallCenter.constants.updUser()); ListGridField calendar_day = new ListGridField("calendar_day", CallCenter.constants.date(), 150); ListGridField event = new ListGridField("event", CallCenter.constants.moonPhase(), 150); ListGridField state = new ListGridField("state", CallCenter.constants.type(), 80); ListGridField sun_rise = new ListGridField("sun_rise", CallCenter.constants.sunRise(), 100); ListGridField calendar_description = new ListGridField("calendar_description", CallCenter.constants.description(), 250); calendar_day.setAlign(Alignment.LEFT); event.setAlign(Alignment.LEFT); state.setAlign(Alignment.CENTER); sun_rise.setAlign(Alignment.CENTER); listGrid.setFields(calendar_day, event, state, sun_rise, calendar_description); mainLayout.addMember(listGrid); findButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(); } }); clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { calendarStateItem.clearValue(); secCalendarTypeItem.clearValue(); calendarDayItem.clearValue(); descriptionItem.clearValue(); commentItem.clearValue(); } }); addBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, null, false); dlgEditSecCalendar.show(); } }); editBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, false); dlgEditSecCalendar.show(); } }); copyBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, true); dlgEditSecCalendar.show(); } }); disableBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } Integer deleted = listGridRecord.getAttributeAsInt("deleted"); if (!deleted.equals(0)) { SC.say(CallCenter.constants.recordAlrDisabled()); return; } final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id"); SC.ask( CallCenter.constants.askForDisable(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { changeStatus(calendar_id, 1); } } }); } }); activateBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } Integer deleted = listGridRecord.getAttributeAsInt("deleted"); if (deleted.equals(0)) { SC.say(CallCenter.constants.recordAlrEnabled()); return; } final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id"); SC.ask( CallCenter.constants.askForEnable(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { changeStatus(calendar_id, 0); } } }); } }); TabSet tabSet = new TabSet(); tabSet.setWidth(780); Tab tabDetViewer = new Tab(CallCenter.constants.view()); final DetailViewer detailViewer = new DetailViewer(); detailViewer.setDataSource(datasource); detailViewer.setWidth(750); tabDetViewer.setPane(detailViewer); listGrid.addRecordClickHandler( new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { detailViewer.viewSelectedData(listGrid); } }); listGrid.addRecordDoubleClickHandler( new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, false); dlgEditSecCalendar.show(); } }); tabSet.setTabs(tabDetViewer); mainLayout.addMember(tabSet); setPane(mainLayout); } catch (Exception e) { e.printStackTrace(); SC.say(e.getMessage().toString()); } }
private void initComponents() { HLayout formsHLayout = new HLayout(); formsHLayout.setWidth100(); formsHLayout.setHeight("*"); formsHLayout.setMembersMargin(5); DynamicForm jobNamesForm = new DynamicForm(); jobNamesForm.setWidth100(); jobNamesForm.setHeight100(); jobNamesForm.setGroupTitle("Filter Jobs"); jobNamesForm.setIsGroup(true); jobNamesForm.setTitleOrientation(TitleOrientation.TOP); jobNamesForm.setNumCols(2); jobNamesForm.setValuesManager(valuesManager); jobNamesForm.setDataFetchMode(FetchMode.BASIC); CheckboxItem selectAllJobNamesChkItem = new CheckboxItem(); selectAllJobNamesChkItem.setValue(true); selectAllJobNamesChkItem.setTitle("Select All Jobs"); selectAllJobNamesChkItem.setWidth("*"); selectAllJobNamesChkItem.setName("selectAllJobNames"); selectAllJobNamesChkItem.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { if ((Boolean) event.getValue()) { selectJobNameGrid.setDisabled(true); selectJobNameGrid.setCriterion(null); } else { selectJobNameGrid.setDisabled(false); // selectJobNameGrid.setCriterion(new Criterion().seta); } } }); selectJobNameGrid.setTitle("Select Jobs"); selectJobNameGrid.setWidth(280); selectJobNameGrid.setMultiple(true); selectJobNameGrid.setMultipleAppearance(MultipleAppearance.GRID); selectJobNameGrid.setValueMap("job", "job1", "job2", "Goat", "Marmoset", "Mouse"); selectJobNameGrid.setName("selectedJobNames"); selectJobNameGrid.setCriteriaField("selectedJobNames"); /*selectJobNameGrid.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if(event.getSource().equals(selectJobNameGrid)){ String[] values = selectJobNameGrid.getValues(); valuesManager.setAttribute("selectedJobNames", values, true); } } });*/ executionStartDate.setName("executionStartDate"); executionStartDate.setTitle("Exceution Start Date"); executionStartDate.setRequired(true); executionEndDate.setName("executionEndDate"); executionEndDate.setTitle("Exceution End Date"); executionEndDate.setRequired(true); executionStartTime.setName("executionStartTime"); executionStartTime.setTitle("Exceution Start Time"); executionStartTime.setRequired(true); executionEndTime.setName("executionEndTime"); executionEndTime.setTitle("Exceution End Time"); executionEndTime.setRequired(true); FormItem[] formItems = new FormItem[] { selectAllJobNamesChkItem, selectJobNameGrid, executionStartDate, executionStartTime, executionEndDate, executionEndTime }; jobNamesForm.setDataSource(HistoricalJobMonitorDataSource.getInstance(), formItems); jobNamesForm.setFields(formItems); formsHLayout.addMember(jobNamesForm); addMember(formsHLayout); addMember(searchButton); }
protected CheckboxItem createActivateCheckboxItem(final ListGridRecord ruleRecord) { CheckboxItem checkBox = new CheckboxItem(ACTIVATED_FIELD, " "); checkBox.setValue(ruleRecord.getAttributeAsBoolean(SUBSCRIBED)); checkBox.addChangedHandler(createActivateChangedHandler(ruleRecord)); return checkBox; }
private DynamicForm getConnectionForm() { connectionForm = new DynamicForm(); connectionForm.setNumCols(4); connectionForm.setWrapItemTitles(false); connectionForm.setColWidths("130", "450", "110"); connectionForm.setExtraSpace(15); connectionForm.setWidth(790); connectionForm.setPadding(5); connectionForm.setIsGroup(true); connectionForm.setGroupTitle(MSG.view_remoteAgentInstall_connInfo()); final int textFieldWidth = 440; TextItem host = new TextItem("host", MSG.common_title_host()); host.setRequired(true); host.setWidth(textFieldWidth); host.setPrompt(MSG.view_remoteAgentInstall_promptHost()); host.setHoverWidth(300); host.setEndRow(true); host.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { hostAuthorized = false; // if the host changes, we need to make sure the user authorizes it if needed } }); TextItem port = new TextItem("port", MSG.common_title_port()); port.setRequired(false); port.setWidth(textFieldWidth); port.setPrompt(MSG.view_remoteAgentInstall_promptPort()); port.setHoverWidth(300); port.setEndRow(true); IntegerRangeValidator portValidator = new IntegerRangeValidator(); portValidator.setMin(1); portValidator.setMax(65535); port.setValidators(new IsIntegerValidator(), portValidator); TextItem username = new TextItem("username", MSG.common_title_user()); username.setRequired( false); // if not specified, the server will attempt to use the default ssh user defined in // system settings username.setWidth(textFieldWidth); username.setPrompt(MSG.view_remoteAgentInstall_promptUser()); username.setHoverWidth(300); username.setEndRow(true); PasswordItem password = new PasswordItem("password", MSG.common_title_password()); password.setRequired( false); // if not specified, the server will attempt to use the default ssh pw defined in // system settings password.setWidth(textFieldWidth); password.setPrompt(MSG.view_remoteAgentInstall_promptPassword()); password.setHoverWidth(300); password.setEndRow(true); password.setAttribute("autocomplete", "off"); rememberMeCheckbox = new CheckboxItem("rememberme", MSG.view_remoteAgentInstall_rememberMe()); rememberMeCheckbox.setRequired(false); rememberMeCheckbox.setPrompt(MSG.view_remoteAgentInstall_promptRememberMe()); rememberMeCheckbox.setHoverWidth(300); rememberMeCheckbox.setColSpan(2); rememberMeCheckbox.setEndRow(true); agentInstallPath = new TextItem("agentInstallPath", MSG.view_remoteAgentInstall_installPath()); agentInstallPath.setWidth(textFieldWidth); agentInstallPath.setPrompt(MSG.view_remoteAgentInstall_promptInstallPath()); agentInstallPath.setHoverWidth(300); agentInstallPath.setStartRow(true); agentInstallPath.setEndRow(false); agentInstallPath.setValidators( absPathValidator); // we will "turn this on" when needed - this is to ensure we create paths // properly and it doesn't go in places user isn't expecting findAgentInstallPathButton = new ButtonItem("findAgentInstallPathButton", MSG.view_remoteAgentInstall_buttonFindAgent()); findAgentInstallPathButton.setStartRow(false); findAgentInstallPathButton.setEndRow(true); if (findAgentInstallPathButton.getTitle().length() < 15) { // i18n may prolong the title findAgentInstallPathButton.setWidth(100); } findAgentInstallPathButton.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { public void onClick( com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) { // we only want to validate host if (connectionForm.getValueAsString("host") == null || connectionForm.getValueAsString("host").trim().isEmpty()) { final HashMap<String, String> errors = new HashMap<String, String>(1); errors.put("host", CoreGUI.getSmartGwtMessages().validator_requiredField()); connectionForm.setErrors(errors, true); return; } new CheckSSHConnectionCallback() { @Override protected void doActualWork() { findAgentInstallPath(); } }.execute(); } }); createAgentStatusTextItem(); statusCheckButton = new ButtonItem("updateStatus", MSG.common_title_updateStatus()); statusCheckButton.setStartRow(false); statusCheckButton.setEndRow(true); if (findAgentInstallPathButton.getTitle().length() < 15) { // i18n may prolong the title statusCheckButton.setWidth(100); } statusCheckButton.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { public void onClick( com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) { if (connectionForm.validate()) { new CheckSSHConnectionCallback() { @Override protected void doActualWork() { agentStatusCheck(); } }.execute(); } } }); if (initialAgentInstall != null) { host.setValue(initialAgentInstall.getSshHost()); if (initialAgentInstall.getSshPort() != null) { port.setValue(String.valueOf(initialAgentInstall.getSshPort())); } username.setValue(initialAgentInstall.getSshUsername()); password.setValue(initialAgentInstall.getSshPassword()); agentInstallPath.setValue(initialAgentInstall.getInstallLocation()); // if it was already saved, assume they want it to stay remembered // however, because the uninstall page is getting rid of the agent, we don't need or want to // remember the credentials anymore if (!this.showUninstallButton) { rememberMeCheckbox.setValue(initialAgentInstall.getSshPassword() != null); } } // disable some form elements if we don't want the user changing them - they should have been // filled in by who ever created this view if (this.showUninstallButton || this.showStartButton || this.showStopButton) { host.setDisabled(true); port.setDisabled(true); agentInstallPath.setDisabled(true); findAgentInstallPathButton.setDisabled(true); } if (this.showUninstallButton) { // don't show rememberMe checkbox - we're getting rid of this agent so there won't be a record // to store the creds connectionForm.setFields( host, port, username, password, agentInstallPath, findAgentInstallPathButton, agentStatusText, statusCheckButton); } else { connectionForm.setFields( host, port, username, password, rememberMeCheckbox, agentInstallPath, findAgentInstallPathButton, agentStatusText, statusCheckButton); } return connectionForm; }
public CurrencyViewImpl() { Element eBasePrefix = DOM.getElementById("baseCurrencyPrefix"); if (eBasePrefix == null) { throw new IllegalStateException("Base Currency Prefix div not found in hosted page"); } baseCurrencyPrefix = eBasePrefix.getInnerText(); Element eDocPrefix = DOM.getElementById("docCurrencyPrefix"); if (eDocPrefix == null) { throw new IllegalStateException("Doc Currency Prefix div not found in hosted page"); } docCurrencyPrefix = eDocPrefix.getInnerText(); currencyGrid = new ListGrid(); currencyGrid.setShowAllColumns(true); currencyGrid.setCanEdit(true); currencyGrid.setAutoFetchData(true); currencyGrid.setWidth100(); currencyGrid.setHeight100(); currencyGrid.setShowAllColumns(true); currencyGrid.setSelectionType(SelectionStyle.SINGLE); currencyGrid.setDataSource(CurrencyDataSource.getInstance()); currencyGrid.setSortDirection(SortDirection.DESCENDING); currencyGrid.setSortField("dt"); currencyGrid.setShowHeaderContextMenu(false); currencyGrid.setCanAutoFitFields(false); addRowButton = new IButton(constants.add()); addRowButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { // Boolean isWindowInput = (Boolean)isWindowInputItem.getValue(); // currencyGrid.startEditingNew(); // currencyGrid.endEditing(); Record firstRecord = currencyGrid.getRecordList().first(); Record lastRecord = currencyGrid.getRecordList().last(); Date firstDate = firstRecord.getAttributeAsDate("dt"); Date lastDate = lastRecord.getAttributeAsDate("dt"); Date nowDate = new Date(); DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd.MM.yyyy"); String firstDateStr = dateFormatter.format(firstDate); String lastDateStr = dateFormatter.format(lastDate); String nowDateStr = dateFormatter.format(nowDate); if (nowDateStr.equals(firstDateStr) || nowDateStr.equals(lastDateStr)) { SC.say(constants.warningCurrencyAlreadySet()); } else { CurrencyRecord currencyRecord = new CurrencyRecord(); currencyRecord.setDt(new Date()); currencyRecord.setAttribute( CurrencyRecord.IDENTITY_CURRENCY + baseCurrencyPrefix, 1.0); currencyRecord.setAttribute( CurrencyRecord.IDENTITY_CURRENCY + docCurrencyPrefix, 1.0); currencyGrid.startEditingNew(currencyRecord); } } }); editRowButton = new IButton(constants.editCurrency()); editRowButton.setAutoFit(true); editRowButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.goTo(new CurrencyTypePlace("")); } }); currencyGrid.addCellDoubleClickHandler( new CellDoubleClickHandler() { @Override public void onCellDoubleClick(CellDoubleClickEvent event) { if (currencyGrid.getFieldNum("remove") == event.getColNum()) { final ListGridRecord record = currencyGrid.getRecord(event.getRowNum()); if (record != null) { SC.ask( constants.askRemoveRecord(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { currencyGrid.removeData(record); } } }); } } else { Boolean isWindowInput = (Boolean) isWindowInputItem.getValue(); if (isWindowInput) { String fieldName = currencyGrid.getFieldName(event.getColNum()); Double exchange = null; try { exchange = Double.parseDouble(event.getRecord().getAttribute(fieldName)); } catch (Exception ex) { } if (fieldName != null && exchange != null && fieldName.startsWith(CurrencyRecord.IDENTITY_CURRENCY)) { String name = fieldName.substring(1); Currency currency = new Currency(name, exchange); showCurrencyForm(event.getRowNum(), event.getColNum(), currency); } } } } }); currencyGrid.addCellClickHandler( new CellClickHandler() { @Override public void onCellClick(CellClickEvent event) { if (currencyGrid.getFieldNum("remove") == event.getColNum()) { final ListGridRecord record = currencyGrid.getRecord(event.getRowNum()); if (record != null) { SC.ask( constants.askRemoveRecord(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { currencyGrid.removeData(record); } } }); } } else { Boolean isWindowInput = (Boolean) isWindowInputItem.getValue(); if (isWindowInput) event.cancel(); } } }); DynamicForm form = new DynamicForm(); isWindowInputItem = new CheckboxItem("output", constants.windowsInput()); isWindowInputItem.setDefaultValue(false); isWindowInputItem.setAlign(Alignment.RIGHT); form.setItems(isWindowInputItem); form.setWidth("*"); HLayout controlLayout = new HLayout(); controlLayout.setMembers(addRowButton, editRowButton, form); addMember(currencyGrid); addMember(controlLayout); }
private void refresh() { form.clearValues(); form.clearErrors(false); if (form != null) form.destroy(); if (formsContainer.contains(form)) formsContainer.removeChild(form); form = new DynamicForm(); form.setNumCols(2); form.setTitleOrientation(TitleOrientation.TOP); TextItem include = ItemFactory.newTextItem("include", "include", account.getIncludes()); include.addChangedHandler(changedHandler); TextItem exclude = ItemFactory.newTextItem("exclude", "exclude", account.getExcludes()); exclude.addChangedHandler(changedHandler); TextItem folder = ItemFactory.newTextItem("mailfolder", "mailfolder", account.getMailFolder()); folder.addChangedHandler(changedHandler); SelectItem format = ItemFactory.newSelectItem("format", "format"); LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); map.put("0", I18N.message("multiplefiles")); map.put("1", I18N.message("singleeml")); format.setValueMap(map); format.addChangedHandler(changedHandler); format.setValue(Integer.toString(account.getFormat())); CheckboxItem deleteFomMailbox = new CheckboxItem(); deleteFomMailbox.setName("delete"); deleteFomMailbox.setTitle(I18N.message("deletefrommailbox")); deleteFomMailbox.setRedrawOnChange(true); deleteFomMailbox.setWidth(50); deleteFomMailbox.addChangedHandler(changedHandler); deleteFomMailbox.setValue(account.isDeleteFromMailbox()); final DateItem startDate = ItemFactory.newDateItem("startdate", "earliestdate"); startDate.addChangedHandler(changedHandler); startDate.setValue(account.getStartDate()); startDate.setUseMask(false); startDate.setShowPickerIcon(true); startDate.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE); startDate.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if ("backspace".equals(event.getKeyName().toLowerCase()) || "delete".equals(event.getKeyName().toLowerCase())) { startDate.clearValue(); startDate.setValue((Date) null); changedHandler.onChanged(null); } else { changedHandler.onChanged(null); } } }); form.setItems(folder, format, include, exclude, startDate, deleteFomMailbox); formsContainer.addMember(form); }
@Override public void refresh(TaskDto task) { super.refresh(task); reportValues.setValue(task.getVariables().get(KtunaxaBpmConstant.VAR_REPORT_VALUES)); }