当前位置: 首页>>代码示例>>Java>>正文


Java Cell类代码示例

本文整理汇总了Java中org.olap4j.Cell的典型用法代码示例。如果您正苦于以下问题:Java Cell类的具体用法?Java Cell怎么用?Java Cell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Cell类属于org.olap4j包,在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCellInternal

import org.olap4j.Cell; //导入依赖的package包/类
private Cell getCellInternal(int[] pos) {
    RolapCell cell;
    try {
        cell = (RolapCell) result.getCell(pos);
    } catch (MondrianException e) {
        if (e.getMessage().indexOf("coordinates out of range") >= 0) {
            int[] dimensions = new int[getAxes().size()];
            for (int i = 0; i < axisList.size(); i++) {
                dimensions[i] = axisList.get(i).getPositions().size();
            }
            throw new IndexOutOfBoundsException(
                "Cell coordinates (" + getCoordsAsString(pos)
                    + ") fall outside CellSet bounds ("
                    + getCoordsAsString(dimensions) + ")");
        } else if (e.getMessage().indexOf(
                "coordinates should have dimension") >= 0)
        {
            throw new IllegalArgumentException(
                "Cell coordinates should have dimension "
                    + axisList.size());
        } else {
            throw e;
        }
    }
    return new MondrianOlap4jCell(pos, this, cell);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:27,代码来源:MondrianOlap4jCellSet.java

示例2: emitCell

import org.olap4j.Cell; //导入依赖的package包/类
private void emitCell(SaxWriter writer, Cell cell) throws OlapException {
   ++cellOrdinal;
   Util.discard(cellOrdinal);

   // Ignore empty cells.
   final Object cellValue = cell.getValue();
   if (cellValue == null) {
      return;
   }

   writer.startElement("row");
   for (ColumnHandler columnHandler : columnHandlers) {
      columnHandler.write(writer, cell, members);
   }
   writer.endElement();
}
 
开发者ID:OpenlinkFinancial,项目名称:MXMLABridge,代码行数:17,代码来源:MDataSet.java

示例3: getCellInternal

import org.olap4j.Cell; //导入依赖的package包/类
private Cell getCellInternal(int[] pos) {
    mondrian.olap.Cell cell;
    try {
        cell = result.getCell(pos);
    } catch (MondrianException e) {
        if (e.getMessage().indexOf("coordinates out of range") >= 0) {
            int[] dimensions = new int[getAxes().size()];
            for (int i = 0; i < axisList.size(); i++) {
                dimensions[i] = axisList.get(i).getPositions().size();
            }
            throw new IndexOutOfBoundsException(
                "Cell coordinates (" + getCoordsAsString(pos)
                    + ") fall outside CellSet bounds ("
                    + getCoordsAsString(dimensions) + ")");
        } else if (e.getMessage().indexOf(
            "coordinates should have dimension") >= 0)
        {
            throw new IllegalArgumentException(
                "Cell coordinates should have dimension "
                    + axisList.size());
        } else {
            throw e;
        }
    }
    return new MondrianOlap4jCell(pos, this, cell);
}
 
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:27,代码来源:MondrianOlap4jCellSet.java

示例4: getCell

import org.olap4j.Cell; //导入依赖的package包/类
@Override
public Cell getCell(List<Integer> coordinates) {
	String skey = getKeyFromInts(coordinates);
	Cell cell = cells.get(skey);
	if(cell==null){
		cell = new ServerCell(this, coordinates, null, null);	
		cells.put(skey, cell);
	}
	return cell;
}
 
开发者ID:Wondersoft,项目名称:olaper,代码行数:11,代码来源:ServerCellSet.java

示例5: addCell

import org.olap4j.Cell; //导入依赖的package包/类
public Cell addCell(Integer[] integers, Number value, DecimalFormat format) {		
	List<Integer> positions = Arrays.asList(integers);
	ServerCell cell = new ServerCell(this, positions, value, format);
	String skey = getKeyFromInts(positions);
	cells.put(skey, cell);
	return cell;
	
}
 
开发者ID:Wondersoft,项目名称:olaper,代码行数:9,代码来源:ServerCellSet.java

示例6: getCell

import org.olap4j.Cell; //导入依赖的package包/类
@Override
public JROlapCell getCell(int[] axisPositions)
{
	List<Integer> positions = new ArrayList<Integer>(axisPositions.length);
	for (int index = 0; index < axisPositions.length; index++)
	{
		positions.add(axisPositions[index]);
	} 
	Cell dataCell = cellSet.getCell(positions);
	return new Olap4jCell(dataCell);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:12,代码来源:Olap4jResult.java

示例7: next

import org.olap4j.Cell; //导入依赖的package包/类
@Override
  public List<?> next() throws TranslatorException {
  	if (!rowPositionIterator.hasNext()) {
  		return null;
  	}
  	Position rowPosition = rowPositionIterator.next();
  	Object[] result = new Object[colWidth];
  	int i = 0;
  	// add in rows axis
List<Member> members = rowPosition.getMembers();
for (Member member:members) {
	String columnName = member.getName();
	result[i++] = columnName;
}

// add col axis
for (Position colPos : columnsAxis) {
	Cell cell = cellSet.getCell(colPos, rowPosition);
	result[i++] = cell.getValue();
}	
if (returnsArray) {
	ArrayList<Object[]> results = new ArrayList<Object[]>(1);
	results.add(result);
	return results;
}
return Arrays.asList(result);
  }
 
开发者ID:kenweezy,项目名称:teiid,代码行数:28,代码来源:OlapQueryExecution.java

示例8: getCell

import org.olap4j.Cell; //导入依赖的package包/类
public Cell getCell(List<Integer> coordinates) {
    int[] coords = new int[coordinates.size()];
    for (int i = 0; i < coords.length; i++) {
        coords[i] = coordinates.get(i);
    }
    return getCellInternal(coords);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:8,代码来源:MondrianOlap4jCellSet.java

示例9: testCellProperties

import org.olap4j.Cell; //导入依赖的package包/类
public void testCellProperties() throws SQLException {
    final OlapConnection connection =
        getTestContext().getOlap4jConnection();
    final CellSet cellSet =
        connection.createStatement().executeOlapQuery(
            "with member [Customers].[USA].[CA WA] as\n"
            + " Aggregate({[Customers].[USA].[CA], [Customers].[USA].[WA]})\n"
            + "select [Measures].[Unit Sales] on 0,\n"
            + " {[Customers].[USA].[CA], [Customers].[USA].[CA WA]} on 1\n"
            + "from [Sales]\n"
            + "cell properties ACTION_TYPE, DRILLTHROUGH_COUNT");
    final CellSetMetaData metaData = cellSet.getMetaData();
    final Property actionTypeProperty =
        metaData.getCellProperties().get("ACTION_TYPE");
    final Property drillthroughCountProperty =
        metaData.getCellProperties().get("DRILLTHROUGH_COUNT");

    // Cell [0, 0] is drillable
    final Cell cell0 = cellSet.getCell(0);
    final int actionType0 =
        (Integer) cell0.getPropertyValue(actionTypeProperty);
    assertEquals(0x100, actionType0); // MDACTION_TYPE_DRILLTHROUGH
    final int drill0 =
        (Integer) cell0.getPropertyValue(drillthroughCountProperty);
    assertEquals(24442, drill0);

    // Cell [0, 1] is not drillable
    final Cell cell1 = cellSet.getCell(1);
    final int actionType1 =
        (Integer) cell1.getPropertyValue(actionTypeProperty);
    assertEquals(0x0, actionType1);
    final int drill1 =
        (Integer) cell1.getPropertyValue(drillthroughCountProperty);
    assertEquals(-1, drill1);
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:36,代码来源:Olap4jTest.java

示例10: cellIter

import org.olap4j.Cell; //导入依赖的package包/类
/**
 * Returns an iterator over cells in a result.
 */
private static Iterable<Cell> cellIter(final int[] pageCoords, final CellSet cellSet) {
    return new Iterable<Cell>() {
        public Iterator<Cell> iterator() {
            final int[] axisDimensions = new int[cellSet.getAxes().size() - pageCoords.length];
            assert pageCoords.length <= axisDimensions.length;
            for (int i = 0; i < axisDimensions.length; i++) {
                final CellSetAxis axis = cellSet.getAxes().get(i);
                axisDimensions[i] = axis.getPositions().size();
            }
            final CoordinateIterator coordIter = new CoordinateIterator(axisDimensions, true);
            return new Iterator<Cell>() {
                public boolean hasNext() {
                    return coordIter.hasNext();
                }

                public Cell next() {
                    final int[] ints = coordIter.next();
                    final AbstractList<Integer> intList = new AbstractList<Integer>() {
                        @Override
                        public Integer get(final int index) {
                            return index < ints.length ? ints[index] : pageCoords[index - ints.length];
                        }

                        @Override
                        public int size() {
                            return pageCoords.length + ints.length;
                        }
                    };
                    return cellSet.getCell(intList);
                }

                public void remove() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    };
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:42,代码来源:CellSetFormatter.java

示例11: cellIter

import org.olap4j.Cell; //导入依赖的package包/类
/**
 * Returns an iterator over cells in a result.
 */
private static Iterable<Cell> cellIter( final int[] pageCoords, final CellSet cellSet ) {
  return new Iterable<Cell>() {
    public Iterator<Cell> iterator() {
      final int[] axisDimensions = new int[cellSet.getAxes().size() - pageCoords.length];
      assert pageCoords.length <= axisDimensions.length;
      for ( int i = 0; i < axisDimensions.length; i++ ) {
        final CellSetAxis axis = cellSet.getAxes().get( i );
        axisDimensions[i] = axis.getPositions().size();
      }
      final CoordinateIterator coordIter = new CoordinateIterator( axisDimensions, true );
      return new Iterator<Cell>() {
        public boolean hasNext() {
          return coordIter.hasNext();
        }

        public Cell next() {
          final int[] ints = coordIter.next();
          final AbstractList<Integer> intList = new AbstractList<Integer>() {
            @Override
            public Integer get( final int index ) {
              return index < ints.length ? ints[index] : pageCoords[index - ints.length];
            }

            @Override
            public int size() {
              return pageCoords.length + ints.length;
            }
          };
          return cellSet.getCell( intList );
        }

        public void remove() {
          throw new UnsupportedOperationException();
        }
      };
    }
  };
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:42,代码来源:CellSetFormatter.java

示例12: parseCellDataElement

import org.olap4j.Cell; //导入依赖的package包/类
protected void parseCellDataElement(CellSet result) throws JRException
{
	if (log.isDebugEnabled())
	{
		log.debug("COLUMNS axis size: " + result.getAxes().get(Axis.COLUMNS.axisOrdinal())
			.getPositions().size());
		log.debug("ROWS axis size: " + result.getAxes().get(Axis.ROWS.axisOrdinal())
			.getPositions().size());
	}
	for (Position axis_1 : result.getAxes().get(Axis.ROWS.axisOrdinal()).getPositions())
	{
		for (Position axis_0 : result.getAxes().get(Axis.COLUMNS.axisOrdinal()).getPositions())
		{
			Cell currentCell = result.getCell(axis_0, axis_1);
			if (currentCell.isError())
			{
				handleCellErrors(currentCell);
			}
			else
			{
				int cellOrdinal = currentCell.getOrdinal();
				Object value = currentCell.getValue();
				if (value instanceof Number)
				{
					try
					{
						value = currentCell.getDoubleValue();
					}
					catch (OlapException e)
					{
						throw new JRException(e);
					}
				}
				
				String fmtValue = currentCell.getFormattedValue();
				JRXmlaCell cell = new JRXmlaCell(value, fmtValue);
				if (log.isDebugEnabled())
				{
					log.debug("Cell: " + cellOrdinal + ", at axis 0 pos: " + axis_0.getOrdinal() + ", axis 1 pos: " + axis_1.getOrdinal());
				}
				xmlaResult.setCell(cell, cellOrdinal);
			}
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:46,代码来源:Olap4jXmlaQueryExecuter.java

示例13: handleCellErrors

import org.olap4j.Cell; //导入依赖的package包/类
protected void handleCellErrors(Cell currentCell) throws JRException
{
	log.error(currentCell.getValue());
	
	throw new JRException((OlapException) currentCell.getValue());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:7,代码来源:Olap4jXmlaQueryExecuter.java

示例14: Olap4jCell

import org.olap4j.Cell; //导入依赖的package包/类
public Olap4jCell(Cell cell)
{
	this.value = cell.getValue();
	this.formattedValue = cell.getFormattedValue();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:6,代码来源:Olap4jCell.java

示例15: printBody

import org.olap4j.Cell; //导入依赖的package包/类
/**
	 * Prints the body in the CellSetRenderer
	 */
	private boolean printBody(Graphics2D g, int maxRowHeight, int numRows,
			int firstRecord, double rowHeaderWidth, int colHeaderSumHeight,
			int[] columnWidthList, Color oldForeground) {
		
		g.setBackground(oldForeground);
		
		CellSetAxis columnsAxis = getCellSet().getAxes().get(0);
        CellSetAxis rowsAxis = getCellSet().getAxes().get(1);
        g.setFont(getBodyFont());
        for (int row = firstRecord; row < rowsAxis.getPositionCount(); row++) {
            if (row == numRows + firstRecord) {
                return true;
            }
            int colPosition = 0;
            for (int col = 0; col < columnsAxis.getPositionCount(); col++) {
                String formattedValue;
                Cell cell = getCellSet().getCell(
				        columnsAxis.getPositions().get(col),
				        rowsAxis.getPositions().get(row));
				if (bodyFormat != null) {
                    try {
                        formattedValue = bodyFormat.format(cell.getDoubleValue());
                    } catch (OlapException e) {
                        throw new RuntimeException(e);
                    }
                } else {
                    formattedValue = cell.getFormattedValue();
                }
                
                double alignmentShift = 0;
                int columnWidth = columnWidthList[col];
                //final int columnWidth = tableAsModel.getColumnModel().getColumn(col).getWidth();
                final double textWidthInContext = getBodyFont().getStringBounds(formattedValue, g.getFontRenderContext()).getWidth();
                switch (bodyAlignment) {
                    case RIGHT:
                        alignmentShift = columnWidth - textWidthInContext;
                        break;
                    case LEFT:
                        break;
                    case CENTER:
                        alignmentShift = (columnWidth - textWidthInContext) / 2;
                        break;
                    default:
                        throw new IllegalStateException("Unknown alignment of type " + bodyAlignment);
                }
//                g.setBackground(Color.decode((String) cell.getPropertyValue(Property.StandardCellProperty.BACK_COLOR)));
                if (logger.isDebugEnabled()) {
                	logger.debug("");
                	logger.debug("Value: " + cell.getPropertyValue(Property.StandardCellProperty.VALUE));
                	logger.debug("Cell evaluation list: " + cell.getPropertyValue(Property.StandardCellProperty.CELL_EVALUATION_LIST));
                	logger.debug("Font flags: " + cell.getPropertyValue(Property.StandardCellProperty.FONT_FLAGS));
                	logger.debug("Fore Color: "  + cell.getPropertyValue(Property.StandardCellProperty.FORE_COLOR));
                	logger.debug("Back Color " + cell.getPropertyValue(Property.StandardCellProperty.BACK_COLOR));
                	logger.debug("Formatted Value " + cell.getPropertyValue(Property.StandardCellProperty.FORMATTED_VALUE));
                	logger.debug("Non empty behaviour" + cell.getPropertyValue(Property.StandardCellProperty.NON_EMPTY_BEHAVIOR));
                }
//                g.setColor((Color) cell.getPropertyValue(Property.StandardCellProperty.FORE_COLOR));
                g.drawString(formattedValue, (int) (rowHeaderWidth + colPosition + alignmentShift), (int) (colHeaderSumHeight + ((row - firstRecord) * maxRowHeight) + maxRowHeight));
                colPosition += columnWidth;
            }
        }
        return false;
	}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:67,代码来源:CellSetRenderer.java


注:本文中的org.olap4j.Cell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。