@SuppressWarnings("deprecation") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); styleResolver = StyleResolver.getInstance(); if (detail != null) { detailSection = new JRBaseSection(detail); detail = null; } if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2) { whenNoDataTypeValue = WhenNoDataTypeEnum.getByValue(whenNoDataType); printOrderValue = PrintOrderEnum.getByValue(printOrder); orientationValue = OrientationEnum.getByValue(orientation); } }
@Override public FillComponent toFillComponent(Component component, JRFillObjectFactory factory) { try { ListComponent list = (ListComponent) component; FillComponent fillList; PrintOrderEnum printOrder = list.getPrintOrderValue(); if (printOrder == null || printOrder == PrintOrderEnum.VERTICAL) { fillList = new VerticalFillList(list, factory); } else { fillList = new HorizontalFillList(list, factory); } return fillList; } catch (JRException e) { throw new JRRuntimeException(e); } }
protected void addListRules(Digester digester) { String listPattern = "*/componentElement/list"; digester.addObjectCreate(listPattern, StandardListComponent.class); digester.addSetProperties(listPattern, //properties to be ignored by this rule new String[]{"printOrder"}, new String[0]); digester.addRule(listPattern, new XmlConstantPropertyRule( "printOrder", "printOrderValue", PrintOrderEnum.values())); String listContentsPattern = listPattern + "/listContents"; digester.addObjectCreate(listContentsPattern, DesignListContents.class); digester.addSetProperties(listContentsPattern); digester.addSetNext(listContentsPattern, "setContents"); }
@Override public void setPropertyValue(Object id, Object value) { StandardListComponent jrList = getList(); if (id.equals(StandardListComponent.PROPERTY_IGNORE_WIDTH)) jrList.setIgnoreWidth((Boolean) value); else if (id.equals(StandardListComponent.PROPERTY_PRINT_ORDER)) jrList.setPrintOrderValue((PrintOrderEnum) printOrderD.getEnumValue(value)); else if (id.equals(PREFIX + DesignListContents.PROPERTY_HEIGHT)) ((DesignListContents) jrList.getContents()).setHeight((Integer) value); else if (id.equals(PREFIX + DesignListContents.PROPERTY_WIDTH)) ((DesignListContents) jrList.getContents()).setWidth((Integer) value); else if (id.equals(PREFIX + JRDesignElementDataset.PROPERTY_DATASET_RUN)) { if (value == null) { jrList.setDatasetRun(null); } else { MDatasetRun mdr = (MDatasetRun) value; JRDesignDatasetRun dr = (JRDesignDatasetRun) mdr.getValue(); if (dr.getDatasetName() != null) jrList.setDatasetRun(dr); else jrList.setDatasetRun(null); } } else super.setPropertyValue(id, value); }
/** * */ private void addColumnSeparator(int colX) { if (report.getPrintOrderValue() == PrintOrderEnum.HORIZONTAL) { if (downColumnHeader > upColumnHeader) { addVerticalGridLine(colX, upColumnHeader, downColumnHeader - upColumnHeader); } if (downDetails > upDetails) { addVerticalGridLine(colX, upDetails, downDetails - upDetails); } if (downColumnFooter > upColumnFooter) { addVerticalGridLine(colX, upColumnFooter, downColumnFooter - upColumnFooter); } } else //vertical printOrder { if (downColumnFooter > upColumnHeader) { addVerticalGridLine(colX, upColumnHeader, downColumnFooter - upColumnHeader); } } }
/** * Sets the print order. In case of multiple column reports, the engine can perform vertical or horizontal fill. * @see net.sf.jasperreports.engine.type.PrintOrderEnum VERTICAL, * @see net.sf.jasperreports.engine.type.PrintOrderEnum HORIZONTAL */ public void setPrintOrder(PrintOrderEnum printOrderValue) { Object old = this.printOrderValue; this.printOrderValue = printOrderValue; getEventSupport().firePropertyChange(PROPERTY_PRINT_ORDER, old, this.printOrderValue); }
@SuppressWarnings("deprecation") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2) { printOrderValue = PrintOrderEnum.getByValue(printOrder); } }
@Override public List getTagList() { List tags = new java.util.ArrayList(); tags.add(new Tag(PrintOrderEnum.VERTICAL, I18n.getString("ReportNode.Property.Vertical"))); tags.add(new Tag(PrintOrderEnum.HORIZONTAL, I18n.getString("ReportNode.Property.Horizontal"))); return tags; }
@SuppressWarnings("unchecked") public PrintOrderProperty(JasperDesign jd) { super(PrintOrderEnum.class, jd); this.jasperDesign = jd; setValue("suppressCustomEditor", Boolean.TRUE); }
@Override public PrintOrderEnum getPrintOrderValue() { return printOrderValue; }
@Override public PrintOrderEnum getPrintOrderValue() { return PrintOrderEnum.VERTICAL; }
/** * Creates the property descriptors. * * @param desc * the desc */ @Override public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) { super.createPropertyDescriptors(desc, defaultsMap); printOrderD = new JSSEnumPropertyDescriptor(StandardListComponent.PROPERTY_PRINT_ORDER, Messages.MList_print_order, PrintOrderEnum.class, NullEnum.NOTNULL); printOrderD.setDescription(Messages.MList_print_order_description); desc.add(printOrderD); printOrderD.setCategory(Messages.MList_list_properties_category); printOrderD.setHelpRefBuilder(new HelpReferenceBuilder("net.sf.jasperreports.doc/docs/components.schema.reference.html#_printOrder")); CheckBoxPropertyDescriptor ignoreWidthD = new CheckBoxPropertyDescriptor(StandardListComponent.PROPERTY_IGNORE_WIDTH, Messages.MList_ignore_width, NullEnum.NULL); ignoreWidthD.setDescription(Messages.MList_ignore_width_description); desc.add(ignoreWidthD); ignoreWidthD.setCategory(Messages.MList_list_properties_category); ignoreWidthD.setHelpRefBuilder(new HelpReferenceBuilder("net.sf.jasperreports.doc/docs/components.schema.reference.html#_ignoreWidth")); DatasetRunPropertyDescriptor datasetRunD = new DatasetRunPropertyDescriptor(PREFIX + StandardListComponent.PROPERTY_DATASET_RUN, Messages.MList_dataset_run, false); //$NON-NLS-1$ datasetRunD.setDescription(Messages.MList_dataset_run_description); datasetRunD.setCategory(Messages.MList_list_properties_category); desc.add(datasetRunD); setHelpPrefix(desc, "net.sf.jasperreports.doc/docs/components.schema.reference.html#list"); PixelPropertyDescriptor heightD = new PixelPropertyDescriptor(PREFIX + DesignListContents.PROPERTY_HEIGHT, Messages.MList_cell_height); heightD.setCategory(Messages.MList_list_properties_category); heightD.setDescription(Messages.MList_cell_height_description); desc.add(heightD); heightD.setHelpRefBuilder(new HelpReferenceBuilder("net.sf.jasperreports.doc/docs/components.schema.reference.html#listContents_height")); ListSizePropertyDescriptor cellSizeDescriptor = new ListSizePropertyDescriptor(); cellSizeDescriptor.setCategory(Messages.MList_list_properties_category); cellSizeDescriptor.setDescription(Messages.MList_cell_height_description); desc.add(cellSizeDescriptor); PixelPropertyDescriptor widthD = new PixelPropertyDescriptor(PREFIX + DesignListContents.PROPERTY_WIDTH, Messages.MList_cell_width); widthD.setCategory(Messages.MList_list_properties_category); widthD.setDescription(Messages.MList_cell_width_description); desc.add(widthD); widthD.setHelpRefBuilder(new HelpReferenceBuilder("net.sf.jasperreports.doc/docs/components.schema.reference.html#listContents_width")); defaultsMap.put(StandardListComponent.PROPERTY_IGNORE_WIDTH, new Boolean(false)); defaultsMap.put(StandardListComponent.PROPERTY_PRINT_ORDER, PrintOrderEnum.HORIZONTAL); }
@SuppressWarnings("unchecked") public PrintOrderProperty(StandardListComponent element) { super(PrintOrderEnum.class, element); this.element = element; }
@Override public Object getDefaultValue() { return PrintOrderEnum.VERTICAL; }
@Override public void setPropertyValue(Object orderType) { element.setPrintOrderValue((PrintOrderEnum)orderType); }
@Override public void setPropertyValue(Object val) { jasperDesign.setPrintOrder((PrintOrderEnum)val); }
private void paintRestrictedArea(JasperDesign jd, Graphics2D g) { if (jd.getColumnCount() <= 1) return; // Column header int c_x = jd.getLeftMargin(); // if (jd.getPrintOrderValue() != null && // jd.getPrintOrderValue() == PrintOrderEnum.VERTICAL) // { // int c_y0 = ModelUtils.getBandLocation(jd.getColumnHeader(), jd); // int c_y1 = ModelUtils.getBandLocation(jd.getPageFooter(), jd); // // Paint oldPaint = g.getPaint(); // g.setPaint(getRestrictedAreaTexture()); // int x0 = jd.getLeftMargin() + jd.getColumnWidth(); // int width = jd.getPageWidth() - x0 - jd.getRightMargin(); // // if (jd.getColumnDirection() == RunDirectionEnum.RTL) // { // x0 = jd.getLeftMargin(); // width = (jd.getColumnCount()-1)*jd.getColumnWidth() + (jd.getColumnCount()-1)*jd.getColumnSpacing(); // } // // g.fillRect(x0, c_y0, width, c_y1-c_y0); // g.setPaint(oldPaint); // } // else // { List<JRBand> bands = new ArrayList<JRBand>(); if (jd.getColumnHeader() != null) bands.add(jd.getColumnHeader()); if (jd.getColumnFooter() != null) bands.add(jd.getColumnFooter()); if (jd.getDetailSection()!= null && jd.getDetailSection().getBands() != null && jd.getDetailSection().getBands().length > 0) { bands.addAll( Arrays.asList(jd.getDetailSection().getBands()) ); } if (jd.getPrintOrderValue() != null && jd.getPrintOrderValue() == PrintOrderEnum.VERTICAL) { // Add all the group header and footers as well.. List groups = jd.getGroupsList(); for (Object grpObj : groups) { JRGroup grp = (JRGroup)grpObj; if (grp.getGroupHeaderSection() != null && grp.getGroupHeaderSection().getBands() != null && grp.getGroupHeaderSection().getBands().length > 0) { bands.addAll( Arrays.asList( grp.getGroupHeaderSection().getBands() ) ); } if (grp.getGroupFooterSection() != null && grp.getGroupFooterSection().getBands() != null && grp.getGroupFooterSection().getBands().length > 0) { bands.addAll( Arrays.asList( grp.getGroupFooterSection().getBands() ) ); } } } int x0 = jd.getLeftMargin() + jd.getColumnWidth(); int width = jd.getPageWidth() - x0 - jd.getRightMargin(); if (jd.getColumnDirection() == RunDirectionEnum.RTL) { x0 = jd.getLeftMargin(); width = (jd.getColumnCount()-1)*jd.getColumnWidth() + (jd.getColumnCount()-1)*jd.getColumnSpacing(); } Paint oldPaint = g.getPaint(); g.setPaint(getRestrictedAreaTexture()); for (JRBand b : bands) { int c_y0 = ModelUtils.getBandLocation(b, jd); g.fillRect(x0, c_y0, width, b.getHeight()); } g.setPaint(oldPaint); }
/** * Sets the list cell print order. * * @param printOrderValue the cell print oder, null or one of * <ul> * <li>{@link PrintOrderEnum#VERTICAL}</li> * <li>{@link PrintOrderEnum#HORIZONTAL}</li> * </ul> * @see #getPrintOrderValue() */ public void setPrintOrderValue(PrintOrderEnum printOrderValue) { Object old = this.printOrderValue; this.printOrderValue = printOrderValue; getEventSupport().firePropertyChange(PROPERTY_PRINT_ORDER, old, this.printOrderValue); }
/** * Specifies whether columns will be filled horizontally or vertically. * @return a value representing one of the print order constants in {@link PrintOrderEnum} */ public PrintOrderEnum getPrintOrderValue();
/** * Returns the print order of the list cells. * * <p> * The list cells can be either printed vertically one beneath another * (on a single column), or horizontally on rows of 2 or more columns. * </p> * * <p> * The default print order (used when no explicit order has been set) * is vertical. * </p> * * @return the list print order if set, one of * <ul> * <li>{@link PrintOrderEnum#VERTICAL}</li> * <li>{@link PrintOrderEnum#HORIZONTAL}</li> * </ul> * @see ListContents#getWidth() */ public PrintOrderEnum getPrintOrderValue();