Java 类net.sf.jasperreports.engine.base.JRBasePen 实例源码

项目:PDFReporter-Studio    文件:BordersSection.java   
/**
 * Update the right panel with the value of a linepen, but only if it's visible
 * @param lb
 * @param property
 */
public void refreshLinePen(MLineBox lb, String property) {
    if (lb != null) {
        MLinePen lp = (MLinePen) lb.getPropertyActualValue(property);
        Float propertyValue = (Float) lp.getPropertyActualValue(JRBasePen.PROPERTY_LINE_WIDTH);
        if (propertyValue>0){
            //Set the border data only if it is visible
            if (lineWidth != null && !lineWidth.isDisposed()) {
                UIUtil.setSpinnerSelection(lineWidth, null, (int) ((propertyValue == null) ? 0 : propertyValue.doubleValue()* Math.pow(10, 1)));
            }

            if (lineStyle != null && !isDisposed()) {
                int ls = ((Integer) lp.getPropertyActualValue(JRBasePen.PROPERTY_LINE_STYLE)).intValue();
                lineStyle.setData(ls);
            }

            AlfaRGB backcolor = (AlfaRGB) lp.getPropertyActualValue(JRBasePen.PROPERTY_LINE_COLOR);
            if (lineColor != null){
                lineColor.setColor(backcolor);
            }
        }
    }
}
项目:PDFReporter-Studio    文件:LinePenSection.java   
/**
 * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
 *      org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
 */
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

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

    Group panel = new Group(parent, SWT.NONE);
    panel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    panel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    panel.setLayout(new GridLayout(2,false));
    panel.setText(Messages.LinePenSection_lineSectionName);

    createWidget4Property(panel, JRBasePen.PROPERTY_LINE_COLOR);
    createWidget4Property(panel, JRBasePen.PROPERTY_LINE_STYLE);
    createWidget4Property(panel, JRBasePen.PROPERTY_LINE_WIDTH);
}
项目:PDFReporter-Studio    文件:MLinePen.java   
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
    // pen
    ColorPropertyDescriptor penLineColorD = new ColorPropertyDescriptor(JRBasePen.PROPERTY_LINE_COLOR,
            Messages.common_line_color, NullEnum.INHERITED);
    penLineColorD.setDescription(Messages.MLinePen_line_color_description);
    penLineColorD.setHelpRefBuilder(new HelpReferenceBuilder("net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#pen_lineColor"));
    desc.add(penLineColorD);

    FloatPropertyDescriptor penLineWidthD = new FloatPropertyDescriptor(JRBasePen.PROPERTY_LINE_WIDTH,
            Messages.MLinePen_line_width);
    penLineWidthD.setDescription(Messages.MLinePen_line_width_description);
    penLineWidthD.setHelpRefBuilder(new HelpReferenceBuilder("net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#pen_lineWidth"));
    desc.add(penLineWidthD);

    penLineStyleD = new JSSPopupPropertyDescriptor(JRBasePen.PROPERTY_LINE_STYLE, Messages.common_line_style,
            LineStyleEnum.class, NullEnum.INHERITED, createLineSpacingItems());
    penLineStyleD.setDescription(Messages.MLinePen_line_style_description);
    penLineStyleD.setHelpRefBuilder(new HelpReferenceBuilder("net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#pen_lineStyle"));
    desc.add(penLineStyleD);

    defaultsMap.put(JRBasePen.PROPERTY_LINE_STYLE, null);
    defaultsMap.put(JRBasePen.PROPERTY_LINE_COLOR, null);
    defaultsMap.put(JRBasePen.PROPERTY_LINE_WIDTH, null);
}
项目:PDFReporter-Studio    文件:BordersWidget.java   
/**
 * Create the line style combo popup
 * @param prop properties associated to the combo popup
 * @param composite parent where the combo will be placed
 */
