private void setGridActions() { java.util.List actions = grid.getActions(); actions.add( 0, new GridAction( "reportAction", props.getProperty("reportAction.name"), WorkflowUiUtils.REPORT_ICON) { public void execute(ActionEvent e) { reportActionPerformed(); } }); actions.add( 1, new GridAction( "showInfoAction", props.getProperty("showInfoAction.name"), WorkflowUiUtils.PREVIEW_ICON) { public void execute(ActionEvent e) { showInfoActionPerformed(); } }); actions.add( 2, new GridAction( "printAction", props.getProperty("printAction.name"), WorkflowUiUtils.PRINT_ICON) { public void execute(ActionEvent e) { printActionPerformed(); } }); actions.add( 3, new GridAction( "clearAction", props.getProperty("clearAction.name"), WorkflowUiUtils.CLEAR_ICON) { public void execute(ActionEvent e) { clearActionPerformed(); } }); actions.add( 4, new GridAction( "helpAction", props.getProperty("helpAction.name"), WorkflowUiUtils.HELP_ICON) { public void execute(ActionEvent e) { try { Main.getHelpSystem().showHelp(className); } catch (HelpException e1) { e1.printStackTrace(); } } }); grid.setActions(actions); }
/** <code>print()</code> defines for showing print or print preview of results. */ private void printActionPerformed() { Hashtable parameters = new Hashtable(); parameters.put(props.getProperty("printHeader.name"), radioValue); if (StringUtils.isNotEmpty(previewHeaderText)) parameters.put(props.getProperty("header1.name"), previewHeaderText); ReportData reportData = new ReportData(grid, new HashMap(), grid.getLocale()); java.util.List itemList = new ArrayList(); itemList = grid.getDataModel().getData().getDataList(); reportData.setTitle(getTitle()); reportData.setConditionMap(parameters); reportData.setSelectedRows(itemList); PrintSetupScreen.showPrintSetupScreen(this.getSubsystemApp(), screenLocale, reportData); }
private void showInfoActionPerformed() { java.util.List itemList = grid.getCheckedRows(); if (itemList.size() > 0) { ViewRecordScreen screen = new ViewRecordScreen(getSubsystemApp()); List selectedRows = new ArrayList(); for (int i = 0; i < itemList.size(); i++) { CopyRightReportRowData data = (CopyRightReportRowData) itemList.get(i); TempCopyrightRecord copyrightRecord = (TempCopyrightRecord) data.getEntity(); selectedRows.add(copyrightRecord); } screen.setData(selectedRows); screen.showModal(); } else { MessagePanes.showWarningDialog( this, props.getProperty(StandardActionNames.SELECT_ONE_ROW), local); } }
/** <code>clearActionPerformed()</code> defines for reseting all components. */ private void clearActionPerformed() { txfTitle.setText(""); txfNumber.setText(""); txfFromDate.setDate(null); txfToDate.setDate(null); txfUserName.setText(""); rdoCopyrightReq.setSelected(true); rdoNoAnswerReq.setSelected(true); rdoHasNumber.setSelected(true); chkAnswerDate.setSelected(false); chkRequestDate.setSelected(false); chkSetNumberDate.setSelected(false); txfFromDate.setEnabled(false); txfToDate.setEnabled(false); cmbDocType.setEnabled(false); userId = 0; dataFetcher.setReportObject(null); grid.refresh(); }
/** * <code>reportActionPerformed()</code> defiens for searching copyrights in DB according to search * keys. */ private void reportActionPerformed() { filterObject = new TempRequestReport(); int counter = 0; previewHeaderText = new String(); radioValue = new String(); if (!txfTitle.getText().equals("")) filterObject.setTitle((txfTitle.getText().toUpperCase().trim())); if (!txfNumber.getText().equals("")) filterObject.setNumber(StringUtils.arabicToLatinDigit(txfNumber.getText()).trim()); if (rdoAnswerReq.isSelected()) { filterObject.setIsAnswered(WorkflowConstants.IS_ANSWERED_REQUEST); radioValue = props.getProperty("print_answered_req.name"); } else if (rdoNoAnswerReq.isSelected()) { filterObject.setIsAnswered(WorkflowConstants.IS_NOT_ANSWERED_REQUEST); radioValue = props.getProperty("print_no_answered_req.name"); } if (rdoHasNumber.isSelected()) { filterObject.setHasNumber(WorkflowConstants.HAS_NUMBER); radioValue += " " + props.getProperty("print_has_number_req.name"); } else if (rdoNoNumber.isSelected()) { filterObject.setHasNumber(WorkflowConstants.NO_NUMBER); radioValue += " " + props.getProperty("print_no_number_req.name"); } if (txfUserName.getText() != null && txfUserName.getText() != "" && txfUserName.getText().length() != 0) filterObject.setUserId(userId); if (rdoCopyrightReq.isSelected()) { filterObject.setType(WorkflowConstants.COPY_RIGHT_BOOK_TYPE); filterObject.setDocType(""); radioValue += " " + props.getProperty("print_copy_right_req.name"); } else if (rdoDepositReq.isSelected()) { filterObject.setType(WorkflowConstants.COPY_RIGHT_NON_BOOK_TYPE); if (cmbDocType.getSelectedIndex() != 0) { filterObject.setDocType(((ConstantTableItem) cmbDocType.getSelected()).getCode()); } else filterObject.setDocType(""); radioValue += " " + props.getProperty("print_deposit_req.name"); } if (chkAnswerDate.isSelected()) { filterObject.setAnswerDate(WorkflowConstants.SELECTED); previewHeaderText = props.getProperty("answer_date.name"); counter++; } if (chkRequestDate.isSelected()) { filterObject.setRequestDate(WorkflowConstants.SELECTED); if (counter > 0) previewHeaderText += " " + '\u060c' + " " + props.getProperty("request_date.name"); else previewHeaderText += " " + props.getProperty("request_date.name"); counter++; } if (chkSetNumberDate.isSelected()) { filterObject.setSetNumberDate(WorkflowConstants.SELECTED); if (counter > 0) previewHeaderText += " " + '\u060c' + " " + props.getProperty("set_number_date.name"); else previewHeaderText += " " + props.getProperty("set_number_date.name"); } if (txfFromDate.getDate() != null && txfToDate.getDate() != null) { if (txfFromDate.getDate().getTime() > txfToDate.getDate().getTime()) { MessagePanes.showErrorDialog( this, props.getProperty("from_date_larger.name"), LocaleUtils.PERSIAN); return; } } if (txfFromDate.getDate() != null) { filterObject.setFromDate(txfFromDate.getDate()); if (!previewHeaderText.equals("")) previewHeaderText += " " + props.getProperty("from_date.name") + " " + StringUtils.RTL_MARK + txfFromDate.getDate(); } if (txfToDate.getDate() != null) { filterObject.setToDate(txfToDate.getDate()); if (!previewHeaderText.equals("")) previewHeaderText += " " + props.getProperty("to_date.name") + " " + StringUtils.RTL_MARK + txfToDate.getDate(); } if (txfToDate.getDate() == null && txfFromDate.getDate() == null) previewHeaderText = new String(); dataFetcher.setReportObject(filterObject); grid.refresh(); if (grid.getDataModel().getData().getDataList() == null || grid.getDataModel().getData().getDataList().size() == 0) MessagePanes.showInfoDialog(this, props.getProperty("empty_list.name"), LocaleUtils.PERSIAN); }