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

项目:jasperreports    文件:JRComponentRule.java   
@Override
public void end(String namespace, String name) throws JRException
{
    Object top = getDigester().peek();
    if (!(top instanceof Component))
    {
        throw 
            new JRException(
                EXCEPTION_MESSAGE_KEY_INVALID_INSTANCE,
                new Object[]{top.getClass().getName(), Component.class.getName()});
    }

    Component component = (Component) top;
    JRDesignComponentElement componentElement = (JRDesignComponentElement) getDigester().peek(1);
    String namespacePrefix = ((JRXmlDigester) getDigester()).getLastNamespacePrefix();
    ComponentKey componentKey = new ComponentKey(namespace, namespacePrefix, name);
    componentElement.setComponentKey(componentKey);
    componentElement.setComponent(component);
}
项目:jasperreports    文件:AbstractVerifiableTableAction.java   
public void prepare() throws ActionException 
{
    if (columnData == null) { 
        errors.addAndThrow("net.sf.jasperreports.components.headertoolbar.actions.validate.no.data");
    }
    if(columnData.getTableUuid() == null || columnData.getTableUuid().trim().length() == 0) {
        errors.addAndThrow("net.sf.jasperreports.components.headertoolbar.actions.validate.no.table");
    }
    CommandTarget target = getCommandTarget(UUID.fromString(columnData.getTableUuid()));
    if (target != null)
    {
        JRIdentifiable identifiable = target.getIdentifiable();
        JRDesignComponentElement componentElement = identifiable instanceof JRDesignComponentElement ? (JRDesignComponentElement)identifiable : null;

        if (componentElement == null) {
            errors.addAndThrow("net.sf.jasperreports.components.headertoolbar.actions.validate.no.table.match", columnData.getTableUuid());
        }

        table = (StandardTable)componentElement.getComponent();
        targetUri = target.getUri();
    }
}
项目:PDFReporter-Studio    文件:MBarcodeBarbecue.java   
@Override
public void trasnferProperties(JRElement target){
    super.trasnferProperties(target);

    JRDesignComponentElement jrSourceElement = (JRDesignComponentElement) getValue();
    StandardBarbecueComponent jrSourceCode = (StandardBarbecueComponent) jrSourceElement.getComponent();

    JRDesignComponentElement jrTargetElement = (JRDesignComponentElement) target;
    StandardBarbecueComponent jrTargetCode = (StandardBarbecueComponent) jrTargetElement.getComponent();

    jrTargetCode.setChecksumRequired(jrSourceCode.isChecksumRequired());
    jrTargetCode.setDrawText(jrSourceCode.isDrawText());
    jrTargetCode.setType(getStringClone(jrSourceCode.getType()));
    jrTargetCode.setBarHeight(jrSourceCode.getBarHeight());
    jrTargetCode.setBarWidth(jrSourceCode.getBarWidth());
    jrTargetCode.setRotation(jrSourceCode.getOwnRotation());
}
项目:PDFReporter-Studio    文件:MCustomVisualization.java   
@Override
public Object getPropertyValue(Object id) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    CVDesignComponent cvComp = (CVDesignComponent) jrElement.getComponent();
    if (CVDesignComponent.PROPERTY_EVALUATION_TIME.equals(id)) {
        return evaluationTimeD.getEnumValue(cvComp.getEvaluationTime());
    }
    else if (CVDesignComponent.PROPERTY_EVALUATION_GROUP.equals(id)) {
        return cvComp.getEvaluationGroup();         
    }
    else if (CVDesignComponent.PROPERTY_PROCESSING_CLASS.equals(id)) {
        return cvComp.getProcessingClass();
    }
    else if (CVDesignComponent.PROPERTY_ITEM_PROPERTIES.equals(id)){
        return JRCloneUtils.cloneList(cvComp.getItemProperties());
    }
    else if (CVDesignComponent.PROPERTY_ITEM_DATA.equals(id)) {
        return JRCloneUtils.cloneList(cvComp.getItemData());
    }
    if (id.equals(CVDesignComponent.PROPERTY_ON_ERROR_TYPE)) {
        return onErrorTypeD.getEnumValue(cvComp.getOnErrorType());
    }
    else {
        return super.getPropertyValue(id);
    }
}
项目:PDFReporter-Studio    文件:MMap.java   
@Override
public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) {
    JRDesignComponentElement designMap = new JRDesignComponentElement();
    StandardMapComponent component = new StandardMapComponent();
    JRDesignExpression exp1 = new JRDesignExpression();
    exp1.setText(MapDesignConverter.DEFAULT_LATITUDE.toString() + "f"); //$NON-NLS-1$
    JRDesignExpression exp2 = new JRDesignExpression();
    exp2.setText(MapDesignConverter.DEFAULT_LONGITUDE.toString() + "f"); //$NON-NLS-1$
    component.setLatitudeExpression(exp1);
    component.setLongitudeExpression(exp2);
    JRDesignExpression exp3 = new JRDesignExpression();
    exp3.setText(String.valueOf(MapComponent.DEFAULT_ZOOM));
    component.setZoomExpression(exp3);
    designMap.setComponent(component);
    designMap.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "c", //$NON-NLS-1$ //$NON-NLS-2$
            "map")); //$NON-NLS-1$
    StandardItemData markerData = safeGetMarkerData(component, null);
    markerData.setDataset(new JRDesignElementDataset());

    DefaultManager.INSTANCE.applyDefault(this.getClass(), designMap);

    return designMap;
}
项目:PDFReporter-Studio    文件:MList.java   
@Override
public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) {
    JRDesignComponentElement component = new JRDesignComponentElement();
    component.setHeight(getDefaultHeight());
    component.setWidth(getDefaultWidth());
    StandardListComponent componentImpl = new StandardListComponent();
    DesignListContents contents = new DesignListContents();
    contents.setHeight(100);
    contents.setWidth(100);
    componentImpl.setContents(contents);

    component.setComponent(componentImpl);
    ComponentKey componentKey = new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "list");
    component.setComponentKey(componentKey);

    JRDesignDatasetRun datasetRun = new JRDesignDatasetRun();
    componentImpl.setDatasetRun(datasetRun);

    DefaultManager.INSTANCE.applyDefault(this.getClass(), component);

    return component;
}
项目:PDFReporter-Studio    文件:ListComponentFactory.java   
public ANode createNode(ANode parent, Object jrObject, int newIndex) {
    if (jrObject instanceof JRDesignComponentElement
            && ((JRDesignComponentElement) jrObject).getComponent() instanceof StandardListComponent) {
        StandardListComponent list = (StandardListComponent) ((JRDesignComponentElement) jrObject).getComponent();
        MList mlist = new MList(parent,(JRDesignComponentElement) jrObject, newIndex);
        if (mlist.getParent() instanceof MPage) {
            final JasperDesign jd = mlist.getJasperDesign();
            ReportFactory.createStyles(mlist.getJasperConfiguration(), jd,mlist.getParent(), 0);

            ReportFactory.createElementsForBand(mlist, list.getContents().getChildren());

            StandardListComponent st = mlist.getList();

            DSListener dslistner = new DSListener(parent, jd, st);
            setDataset(parent, jd, st, dslistner);

            st.getEventSupport().addPropertyChangeListener(dslistner);

            MCallout.createCallouts(mlist);
        }
        return mlist;
    }
    return null;
}
项目:PDFReporter-Studio    文件:RemoveTableStylesAction.java   
/**
 * 
 * Generate the command to remove all the styles from the table, it's essentially a compound command
 * composed of many commands
 * 
 * @param editParts the edit parts containing an MCrosstab as model
 * 
 * @return the command to remove all the styles
 */