private void createLineStyle(final Composite composite) {
    List<ComboItem> itemsList = new ArrayList<ComboItem>();
    //A blank space is added at the end of the string to compensate the size enlargement because a selected element is in bold
    itemsList.add(new ComboItem("Inherited ", true,  ResourceManager.getImage(this.getClass(), "/icons/resources/inherited.png"),0, NullEnum.INHERITED, null));
    itemsList.add(new ComboItem("Solid line ", true, ResourceManager.getImage(this.getClass(), "/icons/resources/line-solid.png"),1, LineStyleEnum.SOLID, new Integer(LineStyleEnum.SOLID.getValue() + 1)));
    itemsList.add(new ComboItem("Dashed line ", true,  ResourceManager.getImage(this.getClass(), "/icons/resources/line-dashed.png"),2, LineStyleEnum.DASHED, new Integer(LineStyleEnum.DASHED.getValue() + 1)));
    itemsList.add(new ComboItem("Dotted line ", true,  ResourceManager.getImage(this.getClass(), "/icons/resources/line-dotted.png"),3, LineStyleEnum.DOTTED, new Integer(LineStyleEnum.DOTTED.getValue() + 1)));
    itemsList.add(new ComboItem("Double line ", true,  ResourceManager.getImage(this.getClass(), "/icons/resources/line-double.png"),4, LineStyleEnum.DOUBLE, new Integer(LineStyleEnum.DOUBLE.getValue() + 1)));
    //Creating the combo popup
    lineStyle = new ComboMenuViewer(composite, SWT.NORMAL, SPRWPopUpCombo.getLongest(itemsList));
    lineStyle.setItems(itemsList);
    lineStyle.addSelectionListener(new ComboItemAction() {
            /**
             * The action to execute when an entry is selected
             */
            @Override
            public void exec() {
                    changeProperty(JRBasePen.PROPERTY_LINE_STYLE, lineStyle.getSelectionValue() != null ? (Integer)lineStyle.getSelectionValue() : null);           
                    callListeners(lineStyle.getControl(), JRBasePen.PROPERTY_LINE_STYLE);
            }
    });
    lineStyle.select(1);
}
项目:ireport-fork    文件:AbstractStyleNode.java   
private void init()
{
    setDisplayName ( style.getName());
    super.setName( style.getName() );
    setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/style-16.png");

    style.getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)style.getLinePen()).getEventSupport().addPropertyChangeListener(this);

    JRBaseLineBox baseBox = (JRBaseLineBox)style.getLineBox();
    baseBox.getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getTopPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getBottomPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getLeftPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getRightPen()).getEventSupport().addPropertyChangeListener(this);

    ((JRBaseParagraph)style.getParagraph()).getEventSupport().addPropertyChangeListener(this);
}
项目:ireport-fork    文件:StyleNode.java   
private void init()
{
    setDisplayName ( style.getName());
    super.setName( style.getName() );
    setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/style-16.png");

    style.getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)style.getLinePen()).getEventSupport().addPropertyChangeListener(this);

    JRBaseLineBox baseBox = (JRBaseLineBox)style.getLineBox();
    baseBox.getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getTopPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getBottomPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getLeftPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getRightPen()).getEventSupport().addPropertyChangeListener(this);

    ((JRBaseParagraph)style.getParagraph()).getEventSupport().addPropertyChangeListener(this);
}
项目:jasperreports    文件:JRDesignGraphicElement.java   
/**
 *
 */
protected JRDesignGraphicElement(JRDefaultStyleProvider defaultStyleProvider)
{
    super(defaultStyleProvider);

    linePen = new JRBasePen(this);
}
项目:jasperreports    文件:JRTemplateRectangle.java   
/**
 *
 */
protected void setSubreport(JRSubreport subreport)
{
    super.setElement(subreport);

    // don't want to inherit mode because of different defaults for rectangles and subreports
    setMode(subreport.getModeValue());

    linePen = new JRBasePen(this);

    getLinePen().setLineWidth(0f);
    setFill(FillEnum.SOLID);
}
项目:jasperreports    文件:JRTemplateImage.java   
/**
 * Creates a template image.
 * 
 * @param origin the origin of the elements that will use this template
 * @param defaultStyleProvider the default style provider to use for
 * this template
 */
public JRTemplateImage(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider)
{
    super(origin, defaultStyleProvider);

    this.lineBox = new JRBaseLineBox(this);
    this.linePen = new JRBasePen(this);
}
项目:jasperreports    文件:JRTemplateImage.java   
/**
 *
 */
protected void setChart(JRChart chart)
{
    super.setElement(chart);

    linePen = new JRBasePen(this);

    getLinePen().setLineWidth(0f);
    setFill(FillEnum.SOLID);

    copyLineBox(chart.getLineBox());

    setLinkType(chart.getLinkType());
    setLinkTarget(chart.getLinkTarget());
}
项目:PDFReporter-Studio    文件:SPLineStyleEnum.java   
/**
 * Create the component and initialize the combo popup with the necessary value
 * @param parent composite where the combo popup is palced
 * @param section section that contains the property that this combo will change when an entry is selected
 * @param property id of the property that this combo will change when an entry is selected
 */
