Java 类net.sf.jasperreports.engine.util.Pair 实例源码

项目:jasperreports    文件:XYChartHyperlinkProvider.java   
@Override
public JRPrintHyperlink getEntityHyperlink(ChartEntity entity)
{
    JRPrintHyperlink printHyperlink = null;
    if (hasHyperlinks() && entity instanceof XYItemEntity)
    {
        XYItemEntity itemEntity = (XYItemEntity) entity;
        XYDataset dataset = itemEntity.getDataset();
        Comparable<?> serie = dataset.getSeriesKey(itemEntity.getSeriesIndex());
        Map<Pair, JRPrintHyperlink> serieHyperlinks = itemHyperlinks.get(serie);
        if (serieHyperlinks != null)
        {
            Number x = dataset.getX(itemEntity.getSeriesIndex(), itemEntity.getItem());
            Number y = dataset.getY(itemEntity.getSeriesIndex(), itemEntity.getItem());
            Pair<Number,Number> xyKey = new Pair<Number,Number>(x, y);
            printHyperlink = serieHyperlinks.get(xyKey);
        }
    }
    return printHyperlink;
}
项目:jasperreports    文件:JRAbstractExporter.java   
protected Locale getTextLocale(JRPrintText text)
{
    String localeCode = text.getLocaleCode();
    if (localeCode == null)
    {
        localeCode = jasperPrint.getLocaleCode();
    }

    if (localeCode == null)
    {
        return null;
    }

    Pair<String, Locale> last = lastTextLocale;
    if (last != null && last.first().equals(localeCode))
    {
        return last.second();
    }

    Locale locale = JRDataUtils.getLocale(localeCode);
    lastTextLocale = new Pair<String, Locale>(localeCode, locale);
    return locale;
}
项目:jasperreports    文件:ParameterTypeSelectorClauseFunction.java   
protected Object parameterTypesFunctionCacheKey(JRClauseTokens clauseTokens, JRQueryClauseContext queryContext, 
        List<Class<?>> parameterTypes)
{
    Object typesKey;
    int size = parameterTypes.size();
    if (size == 1)
    {
        // use the single type as direct key
        typesKey = parameterTypes.get(0);
    }
    else if (size == 2)
    {
        // use a pair of the two types
        typesKey = new Pair<Class<?>, Class<?>>(parameterTypes.get(0), parameterTypes.get(1));
    }
    else
    {
        // use the list itself as key
        typesKey = parameterTypes;
    }

    Pair<String, String> clauseKey = new Pair<String, String>(
            queryContext.getCanonicalQueryLanguage(), clauseTokens.getClauseId());
    return new Pair<Pair<String, String>, Object>(clauseKey, typesKey);
}
项目:jasperreports    文件:ParameterTypeSelectorClauseFunction.java   
protected JRClauseFunction selectFromCandidates(List<Pair<List<Class<?>>, JRClauseFunction>> candidateFunctions)
{
    if (candidateFunctions.isEmpty())
    {
        return null;
    }

    if (candidateFunctions.size() == 1)
    {
        // only one candidate, return it
        return candidateFunctions.get(0).second();
    }

    // sort the candidates based on type specificity
    Collections.sort(candidateFunctions, TypesCandidateComparator.INSTANCE);
    // and return the first (which is actually the most specific or one of the most specific)
    JRClauseFunction function = candidateFunctions.get(0).second();
    if (log.isDebugEnabled())
    {
        log.debug("selected function " + function);
    }
    return function;
}
项目:jasperreports    文件:JRGridLayout.java   
protected EmptyGridCell emptyCell(GridCellSize size, GridCellStyle style)
{
    Pair<GridCellSize, GridCellStyle> key = new Pair<GridCellSize, GridCellStyle>(size, style);
    EmptyGridCell cell = emptyCells.get(key);
    if (cell == null)
    {
        cell = new EmptyGridCell(size, style);
        emptyCells.put(key, cell);

        if (log.isDebugEnabled())
        {
            log.debug(this + " created empty cell for " + size + " and " + style);
        }
    }
    return cell;
}
项目:jasperreports    文件:SimpleTextLineWrapper.java   
protected HashMap<Pair<UUID, FontKey>, ElementFontInfo> createElementFontInfosFillCache()
{
    final int cacheSize = JRPropertiesUtil.getInstance(context.getJasperReportsContext()).getIntegerProperty(
            PROPERTY_ELEMENT_CACHE_SIZE, 2000);//hardcoded default
    if (log.isDebugEnabled())
    {
        log.debug("creating element font infos cache of size " + cacheSize);
    }

    // creating a LRU map
    return new LinkedHashMap<Pair<UUID,FontKey>, SimpleTextLineWrapper.ElementFontInfo>(64, 0.75f, true)
    {
        @Override
        protected boolean removeEldestEntry(Entry<Pair<UUID, FontKey>, ElementFontInfo> eldest)
        {
            return size() > cacheSize;
        }
    };
}
项目:jasperreports    文件:JRFillContext.java   
public void setReportContext(ReportContext reportContext)
{
    this.reportContext = reportContext;

    this.cacheHandler = (DataCacheHandler) getContextParameterValue(
            DataCacheHandler.PARAMETER_DATA_CACHE_HANDLER);
    if (cacheHandler != null)
    {
        if (cacheHandler.isSnapshotPopulated())
        {
            dataSnapshot = cacheHandler.getDataSnapshot();
        }
        else if (cacheHandler.isRecordingEnabled())
        {
            dataRecorder = cacheHandler.createDataRecorder();
            recordedData = new ArrayList<Pair<FillDatasetPosition,Object>>();
        }
    }
}
项目:jasperreports    文件:JRDesignCrosstab.java   
/**
 * Creates a new crosstab.
 * 
 * @param defaultStyleProvider default style provider
 */