protected Command changeStyleCommand(List<EditPart> parts) {
    JSSCompoundCommand command = new JSSCompoundCommand(null);
    deletedStyles = new HashSet<String>();
    for(EditPart part : parts){
        MTable table = (MTable)part.getModel();
        command.setReferenceNodeIfNull(table);
        design = table.getJasperDesign();
        StandardTable jrTable = (StandardTable)((JRDesignComponentElement)table.getValue()).getComponent();
        //This command is added before and after all the other commands to force its
        //refresh when the other commands are executed ore undone
        command.add(new ForceRefreshCommand(table));
        createCommandForColumns(jrTable.getColumns(), command);
        command.add(new ForceRefreshCommand(table));
    }
    return command;
}
项目:PDFReporter-Studio    文件:ListComponentFactory.java   
public ExpressionContext getElementExpressionContext(Object jrObject) {
    if (jrObject instanceof MList
            && ((MList) jrObject).getValue() instanceof JRDesignComponentElement) {
        MList mlist = (MList) jrObject;
        StandardListComponent listComponent = (StandardListComponent) mlist
                .getValue().getComponent();
        JRDesignDataset designDS = ModelUtils
                .getDesignDatasetForDatasetRun(mlist
                        .getJasperConfiguration().getJasperDesign(),
                        listComponent.getDatasetRun());
        return new ExpressionContext(designDS,
                mlist.getJasperConfiguration());
    }

    return null;
}
项目:PDFReporter-Studio    文件:MPOSTNET.java   
@Override
public Object getPropertyValue(Object id) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    POSTNETComponent jrList = (POSTNETComponent) jrElement.getComponent();

    if (id.equals(POSTNETComponent.PROPERTY_SHORT_BAR_HEIGHT))
        return jrList.getShortBarHeight();
    if (id.equals(POSTNETComponent.PROPERTY_INTERCHAR_GAP_WIDTH))
        return jrList.getIntercharGapWidth();
    if (id.equals(POSTNETComponent.PROPERTY_DISPLAY_CHECKSUM))
        return jrList.getDisplayChecksum();
    if (id.equals(POSTNETComponent.PROPERTY_CHECKSUM_MODE))
        return ChecksumMode.getPos4ChecksumMode(jrList.getChecksumMode());
    if (id.equals(POSTNETComponent.PROPERTY_BASELINE_POSITION))
        return BaselinePosition.getPos4BaselinePosition(jrList
                .getBaselinePosition());

    return super.getPropertyValue(id);
}
项目:PDFReporter-Studio    文件:MPOSTNET.java   
@Override
public void setPropertyValue(Object id, Object value) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    POSTNETComponent jrList = (POSTNETComponent) jrElement.getComponent();

    if (id.equals(POSTNETComponent.PROPERTY_SHORT_BAR_HEIGHT))
        jrList.setShortBarHeight((Double) value);
    else if (id.equals(POSTNETComponent.PROPERTY_INTERCHAR_GAP_WIDTH))
        jrList.setIntercharGapWidth((Double) value);
    else if (id.equals(POSTNETComponent.PROPERTY_CHECKSUM_MODE))
        jrList.setChecksumMode(ChecksumMode
                .getChecksumMode4Pos((Integer) value));
    else if (id.equals(POSTNETComponent.PROPERTY_BASELINE_POSITION))
        jrList.setChecksumMode(BaselinePosition
                .getBaselinePosition4Pos((Integer) value));

    else if (id.equals(POSTNETComponent.PROPERTY_DISPLAY_CHECKSUM))
        jrList.setDisplayChecksum((Boolean) value);
    else
        super.setPropertyValue(id, value);
}
项目:PDFReporter-Studio    文件:MPOSTNET.java   
@Override
public void trasnferProperties(JRElement target){
    super.trasnferProperties(target);

    JRDesignComponentElement jrSourceElement = (JRDesignComponentElement) getValue();
    POSTNETComponent jrSourceBarcode = (POSTNETComponent) jrSourceElement.getComponent();

    JRDesignComponentElement jrTargetElement = (JRDesignComponentElement) target;
    POSTNETComponent jrTargetBarcode = (POSTNETComponent) jrTargetElement.getComponent();

    jrTargetBarcode.setShortBarHeight(jrSourceBarcode.getShortBarHeight());
    jrTargetBarcode.setIntercharGapWidth(jrSourceBarcode.getIntercharGapWidth());
    jrTargetBarcode.setChecksumMode(jrSourceBarcode.getChecksumMode());
    jrTargetBarcode.setBaselinePosition(jrSourceBarcode.getBaselinePosition());
    jrTargetBarcode.setDisplayChecksum(jrSourceBarcode.getDisplayChecksum());
}
项目:PDFReporter-Studio    文件:MSpiderChart.java   
@Override
public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) {
    JRDesignComponentElement jrcomponent = new JRDesignComponentElement();
    jrcomponent.setWidth(getDefaultWidth());
    jrcomponent.setHeight(getDefaultHeight());

    SpiderChartComponent component = new SpiderChartComponent();
    component.setChartSettings(new StandardChartSettings());
    component.setDataset(new StandardSpiderDataset());
    StandardSpiderPlot spiderPlot = new StandardSpiderPlot();
    spiderPlot.setWebFilled(true);
    component.setPlot(spiderPlot);

    jrcomponent.setComponent(component);
    jrcomponent.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "sc", "spiderChart")); //$NON-NLS-1$

    DefaultManager.INSTANCE.applyDefault(this.getClass(), jrcomponent);

    return jrcomponent;
}
项目:PDFReporter-Studio    文件:MFourStateBarcode.java   
@Override
public void setPropertyValue(Object id, Object value) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    FourStateBarcodeComponent jrList = (FourStateBarcodeComponent) jrElement
            .getComponent();

    if (id.equals(FourStateBarcodeComponent.PROPERTY_INTERCHAR_GAP_WIDTH))
        jrList.setIntercharGapWidth((Double) value);
    else if (id.equals(FourStateBarcodeComponent.PROPERTY_CHECKSUM_MODE))
        jrList.setChecksumMode(ChecksumMode
                .getChecksumMode4Pos((Integer) value));

    else if (id.equals(FourStateBarcodeComponent.PROPERTY_ASCENDER_HEIGHT))
        jrList.setAscenderHeight((Double) value);
    else if (id.equals(FourStateBarcodeComponent.PROPERTY_TRACK_HEIGHT))
        jrList.setTrackHeight((Double) value);
    else
        super.setPropertyValue(id, value);
}
项目:PDFReporter-Studio    文件:MPDF417.java   
@Override
public void setPropertyValue(Object id, Object value) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    PDF417Component jrList = (PDF417Component) jrElement.getComponent();

    if (id.equals(PDF417Component.PROPERTY_MIN_ROWS))
        jrList.setMinRows((Integer) value);
    if (id.equals(PDF417Component.PROPERTY_MAX_ROWS))
        jrList.setMaxRows((Integer) value);
    if (id.equals(PDF417Component.PROPERTY_MIN_COLUMNS))
        jrList.setMinColumns((Integer) value);
    if (id.equals(PDF417Component.PROPERTY_MAX_COLUMNS))
        jrList.setMaxColumns((Integer) value);
    if (id.equals(PDF417Component.PROPERTY_WIDTH_TO_HEIGHT_RATIO))
        jrList.setWidthToHeightRatio((Double) value);
    if (id.equals(PDF417Component.PROPERTY_ERROR_CORRECTION_LEVEL))
        jrList.setErrorCorrectionLevel((Integer) value);

    super.setPropertyValue(id, value);
}
项目:PDFReporter-Studio    文件:MPDF417.java   
@Override
public void trasnferProperties(JRElement target){
    super.trasnferProperties(target);

    JRDesignComponentElement jrSourceElement = (JRDesignComponentElement) getValue();
    PDF417Component jrSourceBarcode = (PDF417Component) jrSourceElement.getComponent();

    JRDesignComponentElement jrTargetElement = (JRDesignComponentElement) target;
    PDF417Component jrTargetBarcode = (PDF417Component) jrTargetElement.getComponent();

    jrTargetBarcode.setMinColumns(jrSourceBarcode.getMinColumns());
    jrTargetBarcode.setMaxColumns(jrSourceBarcode.getMaxColumns());
    jrTargetBarcode.setMinRows(jrSourceBarcode.getMinRows());
    jrTargetBarcode.setMaxRows(jrSourceBarcode.getMaxRows());
    jrTargetBarcode.setWidthToHeightRatio(jrSourceBarcode.getWidthToHeightRatio());
    jrTargetBarcode.setErrorCorrectionLevel(jrSourceBarcode.getErrorCorrectionLevel());
}
项目:PDFReporter-Studio    文件:MFourStateBarcode.java   
@Override
public Object getPropertyValue(Object id) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    FourStateBarcodeComponent jrList = (FourStateBarcodeComponent) jrElement
            .getComponent();

    if (id.equals(FourStateBarcodeComponent.PROPERTY_INTERCHAR_GAP_WIDTH))
        return jrList.getIntercharGapWidth();

    if (id.equals(FourStateBarcodeComponent.PROPERTY_ASCENDER_HEIGHT))
        return jrList.getAscenderHeight();
    if (id.equals(FourStateBarcodeComponent.PROPERTY_TRACK_HEIGHT))
        return jrList.getTrackHeight();

    if (id.equals(FourStateBarcodeComponent.PROPERTY_CHECKSUM_MODE))
        return ChecksumMode.getPos4ChecksumMode(jrList.getChecksumMode());

    return super.getPropertyValue(id);
}
项目:PDFReporter-Studio    文件:MBarcode4j.java   
@Override
public void trasnferProperties(JRElement target){
    super.trasnferProperties(target);

    JRDesignComponentElement jrSourceElement = (JRDesignComponentElement) getValue();
    BarcodeComponent jrSourceBarcode = (BarcodeComponent) jrSourceElement.getComponent();

    JRDesignComponentElement jrTargetElement = (JRDesignComponentElement) target;
    BarcodeComponent jrTargetBarcode = (BarcodeComponent) jrTargetElement.getComponent();

    jrTargetBarcode.setModuleWidth(jrSourceBarcode.getModuleWidth());
    jrTargetBarcode.setQuietZone(jrSourceBarcode.getQuietZone());
    jrTargetBarcode.setVerticalQuietZone(jrSourceBarcode.getVerticalQuietZone());
    jrTargetBarcode.setOrientation(jrSourceBarcode.getOrientation());
    jrTargetBarcode.setTextPosition(jrSourceBarcode.getTextPosition());
}
项目:PDFReporter-Studio    文件:MCode39.java   
@Override
public Object getPropertyValue(Object id) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    Code39Component jrList = (Code39Component) jrElement.getComponent();

    if (id.equals(Code39Component.PROPERTY_WIDE_FACTOR))
        return jrList.getWideFactor();
    if (id.equals(Code39Component.PROPERTY_INTERCHAR_GAP_WIDTH))
        return jrList.getIntercharGapWidth();

    if (id.equals(Code39Component.PROPERTY_DISPLAY_CHECKSUM))
        return jrList.isDisplayChecksum();
    if (id.equals(Code39Component.PROPERTY_DISPLAY_START_STOP))
        return jrList.isDisplayStartStop();
    if (id.equals(Code39Component.PROPERTY_EXTENDED_CHARSET_ENABLED))
        return jrList.isExtendedCharSetEnabled();

    if (id.equals(Code39Component.PROPERTY_CHECKSUM_MODE))
        return ChecksumMode.getPos4ChecksumMode(jrList.getChecksumMode());

    return super.getPropertyValue(id);
}
项目:PDFReporter-Studio    文件:EditSpiderChartCommand.java   
@Override
public void execute() {
    if (newChart == null) {
        JRDesignComponentElement clone = (JRDesignComponentElement) oldChart
                .clone();
        SpiderChartComponent scc = (SpiderChartComponent) clone
                .getComponent();
        // TODO SHOULD TAKE THIS ONE FROM EDITOR

        ChartWizard wizard = new ChartWizard(new MSpiderChart(null, clone,
                -1), (JRDesignElementDataset) scc.getDataset());
        wizard.init(jConfig);
        wizard.setExpressionContext(ModelUtils.getElementExpressionContext(oldChart,originalNode));
        WizardDialog dialog = new WizardDialog(Display.getDefault()
                .getActiveShell(), wizard);
        dialog.create();
        if (dialog.open() == Dialog.OK) {
            this.newChart = (JRDesignComponentElement) wizard.getChart()
                    .getValue();
        } else
            return;
    }
    switchCharts(oldChart, newChart);
}
项目:PDFReporter-Studio    文件:MInterleaved2Of5.java   
@Override
public void setPropertyValue(Object id, Object value) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    Interleaved2Of5Component jrList = (Interleaved2Of5Component) jrElement
            .getComponent();

    if (id.equals(Interleaved2Of5Component.PROPERTY_CHECKSUM_MODE))
        jrList.setChecksumMode(ChecksumMode
                .getChecksumMode4Pos((Integer) value));
    else if (id.equals(Interleaved2Of5Component.PROPERTY_WIDE_FACTOR))
        jrList.setWideFactor((Double) value);
    else if (id.equals(Code39Component.PROPERTY_DISPLAY_CHECKSUM))
        jrList.setDisplayChecksum((Boolean) value);
    else
        super.setPropertyValue(id, value);
}
项目:jasperreports    文件:JRFillCrosstab.java   
protected JRDesignComponentElement createIconLabelElement(SortOrderEnum order, JRFillTextElement textElement,
        BuiltinExpressionEvaluatorFactory builtinExpressions)
{
    JRTextElement parentElement = (JRTextElement) textElement.getParent();

    JRDesignComponentElement designIconLabelElement = 
        IconLabelComponentUtil.getInstance(filler.getJasperReportsContext()).createIconLabelComponentElement(parentElement, textElement);
    IconLabelComponent iconLabelComponent = (IconLabelComponent)designIconLabelElement.getComponent();

    JRDesignTextField labelTextField = (JRDesignTextField)iconLabelComponent.getLabelTextField();
    JRDesignTextField iconTextField = (JRDesignTextField)iconLabelComponent.getIconTextField();

    designIconLabelElement.setStyle(textElement.getInitStyle());
    labelTextField.setStyle(textElement.getInitStyle());
    iconTextField.setStyle(textElement.getInitStyle());

    if (textElement instanceof JRTextField) 
    {
        labelTextField.setExpression(((JRTextField) textElement).getExpression());
    }
    else if (textElement instanceof JRStaticText) 
    {
        String text = ((JRStaticText) textElement).getText();
        labelTextField.setExpression(builtinExpressions.createConstantExpression(text));
    }

    String iconText =
            order == SortOrderEnum.ASCENDING ? filler.getPropertiesUtil().getProperty(TableReport.PROPERTY_UP_ARROW_CHAR)
            : (order == SortOrderEnum.DESCENDING ? filler.getPropertiesUtil().getProperty(TableReport.PROPERTY_DOWN_ARROW_CHAR) : "");
    iconTextField.setExpression(builtinExpressions.createConstantExpression(" " + iconText)); 

    designIconLabelElement.getPropertiesMap().setProperty(
            MatcherExporterFilter.PROPERTY_MATCHER_EXPORT_FILTER_KEY, 
            TableReport.TABLE_HEADER_ICON_LABEL_MATCHER_EXPORT_KEY
            );

    return designIconLabelElement;
}
项目:jasperreports    文件:HeaderToolbarElementJsonHandler.java   
private void setColumnHeaderData(String sortColumnLabel, Integer columnIndex, CommandTarget target, Map<String, Object> contextMap,
        JasperReportsContext jasperReportsContext, ReportContext reportContext, Locale locale) {
    if (target != null){
        JRIdentifiable identifiable = target.getIdentifiable();
        JRDesignComponentElement componentElement = identifiable instanceof JRDesignComponentElement ? (JRDesignComponentElement)identifiable : null;
        StandardTable table = componentElement == null ? null : (StandardTable)componentElement.getComponent();

        List<BaseColumn> tableColumns = TableUtil.getAllColumns(table);

        if (columnIndex != null) {
            StandardColumn column = (StandardColumn) tableColumns.get(columnIndex);

            JRDesignTextElement textElement = TableUtil.getCellElement(JRDesignTextElement.class, column.getColumnHeader(), true);

            if (textElement != null) {
                EditTextElementData textElementData = new EditTextElementData();

                textElementData.setHeadingName(JRStringUtil.htmlEncode(sortColumnLabel));
                textElementData.setColumnIndex(columnIndex);
                JRDesignTextElement styledElement = resolveElementStyle(textElement, reportContext, target);
                HeaderToolbarElementUtils.copyTextElementStyle(textElementData, styledElement, locale);

                contextMap.put("colHeaderData", JacksonUtil.getInstance(jasperReportsContext).getJsonString(textElementData));
            }
        }
    }
}
项目:jasperreports    文件:HeaderToolbarElementJsonHandler.java   
private EditTextElementData setColumnValueData(Integer columnIndex, CommandTarget target, Map<String, Object> contextMap,
        JasperReportsContext jasperReportsContext, ReportContext reportContext, Locale locale) {
    EditTextElementData textElementData = new EditTextElementData();

    if (target != null){
        JRIdentifiable identifiable = target.getIdentifiable();
        JRDesignComponentElement componentElement = identifiable instanceof JRDesignComponentElement ? (JRDesignComponentElement)identifiable : null;
        StandardTable table = componentElement == null ? null : (StandardTable)componentElement.getComponent();

        List<BaseColumn> tableColumns = TableUtil.getAllColumns(table);

        if (columnIndex != null) {
            StandardColumn column = (StandardColumn) tableColumns.get(columnIndex);

            JRDesignTextField textElement = TableUtil.getCellElement(JRDesignTextField.class, column.getDetailCell(), true);

            if (textElement != null) {
                textElementData.setColumnIndex(columnIndex);
                JRDesignTextElement styledElement = resolveElementStyle(textElement, reportContext, target);
                HeaderToolbarElementUtils.copyTextElementStyle(textElementData, styledElement, locale);
            }
        }
    }
    contextMap.put("colValueData", JacksonUtil.getInstance(jasperReportsContext).getJsonString(textElementData));

    return textElementData;
}
项目:jasperreports    文件:AbstractVerifiableTableAction.java   
public StandardTable getTable(String uuid) 
{
    CommandTarget target = getCommandTarget(UUID.fromString(uuid));
    if (target != null)
    {
        JRIdentifiable identifiable = target.getIdentifiable();
        JRDesignComponentElement componentElement = identifiable instanceof JRDesignComponentElement ? (JRDesignComponentElement)identifiable : null;
        return componentElement == null ? null : (StandardTable)componentElement.getComponent();
    }
    return null;
}
项目:PDFReporter-Studio    文件:MHtml.java   
@Override
public JRDesignElement createJRElement(JasperDesign jasperDesign) {
    JRDesignComponentElement el = new JRDesignComponentElement();
    HtmlComponent component = new HtmlComponent();
    JRDesignExpression exp = new JRDesignExpression();
    exp.setValueClassName("java.lang.String"); //$NON-NLS-1$
    exp.setText("\"<p style='background-color:yellow;'>HTML paragraph</p>\""); //$NON-NLS-1$
    component.setHtmlContentExpression(exp);
    el.setComponent(component);
    el.setComponentKey(new ComponentKey(
            "http://jasperreports.sourceforge.net/htmlcomponent", "hc", "html")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    return el;
}
项目:PDFReporter-Studio    文件:MHtml.java   
private Object getComponent(Object value) {
    if (value != null) {
        JRDesignComponentElement jrElement = (JRDesignComponentElement) value;
        return jrElement.getComponent();
    }
    return null;
}
项目:PDFReporter-Studio    文件:MHtml.java   
@Override
public void setPropertyValue(Object id, Object value) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    HtmlComponent htmlComp = (HtmlComponent) jrElement.getComponent();

    if (id.equals(HtmlComponent.PROPERTY_EVALUATION_TIME))
        htmlComp.setEvaluationTime((EvaluationTimeEnum) evaluationTimeD
                .getEnumValue(value));
    else if (id.equals(HtmlComponent.PROPERTY_EVALUATION_GROUP))
        htmlComp.setEvaluationGroup((String) value);
    else if (id.equals(HtmlComponent.PROPERTY_SCALE_TYPE))
        htmlComp.setScaleType((ScaleImageEnum) scaleTypeD
                .getEnumValue(value));
    else if (id.equals(HtmlComponent.PROPERTY_HORIZONTAL_ALIGN))
        htmlComp.setHorizontalAlign((HorizontalAlignEnum) hAlignD
                .getEnumValue(value));
    else if (id.equals(HtmlComponent.PROPERTY_VERTICAL_ALIGN))
        htmlComp.setVerticalAlign((VerticalAlignEnum) vAlignD
                .getEnumValue(value));
    else if (id.equals(HtmlComponent.PROPERTY_HTMLCONTENT_EXPRESSION))
        htmlComp.setHtmlContentExpression(ExprUtil.setValues(
                htmlComp.getHtmlContentExpression(), value));
    else if (id.equals(HtmlComponent.PROPERTY_CLIP_ON_OVERFLOW))
        htmlComp.setClipOnOverflow((Boolean) value);
    else
        super.setPropertyValue(id, value);
}
项目:PDFReporter-Studio    文件:MBarcodeBarbecue.java   
@Override
public void setPropertyValue(Object id, Object value) {
    JRDesignComponentElement jrElement = (JRDesignComponentElement) getValue();
    StandardBarbecueComponent jrList = (StandardBarbecueComponent) jrElement
            .getComponent();

    if (id.equals(StandardBarbecueComponent.PROPERTY_EVALUATION_TIME))
        jrList.setEvaluationTimeValue((EvaluationTimeEnum) evaluationTimeD
                .getEnumValue(value));
    else if (id.equals(StandardBarbecueComponent.PROPERTY_EVALUATION_GROUP))
        jrList.setEvaluationGroup((String) value);
    else if (id
            .equals(StandardBarbecueComponent.PROPERTY_CHECKSUM_REQUIRED))
        jrList.setChecksumRequired(((Boolean) value).booleanValue());
    else if (id.equals(StandardBarbecueComponent.PROPERTY_DRAW_TEXT))
        jrList.setDrawText(((Boolean) value).booleanValue());
    else if (id.equals(StandardBarbecueComponent.PROPERTY_TYPE))
        jrList.setType((String) value);
    else if (id.equals(StandardBarbecueComponent.PROPERTY_ROTATION))
        jrList.setRotation((RotationEnum) rotationD.getEnumValue(value));

    else if (id.equals(StandardBarbecueComponent.PROPERTY_BAR_HEIGTH))
        jrList.setBarHeight((Integer) value);
    else if (id.equals(StandardBarbecueComponent.PROPERTY_BAR_WIDTH))
        jrList.setBarWidth((Integer) value);
    else if (id.equals(StandardBarbecueComponent.PROPERTY_CODE_EXPRESSION)) {
        jrList.setCodeExpression(ExprUtil.setValues(
                jrList.getCodeExpression(), value, null));
    } else if (id
            .equals(StandardBarbecueComponent.PROPERTY_APPLICATION_IDENTIFIER_EXPRESSION)) {
        jrList.setApplicationIdentifierExpression(ExprUtil.setValues(
                jrList.getApplicationIdentifierExpression(), value, null));
    } else
        super.setPropertyValue(id, value);
}
项目:PDFReporter-Studio    文件:CVComponentFactory.java   
@Override
public ANode createNode(ANode parent, Object jrObject, int newIndex) {
    if (jrObject instanceof JRDesignComponentElement
            && ((JRDesignComponentElement) jrObject).getComponent() instanceof CVComponent) {
        return new MCustomVisualization(parent, (JRDesignComponentElement) jrObject,
                newIndex);
    }
    return null;

}
项目:PDFReporter-Studio    文件:TableComponentFactory.java   
public AbstractVisualEditor getEditor(Object node, JasperReportsConfiguration jrContext) {
    if (node != null && node instanceof JRDesignComponentElement) {
        Component component = ((JRDesignComponentElement) node).getComponent();
        if (component != null && component instanceof StandardTable)
            return new TableEditor(jrContext);
    }
    return null;
}
项目:PDFReporter-Studio    文件:MCustomVisualization.java   
private Object getComponent(Object value) {
    if (value != null) {
        JRDesignComponentElement jrElement = (JRDesignComponentElement) value;
        return jrElement.getComponent();
    }
    return null;
}
项目:PDFReporter-Studio    文件:MSort.java   
private Object getComponent(Object value) {
    if (value != null) {
        JRDesignComponentElement jrElement = (JRDesignComponentElement) value;
        return jrElement.getComponent();
    }
    return null;
}
项目:PDFReporter-Studio    文件:MMap.java   
@Override
public void trasnferProperties(JRElement target){
    super.trasnferProperties(target);

    StandardMapComponent jrSourceMap = getMapComponent();
    JRDesignComponentElement jrTargetElement = (JRDesignComponentElement) target;
    StandardMapComponent jrTargetMap = (StandardMapComponent) jrTargetElement.getComponent();

    jrTargetMap.setMapType(jrSourceMap.getMapType());
    jrTargetMap.setMapScale(jrSourceMap.getMapScale());
    jrTargetMap.setImageType(jrSourceMap.getImageType());
    jrTargetMap.setOnErrorType(jrSourceMap.getOnErrorType());

}
项目:PDFReporter-Studio    文件:MComponentElement.java   
/**
 * Creates the property descriptors.
 * 
 * @param desc
 *          the desc
 */
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
    super.createPropertyDescriptors(desc, defaultsMap);

    NTextPropertyDescriptor nameD = new NTextPropertyDescriptor(JRDesignComponentElement.PROPERTY_COMPONENT_KEY, "Component Key");
    nameD.setDescription("Component key.");
    nameD.setReadOnly(true);
    desc.add(nameD);
}
项目:PDFReporter-Studio    文件:CreateElementCommand.java   
/**
 * Instantiates a new creates the element command.
 * 
 * @param destNode
 *            the dest node
 * @param srcNode
 *            the src node
 * @param index
 *            the index
 */