public void createComponent(Composite parent, final AbstractSection section, final String property) {
    Composite composite = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout();
    layout.marginLeft = 0;
    composite.setLayout(layout);
    //Creating the list of entry
    List<ComboItem> itemsList = new ArrayList<ComboItem>();
    //A blank space is added at the end of the string to compensate the size enlargement because a selected element is in bold
    itemsList.add(new ComboItem("Inherited ", true,  ResourceManager.getImage(this.getClass(), "/icons/resources/inherited.png"),0, NullEnum.INHERITED, null));
    itemsList.add(new ComboItem("Solid line ", true, ResourceManager.getImage(this.getClass(), "/icons/resources/line-solid.png"),1, LineStyleEnum.SOLID, new Integer(LineStyleEnum.SOLID.getValue() + 1)));
    itemsList.add(new ComboItem("Dashed line ", true,  ResourceManager.getImage(this.getClass(), "/icons/resources/line-dashed.png"),2, LineStyleEnum.DASHED, new Integer(LineStyleEnum.DASHED.getValue() + 1)));
    itemsList.add(new ComboItem("Dotted line ", true,  ResourceManager.getImage(this.getClass(), "/icons/resources/line-dotted.png"),3, LineStyleEnum.DOTTED, new Integer(LineStyleEnum.DOTTED.getValue() + 1)));
    itemsList.add(new ComboItem("Double line ", true,  ResourceManager.getImage(this.getClass(), "/icons/resources/line-double.png"),4, LineStyleEnum.DOUBLE, new Integer(LineStyleEnum.DOUBLE.getValue() + 1)));
    //Creating the combo popup
    combo = new ComboMenuViewer(composite, SWT.NORMAL, SPRWPopUpCombo.getLongest(itemsList));
    combo.setItems(itemsList);
    combo.addSelectionListener(new ComboItemAction() {
            /**
             * The action to execute when an entry is selected
             */
            @Override
            public void exec() {
                    propertyChange(section,JRBasePen.PROPERTY_LINE_STYLE, combo.getSelectionValue() != null ? (Integer)combo.getSelectionValue() : null);           
            }
    });
}
项目:PDFReporter-Studio    文件:BordersSection.java   
@Override
protected void initializeProvidedProperties() {
    super.initializeProvidedProperties();
    addProvidedProperties(JRBaseLineBox.PROPERTY_PADDING, Messages.BordersSection_Padding_Box_Title);
    addProvidedProperties(JRBaseLineBox.PROPERTY_LEFT_PADDING, Messages.BordersSection_Left_Label);
    addProvidedProperties(JRBaseLineBox.PROPERTY_RIGHT_PADDING, Messages.common_right);
    addProvidedProperties(JRBaseLineBox.PROPERTY_TOP_PADDING, Messages.BordersSection_Top_Label);
    addProvidedProperties(JRBaseLineBox.PROPERTY_BOTTOM_PADDING, Messages.common_bottom);
    addProvidedProperties(JRBasePen.PROPERTY_LINE_COLOR, Messages.common_pen_color);
    addProvidedProperties(JRBasePen.PROPERTY_LINE_WIDTH, Messages.common_pen_width);
    addProvidedProperties(JRBasePen.PROPERTY_LINE_STYLE, Messages.common_pen_style);
    addProvidedProperties("BordersDefinitionGroup", Messages.common_borders);
}
项目:PDFReporter-Studio    文件:BordersSection.java   
public IHighlightPropertyWidget getWidgetForProperty(Object propertyId){
    if (propertyId.equals(JRBaseLineBox.PROPERTY_PADDING)) return new ASHighlightControl(checkBoxPadding.getParent(), new BorderHightLight(checkBoxPadding.getParent(), Composite.class));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_LEFT_PADDING)) return new ASHighlightControl(paddingLeft, new BackgroundHighlight(paddingLeft));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_RIGHT_PADDING)) return new ASHighlightControl(paddingRight, new BackgroundHighlight(paddingRight));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_TOP_PADDING)) return new ASHighlightControl(paddingTop, new BackgroundHighlight(paddingTop));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING)) return new ASHighlightControl(paddingBottom, new BackgroundHighlight(paddingBottom));
    else if (propertyId.equals(JRBasePen.PROPERTY_LINE_COLOR)) return new ASHighlightControl(lineColor.getPaintArea(), new BackgroundHighlight(lineColor.getPaintArea()));
    else if (propertyId.equals(JRBasePen.PROPERTY_LINE_WIDTH)) return new ASHighlightControl(lineWidth, new BackgroundHighlight(lineWidth));
    else if (propertyId.equals(JRBasePen.PROPERTY_LINE_STYLE)) return new ASHighlightControl(lineStyle.getControl(), new BackgroundHighlight(lineStyle.getControl()));
    else if (propertyId.equals("BordersDefinitionGroup")) return new ASHighlightControl(rightPanel, new BorderHightLight(rightPanel, Composite.class));
    return null;
}
项目:PDFReporter-Studio    文件:LinePenSection.java   
@Override
protected void initializeProvidedProperties() {
    super.initializeProvidedProperties();
    addProvidedProperties(JRBasePen.PROPERTY_LINE_COLOR, Messages.common_line_color);
    addProvidedProperties(JRBasePen.PROPERTY_LINE_STYLE, Messages.common_line_style);
    addProvidedProperties(JRBasePen.PROPERTY_LINE_WIDTH, Messages.MLinePen_line_width);
}
项目:PDFReporter-Studio    文件:MGraphicElementLinePen.java   
/**
 * Return the graphical properties for an MGraphicalElementLinePen 
 */
public HashSet<String> generateGraphicalProperties(){
    HashSet<String> result = super.generateGraphicalProperties();
    result.add(JRBasePen.PROPERTY_LINE_COLOR);
    result.add(JRBasePen.PROPERTY_LINE_STYLE);
    result.add(JRBasePen.PROPERTY_LINE_WIDTH);
    return result;
}
项目:PDFReporter-Studio    文件:MGraphicElement.java   
@Override
public void setValue(Object value) {
    if (getValue() != null && getValue() instanceof JRDesignGraphicElement)
        ((JRBasePen) ((JRDesignGraphicElement) getValue()).getLinePen()).getEventSupport().removePropertyChangeListener(
                this);
    else if (value != null && value instanceof JRDesignGraphicElement)
        ((JRBasePen) ((JRDesignGraphicElement) value).getLinePen()).getEventSupport().addPropertyChangeListener(this);
    super.setValue(value);
}
项目:PDFReporter-Studio    文件:MGraphicElementLineBox.java   
/**
 * Return the graphical properties for an MGraphicalElementLineBox
 */