public JRDesignCrosstab(JRDefaultStyleProvider defaultStyleProvider)
{
    super(defaultStyleProvider);

    parametersList = new ArrayList<JRCrosstabParameter>();
    parametersMap = new HashMap<String, JRCrosstabParameter>();
    rowGroupsMap = new HashMap<String, Integer>();
    rowGroups = new ArrayList<JRCrosstabRowGroup>();
    columnGroupsMap = new HashMap<String, Integer>();
    columnGroups = new ArrayList<JRCrosstabColumnGroup>();
    measuresMap = new HashMap<String, Integer>();
    measures = new ArrayList<JRCrosstabMeasure>();

    cellsMap = new HashMap<Pair<String,String>,JRCrosstabCell>();
    cellsList = new ArrayList<JRCrosstabCell>();

    addBuiltinParameters();

    variablesList = new LinkedMap();
    addBuiltinVariables();

    dataset = new JRDesignCrosstabDataset();
    lineBox = new JRBaseLineBox(this);
}
项目:jasperreports    文件:ColumnFormatting.java   
public static void store(ReportContext reportContext, String tableUUID, int columnIndex, 
        Locale locale, TimeZone timeZone)
{
    // storing locale and timezone per column to be used in ConditionalFormattingAction.
    // we need to do that because, unlike for filters, conditional formatting action json does not contain the locale and timezone.
    //FIXME for now this is never cleared, we need to find a place do do that.
    Map<Pair<String, Integer>, ColumnFormatting> columnFormattingMap = (Map<Pair<String, Integer>, ColumnFormatting>) 
            reportContext.getParameterValue(CONTEXT_PARAMETER_COLUMN_FORMATTING);
    if (columnFormattingMap == null)
    {
        //FIXME concurrency?
        columnFormattingMap = new ConcurrentHashMap<Pair<String,Integer>, ColumnFormatting>();
        reportContext.setParameterValue(CONTEXT_PARAMETER_COLUMN_FORMATTING, columnFormattingMap);
    }

    ColumnFormatting columnFormatting = new ColumnFormatting(
            JRDataUtils.getLocaleCode(locale), JRDataUtils.getTimeZoneId(timeZone));
    columnFormattingMap.put(new Pair<String, Integer>(tableUUID, columnIndex), columnFormatting);
}
项目:jasperreports    文件:FillBarDataset.java   
protected void customIncrement()
{
    for (Iterator<FillBarSeries> it = seriesList.iterator(); it.hasNext();)
    {
        FillBarSeries series = it.next();
        String seriesKey = series.getSeriesKey();
        String category = series.getCategory();
        Number value = series.getValue();

        seriesKeys.add(seriesKey);
        categories.add(category);
        values.put(new Pair<String, String>(seriesKey, category), value);
    }
}
项目:jasperreports    文件:JRFillXyzDataset.java   
@Override
protected void customIncrement()
{
    if (xyzSeries != null && xyzSeries .length > 0)
    {
        for (int i = 0; i < xyzSeries.length; i++)
        {
            JRFillXyzSeries crtXyzSeries = xyzSeries[i];

            Comparable<?> seriesName = crtXyzSeries.getSeries();
            if (seriesName == null)
            {
                throw 
                    new JRRuntimeException(
                        EXCEPTION_MESSAGE_KEY_SERIES_NULL_NAME,  
                        (Object[])null 
                        );
            }

            dataset.addValue(
                crtXyzSeries.getSeries(), 
                crtXyzSeries.getXValue(),
                crtXyzSeries.getYValue(),
                crtXyzSeries.getZValue()
                );

            if (crtXyzSeries.hasItemHyperlinks())
            {
                Map<Pair, JRPrintHyperlink> seriesLinks = itemHyperlinks.get(crtXyzSeries.getSeries());
                if (seriesLinks == null)
                {
                    seriesLinks = new HashMap<Pair, JRPrintHyperlink>();
                    itemHyperlinks.put(crtXyzSeries.getSeries(), seriesLinks);
                }
                Pair<Number,Number> xyKey = new Pair<Number,Number>(crtXyzSeries.getXValue(), crtXyzSeries.getYValue());
                seriesLinks.put(xyKey, crtXyzSeries.getPrintItemHyperlink());
            }
        }
    }
}
项目:jasperreports    文件:VirtualElementsData.java   
public void setElementEvaluations(int fillerId, JREvaluationTime evaluationTime, Map<JRPrintElement, Integer> evaluations)
{
    if (elementEvaluations == null)
    {
        elementEvaluations = new HashMap<Pair<Integer, JREvaluationTime>, Map<JRPrintElement,Integer>>();
    }

    elementEvaluations.put(new Pair<Integer, JREvaluationTime>(fillerId, evaluationTime), evaluations);
}
项目:jasperreports    文件:ParameterTypeSelectorClauseFunction.java   
@Override
public int compare(Pair<List<Class<?>>, JRClauseFunction> o1,
        Pair<List<Class<?>>, JRClauseFunction> o2)
{
    List<Class<?>> types1 = o1.first();
    List<Class<?>> types2 = o2.first();

    // should not happen, but checking
    if (types1.size() != types2.size())
    {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_QUERY_PARAMETER_TYPE_SELECTOR_CANDIDATE_TYPE_SIZE_MISMATCH,
                new Object[]{types1.size(), types2.size()});
    }

    // perform a lexicographical comparison by comparing each type sequentially until we find a difference
    int order = 0;
    for (Iterator<Class<?>> it1 = types1.iterator(), it2 = types2.iterator(); it1.hasNext() && it2.hasNext(); )
    {
        Class<?> type1 = it1.next();
        Class<?> type2 = it2.next();
        int typesOrder = compareTypes(type1, type2);
        if (typesOrder != 0)
        {
            order = typesOrder;
            break;
        }
    }

    return order;
}
项目:jasperreports    文件:HtmlExporter.java   
@Override
public void exportReport() throws JRException
{
    /*   */
    ensureJasperReportsContext();
    ensureInput();

    rendererToImagePathMap = new HashMap<String,String>();
    imageMaps = new HashMap<Pair<String, Rectangle>,String>();
    renderersCache = new RenderersCache(getJasperReportsContext());

    fontsToProcess = new HashMap<String, HtmlFontFamily>();

    //FIXMENOW check all exporter properties that are supposed to work at report level

    initExport();

    ensureOutput();

    writer = getExporterOutput().getWriter();

    try
    {
        exportReportToWriter();
    }
    catch (IOException e)
    {
        throw 
            new JRException(
                EXCEPTION_MESSAGE_KEY_OUTPUT_WRITER_ERROR,
                new Object[]{jasperPrint.getName()}, 
                e);
    }
    finally
    {
        getExporterOutput().close();
        resetExportContext();
    }
}
项目:jasperreports    文件:JRGridLayout.java   
/**
 * Constructor.
 *
 * @param elements the elements that should arranged in a grid
 * @param width the width available for the grid
 * @param height the height available for the grid
 * @param offsetX horizontal element position offset
 * @param offsetY vertical element position offset
 * @param xCuts An optional list of pre-calculated X cuts.
 */