public CreateElementCommand(MList destNode, MGraphicElement srcNode,
        Rectangle position, int index) {
    super();
    this.destNode = destNode;
    this.srcNode = srcNode;
    if (srcNode != null)
        jrElement = (JRDesignElement) srcNode.getValue();
    jrElement2 = (JRDesignComponentElement) destNode.getValue();
    listcomponent = (StandardListComponent) jrElement2.getComponent();
    this.index = index;
    this.location = position;
    jDesign = destNode.getJasperDesign();
    pholder = ((IContainerLayout) destNode).getPropertyHolder();
}
项目:PDFReporter-Studio    文件:EditSpiderChartCommand.java   
private void switchCharts(JRDesignComponentElement chart1,
        JRDesignComponentElement chart2) {
    int index = jrGroup.getChildren().indexOf(chart1);
    if (jrGroup instanceof JRDesignElementGroup) {
        ((JRDesignElementGroup) jrGroup).removeElement(chart1);
        ((JRDesignElementGroup) jrGroup).addElement(index, chart2);
    } else if (jrGroup instanceof JRDesignFrame) {
        ((JRDesignFrame) jrGroup).removeElement(chart1);
        ((JRDesignFrame) jrGroup).addElement(index, chart2);
    }
}
项目:PDFReporter-Studio    文件:TableTemplateEngine.java   
/**
 * Search the template table inside a JasperDesign, looking in the children of the summary band
 * 
 * @param jd the jasperdesign that contains the sample table
 * @return a JRDesignComponentElement that contains a StandardTable, or null if it isn't found
 */
