Java 类net.sf.jasperreports.engine.design.JRDesignConditionalStyle 实例源码

项目:PDFReporter-Studio    文件:MConditionalStyle.java   
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
    super.createPropertyDescriptors(desc, defaultsMap);

    Set<IPropertyDescriptor> toRemove = new HashSet<IPropertyDescriptor>();
    // remove name, defaults
    for (IPropertyDescriptor d : desc) {
        if (d.getId().equals(JRDesignStyle.PROPERTY_NAME))
            toRemove.add(d);
        else if (d.getId().equals(JRDesignStyle.PROPERTY_DEFAULT))
            toRemove.add(d);
    }
    desc.removeAll(toRemove);

    JRExpressionPropertyDescriptor conditionalExpressionD = new JRExpressionPropertyDescriptor(
            JRDesignConditionalStyle.PROPERTY_CONDITION_EXPRESSION, Messages.MConditionalStyle_conditional_expression);
    conditionalExpressionD.setCategory(Messages.MConditionalStyle_properties_category);
    conditionalExpressionD.setDescription(Messages.MConditionalStyle_conditional_expression_description);
    desc.add(conditionalExpressionD);

}
项目:PDFReporter-Studio    文件:ResetConditionalStyleCommand.java   
/**
 * Copy all the attributes of the source style to the destination style
 * 
 * @param source source style
 * @param dest destination style
 */