public JRGridLayout(
    ExporterNature nature,
    List<JRPrintElement> elements,
    int width,
    int height,
    int offsetX,
    int offsetY,
    CutsInfo xCuts
    )
{
    this.nature = nature;
    this.elementList = elements;

    // TODO lucianc cache these across report pages?
    this.cellSizes = new HashMap<GridCellSize, GridCellSize>();
    this.cellStyles = new HashMap<GridCellStyle, GridCellStyle>();
    this.emptyCells = new HashMap<Pair<GridCellSize,GridCellStyle>, EmptyGridCell>();

    this.height = height;
    this.width = width;
    this.offsetX = offsetX;
    this.offsetY = offsetY;
    this.xCuts = xCuts;

    boxesCache = new HashMap<BoxKey,JRLineBox>();

    layoutGrid(null, elements);
}
项目:jasperreports    文件:Tabulator.java   
protected Pair<Column, Column> getColumnSpanRange(Table table, Column col, Row row, Cell spanned)
{
    Column startCol = col;
    for (Column headCol : table.columns.getEntries().headSet(col, false).descendingSet())
    {
        Cell headCell = row.getCell(headCol);
        if (headCell == null || !spanned.accept(spanRangeCheck, headCell))
        {
            break;
        }
        startCol = headCol;
    }

    Column endCol = null;
    for (Column tailCol : table.columns.getEntries().tailSet(col))
    {
        endCol = tailCol;
        Cell tailCell = row.getCell(tailCol);
        if (tailCell == null || !spanned.accept(spanRangeCheck, tailCell))
        {
            break;
        }
    }
    assert endCol != null;
    assert startCol.startCoord < endCol.startCoord;

    return new Pair<Column, Column>(startCol, endCol);
}
项目:jasperreports    文件:Tabulator.java   
protected Pair<Row, Row> getRowSpanRange(Table table, Column col, Row row, Cell spanned)
{
    Row startRow = row;
    for (Row headRow : table.rows.getEntries().headSet(row, false).descendingSet())
    {
        Cell headCell = headRow.getCell(col);
        if (headCell == null || !spanned.accept(spanRangeCheck, headCell))
        {
            break;
        }
        startRow = headRow;
    }

    Row endRow = null;
    for (Row tailRow : table.rows.getEntries().tailSet(row))
    {
        endRow = tailRow;
        Cell tailCell = tailRow.getCell(col);
        if (tailCell == null || !spanned.accept(spanRangeCheck, tailCell))
        {
            break;
        }
    }
    assert endRow != null;
    assert startRow.startCoord < endRow.startCoord;

    return new Pair<Row, Row>(startRow, endRow);
}
项目:jasperreports    文件:JRFillTextField.java   
/**
 *
 */