public HashSet<String> generateGraphicalProperties(){
    HashSet<String> result = super.generateGraphicalProperties();
    result.add(JRBaseLineBox.PROPERTY_BOTTOM_PADDING);
    result.add(JRBaseLineBox.PROPERTY_LEFT_PADDING);
    result.add(JRBaseLineBox.PROPERTY_PADDING);
    result.add(JRBaseLineBox.PROPERTY_RIGHT_PADDING);
    result.add(JRBaseLineBox.PROPERTY_TOP_PADDING);
    result.add(JRBasePen.PROPERTY_LINE_COLOR);
    result.add(JRBasePen.PROPERTY_LINE_STYLE);
    result.add(JRBasePen.PROPERTY_LINE_WIDTH);
    return result;
}
项目:PDFReporter-Studio    文件:MLinePen.java   
@Override
public HashMap<String,Object> getStylesDescriptors() {
    HashMap<String, Object> result = new HashMap<String, Object>();
    if (getValue() == null)
        return result;
    JRBasePen element = (JRBasePen) getValue();
    result.put(JRBasePen.PROPERTY_LINE_COLOR, element.getOwnLineColor());
    result.put(JRBasePen.PROPERTY_LINE_STYLE, element.getOwnLineStyleValue());
    result.put(JRBasePen.PROPERTY_LINE_WIDTH, element.getOwnLineWidth());
    return result;
}
项目:PDFReporter-Studio    文件:MLinePen.java   
public Object getPropertyValue(Object id) {
    // pen
    JRPen linePen = (JRPen) getValue();
    if (linePen != null) {
        if (id.equals(JRBasePen.PROPERTY_LINE_COLOR))
            return Colors.getSWTRGB4AWTGBColor(linePen.getOwnLineColor());
        if (id.equals(JRBasePen.PROPERTY_LINE_WIDTH))
            return linePen.getOwnLineWidth();
        if (id.equals(JRBasePen.PROPERTY_LINE_STYLE))
            return penLineStyleD.getEnumValue(linePen.getOwnLineStyleValue());
    }
    return null;
}
项目:PDFReporter-Studio    文件:MLinePen.java   
public Object getPropertyActualValue(Object id) {
    // pen
    JRPen linePen = (JRPen) getValue();
    if (linePen != null) {
        if (id.equals(JRBasePen.PROPERTY_LINE_COLOR))
            return Colors.getSWTRGB4AWTGBColor(linePen.getLineColor());
        if (id.equals(JRBasePen.PROPERTY_LINE_WIDTH))
            return linePen.getLineWidth();
        if (id.equals(JRBasePen.PROPERTY_LINE_STYLE))
            return penLineStyleD.getEnumValue(linePen.getLineStyleValue());
    }
    return null;
}
项目:PDFReporter-Studio    文件:MLinePen.java   
public void setPropertyValue(Object id, Object value) {
    JRPen linePen = (JRPen) getValue();
    if (linePen != null) {
        if (id.equals(JRBasePen.PROPERTY_LINE_WIDTH))
            linePen.setLineWidth(((Float) value));
        else if (id.equals(JRBasePen.PROPERTY_LINE_COLOR)) {
            if (value == null)
                linePen.setLineColor(null);
            else if (value instanceof AlfaRGB)
                linePen.setLineColor(Colors.getAWT4SWTRGBColor((AlfaRGB) value));
        } else if (id.equals(JRBasePen.PROPERTY_LINE_STYLE))
            linePen.setLineStyle((LineStyleEnum) penLineStyleD.getEnumValue(value));
    }
}
项目:PDFReporter-Studio    文件:BordersWidget.java   
/**
 * Set a property of a JRBoxPen element
 * 
 * @param pen the element
 * @param property the id of the property to set
 * @param value the value of the property
 */
private void setLinePenAttribute(JRBoxPen pen, String property, Object value){
    if (JRBasePen.PROPERTY_LINE_STYLE.equals(property)) pen.setLineStyle(intToLinestyleEnum((Integer)value));
    else if (JRBasePen.PROPERTY_LINE_COLOR.equals(property)) {
        AlfaRGB argbColor = (AlfaRGB) value;
        pen.setLineColor(new Color(argbColor.getRgb().red,argbColor.getRgb().green,argbColor.getRgb().blue,argbColor.getAlfa()));
    } else if (JRBasePen.PROPERTY_LINE_WIDTH.equals(property)) pen.setLineWidth((Float)value); 
}
项目:PDFReporter-Studio    文件:BorderContributionItem.java   
/**
 * For an element change all the properties related to the border: color, style and width
 * @param cc CommandCompound where all the command to change a single property are putted
 * @param selectedElement selected preset
 * @param lp element to change
 */