private static JRDesignComponentElement getTable(JasperDesign jd){
    if (jd.getSummary() == null) return null;
    for(JRChild child : jd.getSummary().getChildren()){
        if (child instanceof JRDesignComponentElement){
            JRDesignComponentElement component = (JRDesignComponentElement)child;
            if (component.getComponent() instanceof StandardTable) return component;
        }
    }
    //No table found, create a default one
    return null;
}
项目:PDFReporter-Studio    文件:SortComponentFactory.java   
public ANode createNode(ANode parent, Object jrObject, int newIndex) {
    if (jrObject instanceof JRDesignComponentElement
            && ((JRDesignComponentElement) jrObject).getComponent() instanceof SortComponent) {
        return new MSort(parent, (JRDesignComponentElement) jrObject,
                newIndex);
    }
    return null;
}
项目:PDFReporter-Studio    文件:MPOSTNET.java   
@Override
public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) {
    JRDesignComponentElement el = new JRDesignComponentElement();
    POSTNETComponent component = new POSTNETComponent();
    JRDesignExpression exp = new JRDesignExpression();
    exp.setText("\"123456789\""); //$NON-NLS-1$
    component.setCodeExpression(exp);
    el.setComponent(component);
    el.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "POSTNET")); //$NON-NLS-1$

    DefaultManager.INSTANCE.applyDefault(this.getClass(), el);

    return el;
}