protected JRFillTextField(
    JRBaseFiller filler,
    JRTextField textField, 
    JRFillObjectFactory factory
    )
{
    super(filler, textField, factory);

    this.textTemplates = new HashMap<Pair<JRStyle,TextFormat>, JRTemplateElement>();
    evaluationGroup = factory.getGroup(textField.getEvaluationGroup());
    this.localizedProperties = new HashMap<String, String>();
}
项目:jasperreports    文件:JRFillTextField.java   
@Override
protected void registerTemplate(JRStyle style, JRTemplateElement template)
{
    Pair<JRStyle, TextFormat> key = new Pair<JRStyle, TextFormat>(style, textFormat);
    textTemplates.put(key, template);

    if (log.isDebugEnabled())
    {
        log.debug("created " + template + " for " + key);
    }
}
项目:jasperreports    文件:JRFillContext.java   
public void cacheDone()
{
    if (dataRecorder != null && dataRecorder.isEnabled())
    {
        // add all recorded data
        for (Pair<FillDatasetPosition, Object> recorededItem : recordedData)
        {
            dataRecorder.addRecordResult(recorededItem.first(), recorededItem.second());
        }

        dataRecorder.setSnapshotPopulated();
    }
}
项目:jasperreports    文件:JasperDesignCache.java   
public void setStyles(String reportURI, UUID id, List<JRStyle> styles)
{
    if (log.isDebugEnabled())
    {
        log.debug("Setting " + styles.size() + " styles for " + reportURI + " and " + id);
    }

    reportStyles.put(new Pair<String, UUID>(reportURI, id), styles);
}
项目:jasperreports    文件:JRDesignCrosstab.java   
/**
 * Removes a row group.
 * 
 * @param groupName the group name
 * @return the removed group
 */