private void changeAllProperties(JSSCompoundCommand cc, TemplateBorder selectedElement, MLinePen lp){
    Command c = getChangePropertyCommand(JRBasePen.PROPERTY_LINE_COLOR, new AlfaRGB(selectedElement.getColor(),255), lp);
    if (c != null) cc.add(c);
    c = getChangePropertyCommand(JRBasePen.PROPERTY_LINE_STYLE, selectedElement.getStyle(), lp);
    if (c != null) cc.add(c);
    c = getChangePropertyCommand(JRBasePen.PROPERTY_LINE_WIDTH, selectedElement.getLineWidth(), lp);
    if (c != null) cc.add(c);
}
项目:PDFReporter-Studio    文件:BorderContributionItem.java   
private TemplateBorder getElementAttribute(String position, MLineBox lb){
    MLinePen lp = (MLinePen) lb.getPropertyValue(position);
    Integer lineStyleNum = ((Integer)lp.getPropertyValue(JRBasePen.PROPERTY_LINE_STYLE))-1;
    LineStyleEnum lineStyle = LineStyleEnum.getByValue(lineStyleNum.byteValue());
    Float lineWidth = (Float)lp.getPropertyValue(JRBasePen.PROPERTY_LINE_WIDTH);
    AlfaRGB lineColor = (AlfaRGB)lp.getPropertyValue(JRBasePen.PROPERTY_LINE_COLOR);
    TemplateBorder result =  new TemplateBorder(lineWidth, lineStyle, lineColor != null ? lineColor.getRgb() : null);
    return result;
}
项目:ireport-fork    文件:ElementNode.java   
public ElementNode(JasperDesign jd, JRDesignElement element, Children children, Index index, Lookup doLkp)
{
    super (children, index, new ProxyLookup( doLkp, Lookups.fixed(jd,element)));
    elemenNameVisitor = new ElementNameVisitor(jd);
    this.jd = jd;
    this.element = element;

    element.getEventSupport().addPropertyChangeListener(this);

    IReportManager.getPreferences().addPreferenceChangeListener(new WeakPreferenceChangeListener(this,IReportManager.getInstance().getPreferences()));

    if (element instanceof JRDesignGraphicElement)
    {
        JRDesignGraphicElement gele = (JRDesignGraphicElement)element;
        ((JRBasePen)gele.getLinePen()).getEventSupport().addPropertyChangeListener(this);
    }

    if (element instanceof JRBoxContainer)
    {
        JRBoxContainer boxcontainer = (JRBoxContainer)element;
        JRBaseLineBox baseBox = (JRBaseLineBox)boxcontainer.getLineBox();
        baseBox.getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getTopPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getBottomPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getLeftPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getRightPen()).getEventSupport().addPropertyChangeListener(this);
    }

    if (element instanceof JRDesignTextElement)
    {
        ((JRBaseParagraph)((JRDesignTextElement)element).getParagraph()).getEventSupport().addPropertyChangeListener(this);

    }

}
项目:ireport-fork    文件:JRDesignImageWidget.java   
@Override
public void propertyChange(PropertyChangeEvent evt) {

    String propertyName = evt.getPropertyName();
    if (propertyName == null) return;

    if (propertyName.equals( JRDesignElement.PROPERTY_HEIGHT) ||
        propertyName.equals( JRDesignElement.PROPERTY_WIDTH) ||
        propertyName.equals( JRBaseStyle.PROPERTY_BACKCOLOR) ||
        propertyName.equals( JRBaseStyle.PROPERTY_FORECOLOR) ||
        propertyName.equals( JRDesignElement.PROPERTY_PARENT_STYLE) ||
        propertyName.equals( JRDesignElement.PROPERTY_PARENT_STYLE_NAME_REFERENCE) ||
        propertyName.equals( JRBaseStyle.PROPERTY_MODE ) ||
        //FIXME propertyName.equals( JRDesignGraphicElement.PROPERTY_PEN) ||
        propertyName.equals( JRBaseStyle.PROPERTY_FILL) ||
        propertyName.equals( JRBaseStyle.PROPERTY_HORIZONTAL_ALIGNMENT) ||
        propertyName.equals( JRBaseStyle.PROPERTY_VERTICAL_ALIGNMENT) ||
        propertyName.equals( JRBaseStyle.PROPERTY_SCALE_IMAGE) ||
        propertyName.equals( JRDesignTextField.PROPERTY_EXPRESSION) ||
        propertyName.equals("pen") ||           // Special property fired by the property sheet
        propertyName.equals("linebox") ||       // Special property fired by the property sheet
        propertyName.equals(JRBasePen.PROPERTY_LINE_COLOR) ||
        propertyName.equals(JRBasePen.PROPERTY_LINE_STYLE) ||
        propertyName.equals(JRBasePen.PROPERTY_LINE_WIDTH) ||
        propertyName.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
        propertyName.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
        propertyName.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
        propertyName.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING)
        )
    {
        // Schedule a repoaint in 3 secs...
        if (running) return;
        Thread t = new Thread(this);
        t.start();
    }

    super.propertyChange(evt);
}
项目:ireport-fork    文件:AbstractPenProperty.java   
public JRPen getPen() 
{
    JRPen pen = new JRBasePen(this);

    if (
        getPaintProvider() != null
        && getStroke() != null
        )
    {
        ColorProvider colorProvider = 
            getPaintProvider() instanceof ColorProvider
            ? (ColorProvider)getPaintProvider()
            : null;
        if (colorProvider != null)
        {
            pen.setLineColor(colorProvider.getColor());
        }
        BasicStroke basicStroke = 
            getStroke() instanceof BasicStroke
            ? (BasicStroke)getStroke()
            : null;
        if (basicStroke != null)
        {
            setToPen(basicStroke, pen);
        }
    }

    return pen;
}
项目:PDFReporter-Studio    文件:DefaultValuesMap.java   
private static MLinePen createBaseLinePen(final Object item){
    return  new MLinePen(null){
        private static final long serialVersionUID = 1L;
        @Override
        public HashMap<String,Object> getStylesDescriptors() {
            HashMap<String, Object> result = new HashMap<String, Object>();
            if (item instanceof MGraphicElementLinePen){
                result.put(JRBasePen.PROPERTY_LINE_COLOR, Color.black);
                result.put(JRBasePen.PROPERTY_LINE_STYLE,LineStyleEnum.SOLID);
                result.put(JRBasePen.PROPERTY_LINE_WIDTH,JRPen.LINE_WIDTH_1);
            } else if (item instanceof MLineBox){
                result.put(JRBasePen.PROPERTY_LINE_COLOR, Color.black);
                result.put(JRBasePen.PROPERTY_LINE_STYLE,LineStyleEnum.SOLID);
                result.put(JRBasePen.PROPERTY_LINE_WIDTH,JRPen.LINE_WIDTH_0);
            } else {
                result.put(JRBasePen.PROPERTY_LINE_COLOR, null);
                result.put(JRBasePen.PROPERTY_LINE_STYLE,null);
                result.put(JRBasePen.PROPERTY_LINE_WIDTH,null);
            }
            return result;
        }
        @Override
        public IPropertyDescriptor getPropertyDescriptor(Object id) {
            if (id.equals(JRBasePen.PROPERTY_LINE_COLOR)){
                ColorPropertyDescriptor penLineColorD = new ColorPropertyDescriptor(JRBasePen.PROPERTY_LINE_COLOR,
                        Messages.common_line_color, NullEnum.INHERITED);
                penLineColorD.setDescription(Messages.MLinePen_line_color_description);
                return penLineColorD;
            } else if (id.equals(JRBasePen.PROPERTY_LINE_STYLE)){
                LineStylePropertyDescriptor penLineStyleD = new LineStylePropertyDescriptor(JRBasePen.PROPERTY_LINE_STYLE, Messages.common_line_style,
                        LineStyleEnum.class, NullEnum.INHERITED);
                penLineStyleD.setDescription(Messages.MLinePen_line_style_description);
                return penLineStyleD;
            } else  if (id.equals(JRBasePen.PROPERTY_LINE_WIDTH)){
                FloatPropertyDescriptor penLineWidthD = new FloatPropertyDescriptor(JRBasePen.PROPERTY_LINE_WIDTH,
                        Messages.MLinePen_line_width);
                penLineWidthD.setDescription(Messages.MLinePen_line_width_description);
                return penLineWidthD;
            } else return null; 
        }

    };
}
项目:PDFReporter-Studio    文件:DefaultValuesMap.java   
/**
 * Create the default property map for a wide range of object
 * @param type the type of the element for which the properties are requested
 * @return the default properties of the requested element
 */
