@Override public Object getPropertyValue(Object id) { JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue(); CVDesignComponent cvComp = (CVDesignComponent) jrElement.getComponent(); if (CVDesignComponent.PROPERTY_EVALUATION_TIME.equals(id)) { return evaluationTimeD.getEnumValue(cvComp.getEvaluationTime()); } else if (CVDesignComponent.PROPERTY_EVALUATION_GROUP.equals(id)) { return cvComp.getEvaluationGroup(); } else if (CVDesignComponent.PROPERTY_PROCESSING_CLASS.equals(id)) { return cvComp.getProcessingClass(); } else if (CVDesignComponent.PROPERTY_ITEM_PROPERTIES.equals(id)){ return JRCloneUtils.cloneList(cvComp.getItemProperties()); } else if (CVDesignComponent.PROPERTY_ITEM_DATA.equals(id)) { return JRCloneUtils.cloneList(cvComp.getItemData()); } if (id.equals(CVDesignComponent.PROPERTY_ON_ERROR_TYPE)) { return onErrorTypeD.getEnumValue(cvComp.getOnErrorType()); } else { return super.getPropertyValue(id); } }
public int showDialog() { if(!ExpressionEditorSupportUtil.isExpressionEditorDialogOpen()) { JRExpressionEditor wizard = new JRExpressionEditor(); wizard.setValue(JRCloneUtils.nullSafeClone(originalExpression)); ExpressionContext ec = ModelUtils.getElementExpressionContext((JRDesignTextField) textField.getValue(), textField); wizard.setExpressionContext(ec); WizardDialog dialog = ExpressionEditorSupportUtil.getExpressionEditorWizardDialog(UIUtils.getShell(), wizard); if (dialog.open() == Dialog.OK) { isExpressionChanged = true; newExpression=wizard.getValue(); return Window.OK; } } isExpressionChanged=false; return Window.CANCEL; }
private void addSearchAttributes(JRStyledText styledText, JRPrintText textElement) { ReportContext reportContext = getReportContext(); if (reportContext != null) { SpansInfo spansInfo = (SpansInfo) reportContext.getParameterValue("net.sf.jasperreports.search.term.highlighter"); PrintElementId pei = PrintElementId.forElement(textElement); if (spansInfo != null && spansInfo.hasHitTermsInfo(pei.toString())) { List<HitTermInfo> hitTermInfos = JRCloneUtils.cloneList(spansInfo.getHitTermsInfo(pei.toString())); short[] lineBreakOffsets = textElement.getLineBreakOffsets(); if (lineBreakOffsets != null && lineBreakOffsets.length > 0) { int sz = lineBreakOffsets.length; for (HitTermInfo ti: hitTermInfos) { for (int i = 0; i < sz; i++) { if (lineBreakOffsets[i] <= ti.getStart()) { ti.setStart(ti.getStart() + 1); ti.setEnd(ti.getEnd() + 1); } else { break; } } } } AttributedString attributedString = styledText.getAttributedString(); for (int i = 0, ln = hitTermInfos.size(); i < ln; i = i + spansInfo.getTermsPerQuery()) { attributedString.addAttribute(JRTextAttribute.SEARCH_HIGHLIGHT, Color.yellow, hitTermInfos.get(i).getStart(), hitTermInfos.get(i + spansInfo.getTermsPerQuery() - 1).getEnd()); } } } else { if (log.isDebugEnabled()) { log.debug("No ReportContext to hold search data!"); } } }
private void modifySelectedElement(MapDataElementDTO selectedElement) { ItemProperty clonedElementName = JRCloneUtils.nullSafeClone(selectedElement.getName()); if(clonedElementName==null){ clonedElementName = new StandardItemProperty("name","",null); //$NON-NLS-1$ //$NON-NLS-2$ } MapElementDialog dialog = new MapElementDialog(UIUtils.getShell(), clonedElementName, widgetConfig); dialog.setExpressionContext(getDefaultExpressionContext()); if(dialog.open()==Window.OK) { selectedElement.setName(dialog.getElementName()); firePropertyChanged(LAST_OPERATION.EDIT); } }
@Override public Object getPropertyValue(Object id) { JRDesignSubreport jrElement = (JRDesignSubreport) getValue(); if (id.equals(JRBaseSubreport.PROPERTY_RUN_TO_BOTTOM)) return jrElement.isRunToBottom(); if (id.equals(JRBaseSubreport.PROPERTY_USING_CACHE)) return jrElement.getUsingCache(); if (id.equals(JRDesignSubreport.PROPERTY_EXPRESSION)) return ExprUtil.getExpression(jrElement.getExpression()); if (id.equals(JRDesignSubreport.PROPERTY_PARAMETERS_MAP_EXPRESSION)) return ExprUtil.getExpression(jrElement.getParametersMapExpression()); if (id.equals(JRDesignSubreport.PROPERTY_CONNECTION_EXPRESSION)) return ExprUtil.getExpression(jrElement.getConnectionExpression()); if (id.equals(JRDesignSubreport.PROPERTY_DATASOURCE_EXPRESSION)) return ExprUtil.getExpression(jrElement.getDataSourceExpression()); if (id.equals(JRDesignSubreport.PROPERTY_PARAMETERS)) return JRCloneUtils.cloneArray(jrElement.getParameters()); if (id.equals(JRDesignSubreport.PROPERTY_RETURN_VALUES)) { if (returnValuesDTO == null) { returnValuesDTO = new JReportsDTO(); returnValuesDTO.setjConfig(getJasperConfiguration()); returnValuesDTO.setProp1(jrElement); } returnValuesDTO.setValue(JRCloneUtils.cloneList(jrElement.getReturnValuesList())); return returnValuesDTO; } return super.getPropertyValue(id); }
public void setTextAttributes(TextDataSourceAttributes attributes) { this.textAttributes = JRCloneUtils.nullSafeClone(attributes); }