public JRCrosstabRowGroup removeRowGroup(String groupName)
{
    JRCrosstabRowGroup removed = null;

    Integer idx = rowGroupsMap.remove(groupName);
    if (idx != null)
    {
        removed = rowGroups.remove(idx.intValue());

        for (ListIterator<JRCrosstabRowGroup> it = rowGroups.listIterator(idx.intValue()); it.hasNext();)
        {
            JRCrosstabRowGroup group = it.next();
            rowGroupsMap.put(group.getName(), Integer.valueOf(it.previousIndex()));
        }

        for (Iterator<JRCrosstabCell> it = cellsList.iterator(); it.hasNext();)
        {
            JRCrosstabCell cell = it.next();
            String rowTotalGroup = cell.getRowTotalGroup();
            if (rowTotalGroup != null && rowTotalGroup.equals(groupName))
            {
                it.remove();
                cellsMap.remove(new Pair<String,String>(rowTotalGroup, cell.getColumnTotalGroup()));
                getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_CELLS, cell, -1);
            }
        }

        removeRowGroupVars(removed);

        getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_ROW_GROUPS, removed, idx.intValue());
    }

    return removed;
}
项目:jasperreports    文件:JRDesignCrosstab.java   
/**
 * Removes a column group.
 * 
 * @param groupName the group name
 * @return the removed group
 */
public JRCrosstabColumnGroup removeColumnGroup(String groupName)
{
    JRCrosstabColumnGroup removed = null;

    Integer idx = columnGroupsMap.remove(groupName);
    if (idx != null)
    {
        removed = columnGroups.remove(idx.intValue());

        for (ListIterator<JRCrosstabColumnGroup> it = columnGroups.listIterator(idx.intValue()); it.hasNext();)
        {
            JRCrosstabColumnGroup group = it.next();
            columnGroupsMap.put(group.getName(), Integer.valueOf(it.previousIndex()));
        }

        for (Iterator<JRCrosstabCell> it = cellsList.iterator(); it.hasNext();)
        {
            JRCrosstabCell cell = it.next();
            String columnTotalGroup = cell.getColumnTotalGroup();
            if (columnTotalGroup != null && columnTotalGroup.equals(groupName))
            {
                it.remove();
                cellsMap.remove(new Pair<String,String>(cell.getRowTotalGroup(), columnTotalGroup));
                getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_CELLS, cell, -1);
            }
        }

        removeColGroupVars(removed);

        getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_COLUMN_GROUPS, removed, idx.intValue());
    }

    return removed;
}
项目:jasperreports    文件:JRDesignCrosstab.java   
/**
 * Adds a data cell to the crosstab.
 * 
 * @param cell the cell
 * @throws JRException
 * @see JRCrosstab#getCells()
 */