@SuppressWarnings("deprecation")
private static HashMap<String, Object> initializeType(Object type){
    HashMap<String, Object> result = new HashMap<String, Object>();
    result.put(JRDesignStyle.PROPERTY_FONT_NAME, JRProperties.getProperty(JRFont.DEFAULT_FONT_NAME));
    result.put(JRBaseLineBox.PROPERTY_PADDING, INTEGER_ZERO);
    result.put(JRBaseLineBox.PROPERTY_TOP_PADDING, INTEGER_ZERO);
    result.put(JRBaseLineBox.PROPERTY_RIGHT_PADDING, INTEGER_ZERO);
    result.put(JRDesignStyle.PROPERTY_PDF_FONT_NAME, JRProperties.getProperty(JRFont.DEFAULT_PDF_FONT_NAME));
    result.put(JRDesignStyle.PROPERTY_PDF_ENCODING,JRProperties.getProperty(JRFont.DEFAULT_PDF_ENCODING));
    result.put(JRDesignStyle.PROPERTY_PATTERN, null);
    result.put(JRDesignStyle.PROPERTY_MARKUP,JRCommonText.MARKUP_NONE);
    result.put(JRBasePen.PROPERTY_LINE_STYLE, LineStyleEnum.SOLID);

    if (type instanceof JRStyle){

        result.put(JRDesignStyle.PROPERTY_FONT_SIZE, null);
        result.put(JRDesignStyle.PROPERTY_BOLD, null);
        result.put(JRDesignStyle.PROPERTY_ITALIC, null);
        result.put(JRDesignStyle.PROPERTY_UNDERLINE, null);
        result.put(JRDesignStyle.PROPERTY_STRIKE_THROUGH, null);
        result.put(JRDesignStyle.PROPERTY_PDF_EMBEDDED,null);
        result.put(JRDesignStyle.PROPERTY_BLANK_WHEN_NULL,null);
        result.put(JRDesignStyle.PROPERTY_VERTICAL_ALIGNMENT,null);
        result.put(JRDesignStyle.PROPERTY_HORIZONTAL_ALIGNMENT,null);
        result.put(JRDesignStyle.PROPERTY_SCALE_IMAGE,null);
        result.put(JRDesignStyle.PROPERTY_ROTATION,null);
        result.put(JRDesignStyle.PROPERTY_RADIUS,null);
        result.put(JRBasePen.PROPERTY_LINE_WIDTH, null);
        result.put(JRBasePen.PROPERTY_LINE_COLOR, null);
        result.put(JRDesignStyle.PROPERTY_BACKCOLOR, null);
        result.put(JRDesignStyle.PROPERTY_FORECOLOR, null);
        result.put(JRDesignStyle.PROPERTY_FILL, null);
        result.put(JRDesignStyle.PROPERTY_MODE, null);
    } else {
        result.put(JRDesignStyle.PROPERTY_FONT_SIZE, JRProperties.getIntegerProperty(JRFont.DEFAULT_FONT_SIZE));
        result.put(JRDesignStyle.PROPERTY_BOLD, false);
        result.put(JRDesignStyle.PROPERTY_ITALIC, false);
        result.put(JRDesignStyle.PROPERTY_UNDERLINE, false);
        result.put(JRDesignStyle.PROPERTY_STRIKE_THROUGH, false);
        result.put(JRDesignStyle.PROPERTY_PDF_EMBEDDED,JRProperties.getBooleanProperty(JRFont.DEFAULT_PDF_EMBEDDED));
        result.put(JRDesignStyle.PROPERTY_BLANK_WHEN_NULL,false);
        result.put(JRDesignStyle.PROPERTY_VERTICAL_ALIGNMENT,VerticalAlignEnum.TOP);
        result.put(JRDesignStyle.PROPERTY_HORIZONTAL_ALIGNMENT,HorizontalAlignEnum.LEFT);
        result.put(JRDesignStyle.PROPERTY_SCALE_IMAGE,ScaleImageEnum.RETAIN_SHAPE);
        result.put(JRDesignStyle.PROPERTY_ROTATION,RotationEnum.NONE);
        result.put(JRDesignStyle.PROPERTY_RADIUS,INTEGER_ZERO);
        result.put(JRBasePen.PROPERTY_LINE_WIDTH,JRPen.LINE_WIDTH_0);
        result.put(JRBasePen.PROPERTY_LINE_COLOR, Color.black);
        result.put(MGraphicElementLinePen.LINE_PEN, createBaseLinePen(type));
        result.put(MGraphicElementLineBox.LINE_BOX, createBaseLineBox(type));
        result.put(JRDesignStyle.PROPERTY_BACKCOLOR, Color.white);
        result.put(JRDesignStyle.PROPERTY_FORECOLOR, Color.black);
        result.put(JRDesignStyle.PROPERTY_FILL, FillEnum.SOLID);
        ModeEnum opaqueValue = ModeEnum.getByValue(ModeEnum.OPAQUE.getValue());
        ModeEnum transparentValue = ModeEnum.getByValue(ModeEnum.TRANSPARENT.getValue());
        if (type instanceof JRDesignTextElement){
            result.put(JRDesignStyle.PROPERTY_MODE, transparentValue);
        } else if (type instanceof JRTemplateElement){
            result.put(JRDesignStyle.PROPERTY_MODE, opaqueValue);
        } else if (type instanceof JRBaseElement) {
            result.put(JRDesignStyle.PROPERTY_MODE, opaqueValue);
        } else if (type instanceof JRBasePrintElement) {
            result.put(JRDesignStyle.PROPERTY_MODE, opaqueValue);
        } else if (type instanceof JRFillElement){
            result.put(JRDesignStyle.PROPERTY_MODE, opaqueValue);
        } else {
            result.put(JRDesignStyle.PROPERTY_MODE, transparentValue);
        }
    }
    return result;
}
项目:ireport-fork    文件:AbstractStyleNode.java   
public void propertyChange(PropertyChangeEvent evt) {

    com.jaspersoft.ireport.designer.IReportManager.getInstance().notifyReportChange();
    if (evt.getPropertyName() == null) return;
    if (evt.getPropertyName().equals( JRDesignStyle.PROPERTY_NAME ))
    {
        super.setName(getStyle().getName());
        this.setDisplayName(getStyle().getName());
    }
    else if (evt.getPropertyName().equals(JRBasePen.PROPERTY_LINE_COLOR) ||
             evt.getPropertyName().equals(JRBasePen.PROPERTY_LINE_STYLE) ||
             evt.getPropertyName().equals(JRBasePen.PROPERTY_LINE_WIDTH))
    {

        if (ModelUtils.containsProperty(this.getPropertySets(),"pen"))
        {
            this.firePropertyChange("pen", evt.getOldValue(), evt.getNewValue() );
        }

        if (ModelUtils.containsProperty(this.getPropertySets(),"linebox"))
        {
            this.firePropertyChange("linebox", evt.getOldValue(), evt.getNewValue() );
        }
    }
    else if (evt.getPropertyName().equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
             evt.getPropertyName().equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
             evt.getPropertyName().equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
             evt.getPropertyName().equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING))
    {
        if (ModelUtils.containsProperty(this.getPropertySets(),"linebox"))
        {
            this.firePropertyChange("linebox", evt.getOldValue(), evt.getNewValue() );
        }
    }

    // Update the sheet
    if (ModelUtils.containsProperty(this.getPropertySets(),evt.getPropertyName()))
    {
        this.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue() );
    }

}
项目:ireport-fork    文件:JRDesignElementWidget.java   
public JRDesignElementWidget(AbstractReportObjectScene scene, JRDesignElement element) {
    super(scene);
    this.element = element;
    setBorder(new SimpleLineBorder(this));
    updateBounds();

    try {
        if (crosstabImage == null) crosstabImage = new javax.swing.ImageIcon(getClass().getResource("/com/jaspersoft/ireport/designer/resources/crosstab-32.png"));
        if (subreportImage == null) subreportImage = new javax.swing.ImageIcon(getClass().getResource("/com/jaspersoft/ireport/designer/resources/subreport-32.png"));
        if (multiaxisImage == null) multiaxisImage = new javax.swing.ImageIcon(getClass().getResource("/com/jaspersoft/ireport/designer/resources/chartaxis-32.png"));
        if (genericElementImage == null) genericElementImage = new javax.swing.ImageIcon(getClass().getResource("/com/jaspersoft/ireport/designer/resources/genericelement-48.png"));
    } catch (Exception ex) {  }

    selectionWidget = new SelectionWidget(scene, this);
    notifyStateChanged(null, ObjectState.createNormal());
    selectionWidget.addDependency(new Dependency() {

        public void revalidateDependency() {
            //setPreferredLocation(selectionWidget.getPreferredLocation() );
            //setPreferredBounds(selectionWidget.getPreferredBounds());
            //System.out.println("Revaludated");
        }
    });

    element.getEventSupport().addPropertyChangeListener(this);

    if (element instanceof JRDesignGraphicElement)
    {
        JRDesignGraphicElement gele = (JRDesignGraphicElement)element;
        ((JRBasePen)gele.getLinePen()).getEventSupport().addPropertyChangeListener(this);
    }

    if (element instanceof JRBoxContainer)
    {
        JRBoxContainer boxcontainer = (JRBoxContainer)element;
        JRBaseLineBox baseBox = (JRBaseLineBox)boxcontainer.getLineBox();
        baseBox.getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getTopPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getBottomPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getLeftPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getRightPen()).getEventSupport().addPropertyChangeListener(this);
    }

    if (element instanceof JRDesignTextElement)
    {
        ((JRBaseParagraph)((JRDesignTextElement)element).getParagraph()).getEventSupport().addPropertyChangeListener(this);

    }
}
项目:ireport-fork    文件:StyleNode.java   
public void propertyChange(PropertyChangeEvent evt) {

        // Notify the change in the template...

        JRTXEditorSupport ed = getLookup().lookup(JRTXEditorSupport.class);
        if (ed != null) ed.notifyModelChangeToTheView();

        if (evt.getPropertyName() == null) return;
        if (evt.getPropertyName().equals( JRDesignStyle.PROPERTY_NAME ))
        {
            super.setName(getStyle().getName());
            this.setDisplayName(getStyle().getName());
        }
        else if (evt.getPropertyName().equals(JRBasePen.PROPERTY_LINE_COLOR) ||
                 evt.getPropertyName().equals(JRBasePen.PROPERTY_LINE_STYLE) ||
                 evt.getPropertyName().equals(JRBasePen.PROPERTY_LINE_WIDTH))
        {

            if (ModelUtils.containsProperty(this.getPropertySets(),"pen"))
            {
                this.firePropertyChange("pen", evt.getOldValue(), evt.getNewValue() );
            }

            if (ModelUtils.containsProperty(this.getPropertySets(),"linebox"))
            {
                this.firePropertyChange("linebox", evt.getOldValue(), evt.getNewValue() );
            }
        }
        else if (evt.getPropertyName().equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
                 evt.getPropertyName().equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
                 evt.getPropertyName().equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
                 evt.getPropertyName().equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING))
        {
            if (ModelUtils.containsProperty(this.getPropertySets(),"linebox"))
            {
                this.firePropertyChange("linebox", evt.getOldValue(), evt.getNewValue() );
            }
        }

        // Update the sheet
        this.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue() );
    }
