public void verifyElementDataset(JRElementDataset dataset) { JRDatasetRun datasetRun = dataset.getDatasetRun(); if (datasetRun != null) { IncrementTypeEnum incrementType = dataset.getIncrementTypeValue(); if (incrementType == IncrementTypeEnum.PAGE || incrementType == IncrementTypeEnum.COLUMN) { addBrokenRule("Chart datasets with dataset run cannont have Column or Page increment type.", dataset); } ResetTypeEnum resetType = dataset.getResetTypeValue(); if (resetType == ResetTypeEnum.PAGE || resetType == ResetTypeEnum.COLUMN) { addBrokenRule("Chart datasets with dataset run cannont have Column or Page reset type.", dataset); } // else if (resetType != ResetTypeEnum.REPORT) // { // //doesn't make sense, but let it go // } verifyDatasetRun(datasetRun); } }
/** * */ protected JRFillElementDataset( JRElementDataset dataset, JRFillObjectFactory factory ) { factory.put(dataset, this); parent = dataset; filler = factory.getFiller();//FIXMEBOOK resetGroup = factory.getGroup(dataset.getResetGroup()); incrementGroup = factory.getGroup(dataset.getIncrementGroup()); datasetRun = factory.getDatasetRun(dataset.getDatasetRun()); }
private void writeItemDataContent(String name, ItemData itemData, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException { writer.startElement(name, namespace); JRElementDataset dataset = itemData.getDataset(); if (dataset != null) { reportWriter.writeElementDataset(dataset, false); } /* */ List<Item> itemList = itemData.getItems(); if (itemList != null && !itemList.isEmpty()) { for(Item item : itemList) { if(item.getProperties() != null && !item.getProperties().isEmpty()) { writeItem(item, writer, reportWriter, namespace, componentElement); } } } }
private void editDatasetBtnPressed() { Object firstElement = ((IStructuredSelection)datasetsTV.getSelection()).getFirstElement(); if(firstElement instanceof MapDataDatasetDTO) { Object dsClone = ((MapDataDatasetDTO) firstElement).getDataset().clone(); ElementDatasetDialog elementDatasetDialog = new ElementDatasetDialog( UIUtils.getShell(), Messages.SPMapDataElementsList_EditDatasetDialogTitle, NLS.bind(Messages.SPMapDataElementsList_EditDatasetDialogInfoMsg,widgetConfig.getElementTxt()), (JRElementDataset)dsClone,jConfig); elementDatasetDialog.setDefaultExpressionContext(getDefaultExpressionContext()); if(elementDatasetDialog.open()==Window.OK){ JRElementDataset modifiedDataset = elementDatasetDialog.getDataset(); ((MapDataDatasetDTO)firstElement).setDataset(modifiedDataset); refreshDatasetsTableViewer(); } } }
/** * */ protected JRBaseElementDataset(JRElementDataset dataset) { if (dataset != null) { resetTypeValue = dataset.getResetTypeValue(); incrementTypeValue = dataset.getIncrementTypeValue(); resetGroup = dataset.getResetGroup(); incrementGroup = dataset.getIncrementGroup(); datasetRun = dataset.getDatasetRun(); incrementWhenExpression = dataset.getIncrementWhenExpression(); } }
/** * */ protected JRBaseElementDataset(JRElementDataset dataset, JRBaseObjectFactory factory) { factory.put(dataset, this); resetTypeValue = dataset.getResetTypeValue(); incrementTypeValue = dataset.getIncrementTypeValue(); resetGroup = factory.getGroup(dataset.getResetGroup()); incrementGroup = factory.getGroup(dataset.getIncrementGroup()); datasetRun = factory.getDatasetRun(dataset.getDatasetRun()); incrementWhenExpression = factory.getExpression(dataset.getIncrementWhenExpression()); }
/** * Writes the JRXML representation of an {@link JRElementDataset element dataset}. * * <p> * The method produces a <code><dataset></code> XML element. * * @param dataset the element dataset * @param defaultResetType the default dataset reset type * @param skipIfEmpty if set, no output will be produced if the element dataset * only has default attribute values * @throws IOException any I/O exception that occurred while writing the * XML output */ public void writeElementDataset(JRElementDataset dataset, ResetTypeEnum defaultResetType, boolean skipIfEmpty) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_dataset, getNamespace()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_resetType, dataset.getResetTypeValue(), defaultResetType); if (dataset.getResetTypeValue() == ResetTypeEnum.GROUP) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_resetGroup, dataset.getResetGroup().getName()); } writer.addAttribute(JRXmlConstants.ATTRIBUTE_incrementType, dataset.getIncrementTypeValue(), IncrementTypeEnum.NONE); if (dataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP) { writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_incrementGroup, dataset.getIncrementGroup().getName()); } writeExpression(JRXmlConstants.ELEMENT_incrementWhenExpression, dataset.getIncrementWhenExpression(), false); JRDatasetRun datasetRun = dataset.getDatasetRun(); if (datasetRun != null) { writeDatasetRun(datasetRun); } writer.closeElement(skipIfEmpty); }
/** * Writes the JRXML representation of an {@link JRElementDataset element dataset}. * * <p> * The method produces a <code><dataset></code> XML element. * * @param dataset the element dataset * @param skipIfEmpty if set, no output will be produced if the element dataset * only has default attribute values */ public void writeElementDataset( JRElementDataset dataset, boolean skipIfEmpty, String datasetName) { if(dataset != null) { write( datasetName + ".setResetType({0});\n", dataset.getResetTypeValue(), ResetTypeEnum.REPORT); if (dataset.getResetTypeValue() == ResetTypeEnum.GROUP) { String resetGroupName = getGroupName( dataset.getResetGroup()); write( datasetName + ".setResetGroup(" + resetGroupName + ");\n"); } write( datasetName + ".setIncrementType({0});\n", dataset.getIncrementTypeValue(), IncrementTypeEnum.NONE); if (dataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP) { String incrementGroupName = getGroupName( dataset.getIncrementGroup()); write( datasetName + ".setIncrementGroup(" + incrementGroupName + ");\n"); } writeExpression( dataset.getIncrementWhenExpression(), datasetName, "IncrementWhenExpression"); JRDatasetRun datasetRun = dataset.getDatasetRun(); if (datasetRun != null) { writeDatasetRun( datasetRun, datasetName); } flush(); } }
/** * Sets the dataset information that will be used to create the item list. * * @param dataset the dataset information * @see #getDataset() */ public void setDataset(JRElementDataset dataset) { Object old = this.dataset; this.dataset = dataset; getEventSupport().firePropertyChange(PROPERTY_DATASET, old, this.dataset); }
public static void collectExpressions(ItemData data, JRExpressionCollector collector) { if (data != null) { JRExpressionCollector datasetCollector = collector; JRElementDataset dataset = data.getDataset(); JRDatasetRun datasetRun = dataset == null ? null : dataset.getDatasetRun(); if (datasetRun != null) { collector.collect(datasetRun); datasetCollector = collector.getDatasetCollector(datasetRun.getDatasetName()); } List<Item> items = data.getItems(); if (items != null && !items.isEmpty()) { for(Item item : items) { List<ItemProperty> itemProperties = item.getProperties(); if(itemProperties != null) { for(ItemProperty property : itemProperties) { datasetCollector.addExpression(property.getValueExpression()); } } } } } }
public ElementDatasetDialog( Shell parentShell,String title, String message, JRElementDataset dataset, JasperReportsConfiguration jConfig) { super(parentShell); this.title = title; this.message = message; this.dataset = (JRDesignElementDataset) dataset; if(this.dataset==null){ this.dataset = new JRDesignElementDataset(); } this.jConfig = jConfig; }
private void addNewDatasetBtnPressed() { ElementDatasetDialog elementDatasetDialog = new ElementDatasetDialog( UIUtils.getShell(), Messages.SPMapDataElementsList_AddDatasetDialogTitle, NLS.bind(Messages.SPMapDataElementsList_AddDatasetDialogInfoMsg,widgetConfig.getElementTxt()), null,jConfig); elementDatasetDialog.setDefaultExpressionContext(getDefaultExpressionContext()); if(elementDatasetDialog.open()==Window.OK){ JRElementDataset newDataset = elementDatasetDialog.getDataset(); MapDataDatasetDTO dto = new MapDataDatasetDTO(); dto.setDataset(newDataset); mapElementsConfig.getDatasets().add(dto); refreshDatasetsTableViewer(); } }
public static MapDataElementsConfiguration convertFromElementDataInformation(List<ItemData> elementDataElements, String elementLabel){ MapDataElementsConfiguration config = new MapDataElementsConfiguration(elementLabel); List<MapDataDatasetDTO> datasetDTOs=new ArrayList<MapDataDatasetDTO>(); List<MapDataElementDTO> elementsDTOs = new ArrayList<MapDataElementDTO>(); int datasetsCounter = 1; for (ItemData elementData : elementDataElements){ // Configure Dataset JRElementDataset dataset = elementData.getDataset(); String dsNameForDTO = null; if(dataset!=null) { Object dsClone = dataset.clone(); MapDataDatasetDTO dsDTO = new MapDataDatasetDTO(); dsDTO.setDataset((JRElementDataset) dsClone); dsNameForDTO = NLS.bind(ELEMENT_DATASET_PREFIX,elementLabel) + datasetsCounter; dsDTO.setName(dsNameForDTO); datasetDTOs.add(dsDTO); datasetsCounter++; } // Extract items DTO for(Item elementItem : elementData.getItems()) { ItemProperty elementName = getElementNameForItem(elementItem); MapDataElementItemDTO itemDTO = new MapDataElementItemDTO(elementName); itemDTO.setDatasetName(dsNameForDTO); itemDTO.setItem((Item) elementItem.clone()); itemDTO.setStatic(dataset == null); createOrUpdateElementsList(elementsDTOs, elementName, itemDTO); } } config.setDatasets(datasetDTOs); config.setElements(elementsDTOs); return config; }
private static MapDataDatasetDTO createOrUpdateElementDataList( MapDataElementItemDTO item, List<ItemData> itemDatas, List<MapDataDatasetDTO> datasetDTOs) { String datasetName = item.getDatasetName(); JRElementDataset ds = null; MapDataDatasetDTO usedDSDTO = null; if(datasetName != null) { for(MapDataDatasetDTO d : datasetDTOs) { if(d.getName().equals(datasetName)) ds = d.getDataset(); usedDSDTO = d; break; } } // find the correct itemdata ItemData foundItemData = null; for(ItemData itemData : itemDatas) { JRElementDataset currDS = itemData.getDataset(); if((ds!=null && ds.equals(currDS)) || (ds == null && currDS == null)) { foundItemData = itemData; } } if(foundItemData!=null) { ((StandardItemData)foundItemData).addItem(item.getItem()); } else { // create StandardItemData newItemData = new StandardItemData(); newItemData.setDataset(ds); newItemData.addItem(item.getItem()); itemDatas.add(newItemData); } return usedDSDTO; }
/** * Returns the dataset tied to a dataset run of a crosstab, or the main jd dataset * if the crosstab dataset and/or the dataset run are null. * * @param element * @param jd * @return crosstab's JRDesignDataset */ public static JRDesignDataset getCrosstabDataset(JRDesignCrosstab element, JasperDesign jd) { JRElementDataset elementDataset = element.getDataset(); if (elementDataset != null && elementDataset.getDatasetRun() != null) { // Get the dataset name... String datasetName = elementDataset.getDatasetRun().getDatasetName(); return (JRDesignDataset)jd.getDatasetMap().get(datasetName); } return (JRDesignDataset)jd.getMainDataset(); }
/** * */ public Set<JRElementDataset> getGroupBoundDatasets() { return groupBoundDatasets; }
/** * */ public JRDesignElementDataset(JRElementDataset dataset) { super(dataset); }
/** * */ public JRDesignElementDataset(JRElementDataset dataset, JRBaseObjectFactory factory) { super(dataset, factory); }
@Override public JRElementDataset getDataset() { return dataset; }
/** * */ public JRElementDataset getDataset() { return itemData.getDataset(); }
public JRElementDataset getDataset(){ return dataset; }
public JRElementDataset getDataset() { return dataset; }
public void setDataset(JRElementDataset dataset) { this.dataset = dataset; }
public JRElementDataset getJRElementDataset() { return componentElementDataset; }
public MElementDataset(JRElementDataset value, JasperDesign jasperDesign) { super(); setValue(value); this.jasperDesign = jasperDesign; }
public MElementDataset(ANode parent, JRElementDataset value, JasperDesign jasperDesign) { super(parent, -1); setValue(value); this.jasperDesign = jasperDesign; }
public GeoMapFillDataset(JRElementDataset dataset, JRFillObjectFactory factory) { super(dataset, factory); }
/** * Writes the JRXML representation of an {@link JRElementDataset element dataset}. * * <p> * The method produces a <code><dataset></code> XML element. * * @param dataset the element dataset * @throws IOException any I/O exception that occurred while writing the * XML output */ public void writeElementDataset(JRElementDataset dataset) throws IOException { writeElementDataset(dataset, ResetTypeEnum.REPORT, true); }
/** * Writes the JRXML representation of an {@link JRElementDataset element dataset}. * * <p> * The method produces a <code><dataset></code> XML element. * * @param dataset the element dataset * @param skipIfEmpty if set, no output will be produced if the element dataset * only has default attribute values * @throws IOException any I/O exception that occurred while writing the * XML output */ public void writeElementDataset(JRElementDataset dataset, boolean skipIfEmpty) throws IOException { writeElementDataset(dataset, ResetTypeEnum.REPORT, skipIfEmpty); }
/** * Writes the JRXML representation of an {@link JRElementDataset element dataset}. * * <p> * The method produces a <code><dataset></code> XML element. * * @param dataset the element dataset */ public void writeElementDataset( JRElementDataset dataset, String datasetName) { writeElementDataset( dataset, true, datasetName); }
/** * Returns the dataset information that will be used by the {@link net.sf.jasperreports.components.map.ItemData ItemData} object. * <p> * This information is required either to use the main dataset or to instantiate a * subdataset from the report. The data produced by the subdataset is fed to the items list. * * @return the dataset * @see net.sf.jasperreports.engine.JRElementDataset */ public JRElementDataset getDataset();
/** * Returns the dataset information that will be used by the {@link ItemData ItemData} object. * <p> * This information is required either to use the main dataset or to instantiate a * subdataset from the report. The data produced by the subdataset is fed to the items list. * * @return the dataset * @see net.sf.jasperreports.engine.JRElementDataset */ public JRElementDataset getDataset();
/** * Returns the instance of the element dataset we are modifying. * * @return the edited dataset */ JRElementDataset getJRElementDataset();