public void addCell(JRDesignCrosstabCell cell) throws JRException
{
    String rowTotalGroup = cell.getRowTotalGroup();     
    if (rowTotalGroup != null && !rowGroupsMap.containsKey(rowTotalGroup))
    {
        throw 
            new JRException(
                EXCEPTION_MESSAGE_KEY_ROW_GROUP_DOES_NOT_EXIST,
                new Object[]{rowTotalGroup});
    }

    String columnTotalGroup = cell.getColumnTotalGroup();
    if (columnTotalGroup != null && !columnGroupsMap.containsKey(columnTotalGroup))
    {
        throw 
            new JRException(
                EXCEPTION_MESSAGE_KEY_ROW_GROUP_DOES_NOT_EXIST,
                new Object[]{columnTotalGroup});
    }

    Pair<String,String> cellKey = new Pair<String,String>(rowTotalGroup, columnTotalGroup);
    if (cellsMap.containsKey(cellKey))
    {
        throw 
            new JRException(
                EXCEPTION_MESSAGE_KEY_DUPLICATE_CELL,
                (Object[])null);
    }

    cellsMap.put(cellKey, cell);
    cellsList.add(cell);

    setCellOrigin(cell.getContents(),
            new JRCrosstabOrigin(this, JRCrosstabOrigin.TYPE_DATA_CELL,
                    rowTotalGroup, columnTotalGroup));

    getEventSupport().fireCollectionElementAddedEvent(PROPERTY_CELLS, cell, cellsList.size() - 1);
}
项目:jasperreports    文件:JRDesignCrosstab.java   
/**
 * Removes a data cell.
 * 
 * @param rowTotalGroup the cell's total row group 
 * @param columnTotalGroup the cell's total column group
 * @return the removed cell
 */
