public CreateE4ObjectCommand(ANode child, MCell parent, Rectangle location, int index) { super(parent, null, location, index); JasperDesign jd = parent.getJasperDesign(); jDataset = jd.getMainDesignDataset(); StandardTable st = TableManager.getTable(parent.getMTable()); JRDatasetRun dr = st.getDatasetRun(); if (dr != null) { String dbname = dr.getDatasetName(); if (dbname != null) jDataset = (JRDesignDataset) jd.getDatasetMap().get(dbname); } this.child = child; this.parent = parent; }
@Override protected void createObject() { try { MCell mparent = (MCell) parent; Tag tag = Tag.getExpression(child); switch (mparent.getType()) { case TableUtil.COLUMN_HEADER: case TableUtil.COLUMN_FOOTER: var = Tag.createVariable(tag, ResetTypeEnum.COLUMN, null, jDataset); srcNode = Tag.createTextField(tag.txt.replaceAll("%", tag.name), tag.classname); break; case TableUtil.COLUMN_GROUP_HEADER: var = Tag.createVariable(tag, ResetTypeEnum.GROUP, mparent.getJrGroup(), jDataset); srcNode = Tag.createTextField(tag.txt.replaceAll("%", tag.name), tag.classname); break; case TableUtil.COLUMN_GROUP_FOOTER: var = Tag.createVariable(tag, ResetTypeEnum.GROUP, mparent.getJrGroup(), jDataset); srcNode = Tag.createTextField(tag.txt.replaceAll("%", tag.name), tag.classname); break; case TableUtil.COLUMN_DETAIL: srcNode = Tag.createTextField(tag.txt.replaceAll("%", tag.name), tag.classname); break; case TableUtil.TABLE_FOOTER: case TableUtil.TABLE_HEADER: var = Tag.createVariable(tag, ResetTypeEnum.REPORT, null, jDataset); srcNode = Tag.createTextField(tag.txt.replaceAll("%", tag.name), tag.classname); break; default: srcNode = Tag.createStaticText(tag.name); } jrElement = srcNode.getValue(); super.createObject(); } catch (Exception e) { e.printStackTrace(); } }