private void copyStyleAttributes(JRDesignConditionalStyle source, JRDesignConditionalStyle dest){
    dest.setBackcolor(source.getOwnBackcolor());
    dest.setBlankWhenNull(source.isOwnBlankWhenNull());
    dest.setBold(source.isOwnBold());
    dest.setFill(source.getOwnFillValue());
    dest.setFontName(source.getOwnFontName());
    dest.setFontSize(source.getOwnFontSize());
    dest.setForecolor(source.getOwnForecolor());
    dest.setHorizontalAlignment(source.getOwnHorizontalAlignmentValue());
    dest.setItalic(source.isOwnItalic());
    dest.setMarkup(source.getOwnMarkup());
    dest.setMode(source.getOwnModeValue());
    dest.setParentStyle(source.getStyle());
    dest.setPattern(source.getOwnPattern());
    dest.setPdfEmbedded(source.isOwnPdfEmbedded());
    dest.setPdfEncoding(source.getOwnPdfEncoding());
    dest.setPdfFontName(source.getOwnPdfFontName());
    dest.setRadius(source.getOwnRadius());
    dest.setRotation(source.getOwnRotationValue());
    dest.setScaleImage(source.getOwnScaleImageValue());
    dest.setStrikeThrough(source.isOwnStrikeThrough());
    dest.setUnderline(source.isOwnUnderline());
    dest.setVerticalAlignment(source.getOwnVerticalAlignmentValue());
    dest.setConditionExpression(source.getConditionExpression());
}
项目:jasperreports    文件:JRConditionalStyleFillerFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRDesignConditionalStyle style = (JRDesignConditionalStyle) digester.peek();

    if (log.isWarnEnabled())
    {
        if (atts.getValue(JRXmlConstants.ATTRIBUTE_name) != null)
        {
            log.warn("Conditional style should not have a '" + JRXmlConstants.ATTRIBUTE_name + "' attribute.");
        }

        if (atts.getValue(JRXmlConstants.ATTRIBUTE_isDefault) != null)
        {
            log.warn("Conditional style should not have an '" + JRXmlConstants.ATTRIBUTE_isDefault + "' attribute.");
        }

        if (atts.getValue(JRXmlConstants.ATTRIBUTE_style) != null)
        {
            log.warn("Conditional style cannot have a '" + JRXmlConstants.ATTRIBUTE_style + "' attribute.");
        }
    }

    // set common style attributes
    setCommonStyle(style, atts);

    return style;
}
项目:jasperreports    文件:JRConditionalStyleFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRDesignConditionalStyle style = new JRDesignConditionalStyle();
    JRDesignStyle parentStyle = (JRDesignStyle) digester.peek();

    style.setParentStyle(parentStyle);
    parentStyle.addConditionalStyle(style);

    return style;
}
项目:PDFReporter-Studio    文件:MConditionalStyle.java   
@Override
public String getDisplayText() {
    JRExpression conditionExpression = ((JRDesignConditionalStyle) getValue()).getConditionExpression();
    if (conditionExpression != null)
        return conditionExpression.getText();
    return "<NO CONDITION SET>";
}
项目:PDFReporter-Studio    文件:MConditionalStyle.java   
@Override
protected void postDescriptors(IPropertyDescriptor[] descriptors) {
    super.postDescriptors(descriptors);
    for(IPropertyDescriptor desc : descriptors){
        if(JRDesignConditionalStyle.PROPERTY_CONDITION_EXPRESSION.equals(desc.getId())){
            // fix the conditional expression context
            ((JRExpressionPropertyDescriptor) desc).setExpressionContext(
                    ExpressionEditorSupportUtil.getReportExtendedExpressionContext());
            return;
        }
    }
}
项目:PDFReporter-Studio    文件:MConditionalStyle.java   
@Override
public Object getPropertyValue(Object id) {
    JRDesignConditionalStyle jrstyle = (JRDesignConditionalStyle) getValue();
    if (id.equals(JRDesignConditionalStyle.PROPERTY_CONDITION_EXPRESSION))
        return ExprUtil.getExpression(jrstyle.getConditionExpression());
    return super.getPropertyValue(id);
}
项目:PDFReporter-Studio    文件:MConditionalStyle.java   
@Override
public void setPropertyValue(Object id, Object value) {
    if (isEditable()) {
        JRDesignConditionalStyle jrstyle = (JRDesignConditionalStyle) getValue();
        if (id.equals(JRDesignConditionalStyle.PROPERTY_CONDITION_EXPRESSION))
            jrstyle.setConditionExpression(ExprUtil.setValues(jrstyle.getConditionExpression(), value));
        else
            super.setPropertyValue(id, value);
    }
}
项目:PDFReporter-Studio    文件:ResetConditionalStyleCommand.java   
@Override
public void execute() {
    newStyle = null;
    if (oldStyle == null) return;
    JRDesignConditionalStyle defaultValueStyle = MConditionalStyle.createJRStyle();
    JRDesignConditionalStyle dummyStyle = MConditionalStyle.createJRStyle();
    copyStyleAttributes(oldDesignStyle, dummyStyle);
    newStyle = oldDesignStyle;
    oldDesignStyle = dummyStyle;
    copyStyleAttributes(defaultValueStyle, newStyle);
}
项目:ireport-fork    文件:ConditionalStyleNode.java   
public ConditionalStyleNode(JasperDesign jd, JRDesignConditionalStyle style, Lookup doLkp, JRDesignStyle parentStyle)
{
    super(jd, style, new ProxyLookup( Lookups.singleton(style), doLkp));
    this.parentStyle = parentStyle;
    style.getEventSupport().addPropertyChangeListener(this);
    this.setName("conditionalStyle");
}
项目:ireport-fork    文件:ConditionalStyleNode.java   
public void propertyChange(PropertyChangeEvent evt) {

    if (evt.getPropertyName() == null) return;
    if (evt.getPropertyName().equals( JRDesignConditionalStyle.PROPERTY_CONDITION_EXPRESSION ))
    {
        fireDisplayNameChange(null, null);
    }

    super.propertyChange(evt);
}
项目:ireport-fork    文件:ConditionalStyleNode.java   
@SuppressWarnings("unchecked")
public ConditionExpressionProperty(JRDesignConditionalStyle conditionalStyle, JasperDesign jd)
{
    super(conditionalStyle, new FullExpressionContext(jd));
    setName( JRDesignConditionalStyle.PROPERTY_CONDITION_EXPRESSION);
    setDisplayName("Condition Expression");
    setShortDescription("The expression used as condition. It should return a boolean object.");
    this.conditionalStyle = conditionalStyle;
    this.jd = jd;
}
项目:ireport-fork    文件:ConditionalStyleChildren.java   
@SuppressWarnings("unchecked")
public ConditionalStyleChildren(JasperDesign jd, JRDesignConditionalStyle style, Lookup doLkp) {
    super(new ArrayList());
    this.jd = jd;
    this.doLkp=doLkp;
    this.style=style;
}
项目:ireport-fork    文件:AbstractStyleNode.java   
public AbstractStyleNode(JasperDesign jd, JRDesignConditionalStyle style, Lookup doLkp) {
    super(new ConditionalStyleChildren(jd, style, doLkp), null, new ProxyLookup(doLkp, Lookups.fixed(jd,style)));
    this.jd = jd;
    this.style = style;

    init();
}
项目:PDFReporter-Studio    文件:StyleConditionalSection.java   
@Override
protected void initializeProvidedProperties() {
    super.initializeProvidedProperties();
    addProvidedProperties(JRDesignConditionalStyle.PROPERTY_CONDITION_EXPRESSION, Messages.MConditionalStyle_conditional_expression);
}
项目:PDFReporter-Studio    文件:ResetConditionalStyleCommand.java   
public ResetConditionalStyleCommand(JasperDesign jd, MStyle oldStyle) {
    super();
    this.jrDesign = jd;
    this.oldStyle = oldStyle;
    oldDesignStyle = (JRDesignConditionalStyle)oldStyle.getValue();
}
项目:Genji    文件:ReportOverviewJasperDesign.java   
private static void addJRDesignStyles(JasperDesign jasperDesign, boolean isGrid) {
    try {
        JRDesignStyle detailShortStyle = new JRDesignStyle();
        detailShortStyle.setName(STYLES.DETAIL_SHORT_STYLE);
        detailShortStyle.setFontSize(detailFontSize);
        detailShortStyle.setForecolor(new Color(0x39, 0x3B, 0x40));
        JRDesignConditionalStyle conditionalStyle = new JRDesignConditionalStyle();
        conditionalStyle.setForecolor(new Color(0xBF, 0x21, 0x28));
        JRDesignExpression jDesignExpression = new JRDesignExpression();
        String committedDateConflict = TReportLayoutBean.PSEUDO_COLUMN_NAMES.COMMITTED_DATE_CONFLICT;
        String targetDateConflict = TReportLayoutBean.PSEUDO_COLUMN_NAMES.TARGET_DATE_CONFLICT;
        String plannedValueConflict = TReportLayoutBean.PSEUDO_COLUMN_NAMES.PLANNED_VALUE_CONFLICT;
        String bugdetConflict = TReportLayoutBean.PSEUDO_COLUMN_NAMES.BUDGET_CONFLICT;
        String statusFlag = TReportLayoutBean.PSEUDO_COLUMN_NAMES.STATUS_FLAG;
        String archiveLevel = TReportLayoutBean.PSEUDO_COLUMN_NAMES.ARCHIVE_LEVEL;
        jDesignExpression.setText("new Boolean((" + getConflictExpression(committedDateConflict, targetDateConflict, true) + " || "
                + getConflictExpression(plannedValueConflict, bugdetConflict, true) + ") && $F{" + statusFlag + "}.intValue()!="
                + TStateBean.STATEFLAGS.CLOSED + " && ($F{" + archiveLevel + "}==null || " + "$F{" + archiveLevel + "}.intValue()=="
                + TWorkItemBean.ARCHIVE_LEVEL_UNARCHIVED.intValue() + "))");
        conditionalStyle.setConditionExpression(jDesignExpression);
        detailShortStyle.addConditionalStyle(conditionalStyle);
        jasperDesign.addStyle(detailShortStyle);

        JRDesignStyle detailLongStyle = new JRDesignStyle();
        detailLongStyle.setName(STYLES.DETAIL_LONG_STYLE);
        detailLongStyle.setFontSize(detailFontSize);
        jasperDesign.addStyle(detailLongStyle);

        JRDesignStyle groupStyle = new JRDesignStyle();
        groupStyle.setName(STYLES.GROUP_STYLE);
        groupStyle.setFontSize(groupFontSize);
        if (!isGrid) {
            groupStyle.getLinePen().setLineWidth(1);
            groupStyle.setBackcolor(new Color(0x99, 0x99, 0x99));
            groupStyle.setMode(ModeEnum.OPAQUE);
        }
        jasperDesign.addStyle(groupStyle);

        JRDesignStyle headerStyle = new JRDesignStyle();
        headerStyle.setName(STYLES.PAGE_HEADER_STYLE);
        headerStyle.setFontSize(pageHeaderFontSize);
        headerStyle.setBold(true);
        if (!isGrid) {
            headerStyle.setBackcolor(new Color(0xCC, 0xCC, 0xCC));
            headerStyle.setMode(ModeEnum.OPAQUE);
        }
        jasperDesign.addStyle(headerStyle);
    } catch (Exception e) {
        LOGGER.error("Adding the JRDesignStyles failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
}
项目:ireport-fork    文件:ConditionalStyleNode.java   
public JRDesignConditionalStyle getConditionalStyle()
{
    return (JRDesignConditionalStyle)getStyle();
}
项目:ireport-fork    文件:ConditionalStyleNode.java   
public JRDesignConditionalStyle getConditionalStyle() {
    return conditionalStyle;
}
项目:ireport-fork    文件:ConditionalStyleChildren.java   
public JRDesignConditionalStyle getStyle() {
    return style;
}
项目:ireport-fork    文件:ConditionalStyleChildren.java   
public void setStyle(JRDesignConditionalStyle style) {
    this.style = style;
}
项目:PDFReporter-Studio    文件:StyleConditionalSection.java   
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    parent.setLayout(new GridLayout(2, false));

    createWidget4Property(parent, JRDesignConditionalStyle.PROPERTY_CONDITION_EXPRESSION);
}
项目:PDFReporter-Studio    文件:CreateConditionalStyleCommand.java   
/**
 * Instantiates a new creates the conditional style command.
 * 
 * @param destNode
 *          the dest node
 * @param srcNode
 *          the src node
 * @param index
 *          the index
 */
public CreateConditionalStyleCommand(MStyle destNode, MConditionalStyle srcNode, int index) {
    super();
    this.index = index;
    this.jrStyle = (JRDesignStyle) destNode.getValue();
    if (srcNode != null && srcNode.getValue() != null) {
        srcNode.setParent(destNode, -1);
        this.jrConditionalStyle = (JRDesignConditionalStyle) srcNode.getValue();
    }
}
项目:PDFReporter-Studio    文件:ReorderConditionalStyleCommand.java   
/**
 * Instantiates a new reorder conditional style command.
 * 
 * @param child
 *          the child
 * @param parent
 *          the parent
 * @param newIndex
 *          the new index
 */
public ReorderConditionalStyleCommand(MConditionalStyle child, MStyle parent, int newIndex) {
    super(Messages.common_reorder_elements);
    this.newIndex = Math.max(0, newIndex);
    this.jrStyle = (JRDesignStyle) parent.getValue();
    this.jrConditionalStyle = (JRDesignConditionalStyle) child.getValue();
}
项目:PDFReporter-Studio    文件:MConditionalStyle.java   
/**
 * Instantiates a new m conditional style.
 * 
 * @param parent
 *          the parent
 * @param jrstyle
 *          the jrstyle
 * @param newIndex
 *          the new index
 */
public MConditionalStyle(ANode parent, JRDesignConditionalStyle jrstyle, int newIndex) {
    super(parent, newIndex);
    setValue(jrstyle);
}
项目:PDFReporter-Studio    文件:MConditionalStyle.java   
/**
 * Creates the jr style.
 * 
 * @return the jR design conditional style
 */
public static JRDesignConditionalStyle createJRStyle() {
    JRDesignConditionalStyle jrDesignConditionalStyle = new JRDesignConditionalStyle();
    return jrDesignConditionalStyle;
}
项目:PDFReporter-Studio    文件:DeleteConditionalStyleCommand.java   
/**
 * Instantiates a new delete conditional style command.
 * 
 * @param destNode
 *          the dest node
 * @param srcNode
 *          the src node
 */
public DeleteConditionalStyleCommand(MStyle destNode, MConditionalStyle srcNode) {
    super();
    this.jrStyle = (JRDesignStyle) destNode.getValue();
    this.jrConditionalStyle = (JRDesignConditionalStyle) srcNode.getValue();
}
项目:PDFReporter-Studio    文件:OrphanConditionalStyleCommand.java   
/**
 * Instantiates a new orphan conditional style command.
 * 
 * @param parent
 *          the parent
 * @param child
 *          the child
 */
public OrphanConditionalStyleCommand(MStyle parent, MConditionalStyle child) {
    super(Messages.common_orphan_child);
    this.jrStyle = (JRDesignStyle) parent.getValue();
    this.jrConditionalStyle = (JRDesignConditionalStyle) child.getValue();
}
项目:ireport-fork    文件:StyleChildren.java   
/**
 * This method assumes that all the keys are JRDesignConditionalStyle.
 * 
 * @param key
 * @return
 */
protected Node[] createNodes(Object key) {

    return new Node[]{new ConditionalStyleNode(jd, (JRDesignConditionalStyle)key, doLkp, getStyle())};
}