项目:ireport-fork    文件:JRPenProperty.java   
@Override
public Object getDefaultValue() {
    return new JRBasePen(null);//FIXME this is dangerous. check it
}
项目:jasperreports    文件:JRTemplateLine.java   
/**
 * Creates a template line.
 * 
 * @param origin the origin of the elements that will use this template
 * @param defaultStyleProvider the default style provider to use for
 * this template
 */
public JRTemplateLine(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider)
{
    super(origin, defaultStyleProvider);

    this.linePen = new JRBasePen(this);
}
项目:jasperreports    文件:JRTemplateEllipse.java   
/**
 * Creates an ellipse template.
 * 
 * @param origin the origin of the elements that will use this template
 * @param defaultStyleProvider the default style provider to use for
 * this template
 */
public JRTemplateEllipse(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider)
{
    super(origin, defaultStyleProvider);

    this.linePen = new JRBasePen(this);
}
项目:jasperreports    文件:JRTemplateRectangle.java   
/**
 * Creates a template rectangle.
 * 
 * @param origin the origin of the elements that will use this template
 * @param defaultStyleProvider the default style provider to use for
 * this template
 */
public JRTemplateRectangle(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider)
{
    super(origin, defaultStyleProvider);

    this.linePen = new JRBasePen(this);
}