public JRCrosstabCell removeCell(String rowTotalGroup, String columnTotalGroup)
{
    Object cellKey = new Pair<String,String>(rowTotalGroup, columnTotalGroup);

    JRCrosstabCell cell = cellsMap.remove(cellKey);
    if (cell != null)
    {
        cellsList.remove(cell);
        getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_CELLS, cell, -1);
    }

    return cell;
}
项目:jasperreports    文件:ColumnFormatting.java   
public static ColumnFormatting get(ReportContext reportContext, String tableUUID, int columnIndex)
{
    Map<Pair<String, Integer>, ColumnFormatting> columnFormattingMap = (Map<Pair<String, Integer>, ColumnFormatting>) 
            reportContext.getParameterValue(CONTEXT_PARAMETER_COLUMN_FORMATTING);
    ColumnFormatting columnFormatting = columnFormattingMap == null ? null
            : columnFormattingMap.get(new Pair<String, Integer>(tableUUID, columnIndex));
    return columnFormatting;
}
项目:jasperreports    文件:FillBarDataset.java   
public Number getValue(String seriesKey, String category)
{
    return values.get(new Pair<String, String>(seriesKey, category));
}
项目:jasperreports    文件:XYChartHyperlinkProvider.java   
public XYChartHyperlinkProvider(Map<Comparable<?>, Map<Pair, JRPrintHyperlink>>  itemHyperlinks)
{
    this.itemHyperlinks = itemHyperlinks;
}
项目:jasperreports    文件:JRFillXyzDataset.java   
@Override
protected void customInitialize()
{
    dataset = new DefaultXYZDataset();
    itemHyperlinks = new HashMap<Comparable<?>, Map<Pair, JRPrintHyperlink>>();
}
项目:jasperreports    文件:JRFillXyzDataset.java   
public Map<Comparable<?>, Map<Pair, JRPrintHyperlink>> getItemHyperlinks()
{
    return itemHyperlinks;
}
项目:jasperreports    文件:JRFillXyDataset.java   
@Override
protected void customIncrement()
{
    if (xySeries != null && xySeries.length > 0)
    {
        if (seriesNames == null)
        {
            seriesNames = new ArrayList<Comparable<?>>();
            seriesMap = new HashMap<Comparable<?>, XYSeries>();
            labelsMap = new HashMap<Comparable<?>, Map<Number, String>>();
            itemHyperlinks = new HashMap<Comparable<?>, Map<Pair, JRPrintHyperlink>>();
        }

        for(int i = 0; i < xySeries.length; i++)
        {
            JRFillXySeries crtXySeries = xySeries[i];

            Comparable<?> seriesName = crtXySeries.getSeries();
            XYSeries xySrs = seriesMap.get(seriesName);
            if (xySrs == null)
            {
                boolean autoSort = crtXySeries.getAutoSort() == null ? true : crtXySeries.getAutoSort();
                xySrs =  new XYSeries(seriesName, autoSort);
                seriesNames.add(seriesName);
                seriesMap.put(seriesName, xySrs);
            }

            xySrs.addOrUpdate(
                crtXySeries.getXValue(), 
                crtXySeries.getYValue()
                );

            if (crtXySeries.getLabelExpression() != null)
            {
                Map<Number, String> seriesLabels = labelsMap.get(seriesName);
                if (seriesLabels == null)
                {
                    seriesLabels = new HashMap<Number, String>();
                    labelsMap.put(seriesName, seriesLabels);
                }

                seriesLabels.put(crtXySeries.getXValue(), crtXySeries.getLabel());
            }

            if (crtXySeries.hasItemHyperlinks())
            {
                Map<Pair, JRPrintHyperlink> seriesLinks = itemHyperlinks.get(seriesName);
                if (seriesLinks == null)
                {
                    seriesLinks = new HashMap<Pair, JRPrintHyperlink>();
                    itemHyperlinks.put(seriesName, seriesLinks);
                }
                Pair<Number,Number> xyKey = new Pair<Number,Number>(crtXySeries.getXValue(), crtXySeries.getYValue());
                seriesLinks.put(xyKey, crtXySeries.getPrintItemHyperlink());
            }
        }
    }
}
项目:jasperreports    文件:JRFillXyDataset.java   
public Map<Comparable<?>, Map<Pair, JRPrintHyperlink>> getItemHyperlinks()
{
    return itemHyperlinks;
}
项目:jasperreports    文件:JRFillGanttDataset.java   
public Map<Comparable<?>, Map<Pair, JRPrintHyperlink>> getItemHyperlinks()
{
    return itemHyperlinks;
}
项目:jasperreports    文件:VirtualElementsData.java   
public Map<JRPrintElement, Integer> getElementEvaluations(int fillerId, JREvaluationTime evaluationTime)
{
    return elementEvaluations == null ? null : elementEvaluations.get(
            new Pair<Integer, JREvaluationTime>(fillerId, evaluationTime));
}
项目:jasperreports    文件:ParameterTypeSelectorClauseFunction.java   
protected JRClauseFunction selectForParameterTypes(JRClauseTokens clauseTokens, 
        JRQueryClauseContext queryContext, List<Class<?>> parameterTypes)
{
    String queryLanguage = queryContext.getCanonicalQueryLanguage();
    String clauseId = clauseTokens.getClauseId();

    if (log.isDebugEnabled())
    {
        log.debug("selecting clause function " + clauseId + " for language " + queryLanguage
                + " and parameter types " + parameterTypes);
    }

    // fetch extensions
    List<ParameterTypesClauseFunctionBundle> functionsBundles = queryContext.getJasperReportsContext().getExtensions(
            ParameterTypesClauseFunctionBundle.class);
    List<Pair<List<Class<?>>, JRClauseFunction>> candidateFunctions = new ArrayList<Pair<List<Class<?>>,JRClauseFunction>>();
    for (ParameterTypesClauseFunctionBundle functionsBundle : functionsBundles)
    {
        Collection<? extends ParameterTypesClauseFunction> functions = functionsBundle.getTypeFunctions(queryLanguage, clauseId);
        if (functions != null)
        {
            // collect candidates by checking the types
            for (ParameterTypesClauseFunction typesFunction : functions)
            {
                List<Class<?>> supportedTypes = findSupportedTypes(typesFunction, parameterTypes);
                if (supportedTypes != null)
                {
                    JRClauseFunction function = typesFunction.getFunction();
                    if (log.isDebugEnabled())
                    {
                        log.debug("found candidate function " + function
                                + " for types " + supportedTypes);
                    }

                    Pair<List<Class<?>>, JRClauseFunction> candidate = 
                            new Pair<List<Class<?>>, JRClauseFunction>(supportedTypes, function);
                    candidateFunctions.add(candidate);
                }
            }
        }
    }

    return selectFromCandidates(candidateFunctions);
}
项目:jasperreports    文件:Tabulator.java   
protected void collapseSpanColumns(Table table, DimensionRange<Column> range)
{
    List<Pair<Column, Column>> removeList = new ArrayList<Pair<Column, Column>>();
    Column prevColumn = null;
    for (Column column : range.rangeSet)
    {
        if (prevColumn == null)
        {
            prevColumn = column;
            continue;
        }

        boolean collapse = true;
        for (Row row : table.getRows().getEntries())
        {
            Cell prevCell = row.getCell(prevColumn);
            Cell cell = row.getCell(column);
            boolean collapseCell = prevCell == null ? cell == null
                    : (cell != null && prevCell.accept(collapseCheck, cell));
            if (!collapseCell)
            {
                collapse = false;
                break;
            }
        }

        if (collapse)
        {
            // removing outside the iteration so that the iterator is not broken
            removeList.add(new Pair<Column, Column>(column, prevColumn));
        }
        else
        {
            prevColumn = column;
        }
    }

    for (Pair<Column, Column> removePair : removeList)
    {
        table.removeColumn(removePair.first(), removePair.second());
    }
}
项目:jasperreports    文件:Tabulator.java   
protected void collapseSpanRows(Table table, DimensionRange<Row> range)
{
    List<Pair<Row, Row>> removeList = new ArrayList<Pair<Row, Row>>();
    Row prevRow = null;
    for (Row row : range.rangeSet)
    {
        if (prevRow == null)
        {
            prevRow = row;
            continue;
        }

        boolean collapse = true;
        for (Column column : table.getColumns().getEntries())
        {
            Cell prevCell = prevRow.getCell(column);
            Cell cell = row.getCell(column);
            boolean collapseCell = prevCell == null ? cell == null
                    : (cell != null && prevCell.accept(collapseCheck, cell));
            if (!collapseCell)
            {
                collapse = false;
                break;
            }
        }

        if (collapse)
        {
            // removing outside the iteration so that the iterator is not broken
            removeList.add(new Pair<Row, Row>(row, prevRow));
        }
        else
        {
            prevRow = row;
        }
    }

    for (Pair<Row, Row> removePair : removeList)
    {
        table.removeRow(removePair.first(), removePair.second());
    }
}
项目:jasperreports    文件:JRFillTextField.java   
@Override
protected JRTemplateElement getTemplate(JRStyle style)
{
    Pair<JRStyle, TextFormat> key = new Pair<JRStyle, TextFormat>(style, textFormat);
    return textTemplates.get(key);
}
项目:jasperreports    文件:SimpleTextLineWrapper.java   
protected void createFontInfo(Map<Attribute, Object> textAttributes)
{
    fontInfo = fontInfos.get(fontKey);
    if (fontInfo != null)
    {
        // found in local cache
        return;
    }

    Map<Pair<UUID, FontKey>, ElementFontInfo> elementFontInfos = null;
    Pair<UUID, FontKey> elementFontKey = null;

    // look in the fill cache
    if (context.getElement() instanceof JRFillElement)
    {
        JRFillElement fillElement = (JRFillElement) context.getElement();
        JRFillContext fillContext = fillElement.getFiller().getFillContext();
        elementFontKey = new Pair<UUID, FontKey>(fillElement.getUUID(), fontKey);

        elementFontInfos = (Map<Pair<UUID, FontKey>, ElementFontInfo>) fillContext.getFillCache(FILL_CACHE_KEY_ELEMENT_FONT_INFOS);
        if (elementFontInfos == null)
        {
            elementFontInfos = createElementFontInfosFillCache();
            fillContext.setFillCache(FILL_CACHE_KEY_ELEMENT_FONT_INFOS, elementFontInfos);
        }

        fontInfo = elementFontInfos.get(elementFontKey);
    }

    if (fontInfo == null)
    {
        // did not find in the general cache, create the font info
        // we first need the general font info
        FontInfo generalFontInfo = getGeneralFontInfo(textAttributes);

        if (logTrace)
        {
            log.trace("creating element font info for " + fontKey
                    + (elementFontKey == null ? "" : (" and element " + elementFontKey.first())));
        }

        fontInfo = new ElementFontInfo(generalFontInfo);
        fontInfos.put(fontKey, fontInfo);

        if (elementFontInfos != null && elementFontKey.first() != null)//UUID should not be null but check to be sure
        {
            elementFontInfos.put(elementFontKey, fontInfo);
        }
    }
}
项目:jasperreports    文件:JRFillContext.java   
public void addDataRecordResult(FillDatasetPosition fillPosition, Object recorded)
{
    recordedData.add(new Pair<FillDatasetPosition, Object>(fillPosition, recorded));
}