Java 类net.sf.jasperreports.engine.type.SortOrderEnum 实例源码

项目:jasperreports    文件:JRSortFieldFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRDesignSortField sortField = new JRDesignSortField();

    sortField.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));

    SortOrderEnum order = SortOrderEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_order));
    if (order != null)
    {
        sortField.setOrder(order);
    }

    SortFieldTypeEnum type = SortFieldTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_type));
    if (type != null)
    {
        sortField.setType(type);
    }

    return sortField;
}
项目:jasperreports    文件:JRBaseCrosstabBucket.java   
@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)
    {
        SortOrderEnum sortOrder = SortOrderEnum.getByValue(order);
        bucketOrder = BucketOrder.fromSortOrderEnum(sortOrder);
    }
    else if (orderValue != null && bucketOrder == null)
    {
        // deserializing old version object
        bucketOrder = BucketOrder.fromSortOrderEnum(orderValue);
        orderValue = null;
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_4_0_3)
    {
        //expression can never be null due to verifier
        valueClassName = getExpression().getValueClassName();//we probably can never remove this method from expression, if we want to preserve backward compatibility
    }
}
项目:PDFReporter-Studio    文件:MBucket.java   
public void setPropertyValue(Object id, Object value) {
    JRDesignCrosstabBucket jrField = (JRDesignCrosstabBucket) getValue();

    if (id.equals(JRDesignCrosstabBucket.PROPERTY_ORDER))
        jrField.setOrder((SortOrderEnum) orderD.getEnumValue(value));
    else if (id
            .equals(JRDesignCrosstabBucket.PROPERTY_COMPARATOR_EXPRESSION))
        jrField.setComparatorExpression(ExprUtil.setValues(
                jrField.getComparatorExpression(), value));
    else if (id.equals(JRDesignCrosstabBucket.PROPERTY_ORDER_BY_EXPRESSION))
        jrField.setOrderByExpression(ExprUtil.setValues(
                jrField.getOrderByExpression(), value));
    else if (id.equals(JRDesignCrosstabBucket.PROPERTY_EXPRESSION))
        jrField.setExpression((JRDesignExpression) ExprUtil.setValues(
                jrField.getExpression(), value));
    else if (id.equals(JRDesignCrosstabBucket.PROPERTY_VALUE_CLASS))
        jrField.setValueClassName((String) value);
}
项目:PDFReporter-Studio    文件:MSortField.java   
public void setPropertyValue(Object id, Object value) {
    JRDesignSortField jrField = (JRDesignSortField) getValue();
    if (id.equals(JRDesignSortField.PROPERTY_NAME)) {
        if (!value.equals("")) { //$NON-NLS-1$
            String oldName = jrField.getName();
            String oldType = jrField.getType().getName();
            String newName = (String) value;
            //The type is the same
            changeNameAndType(oldName, oldType, newName,  jrField.getType(), jrField);
        }
    } else if (id.equals(JRDesignSortField.PROPERTY_ORDER))
        jrField.setOrder((SortOrderEnum) orderD.getEnumValue(value));
    else if (id.equals(JRDesignSortField.PROPERTY_TYPE)) {
        SortFieldTypeEnum type = (SortFieldTypeEnum) typeD.getEnumValue(value);
        selectFirstAvailableName(type);
    }
}
项目:Genji    文件:ReportOverviewJasperDesign.java   
/**
 * Add a sort order field to jasperDesign
 * 
 * @param jasperDesign
 * @param sortField
 * @param sortOrder
 */
private static void addSortOrder(JasperDesign jasperDesign, SortFieldTO sortField) {
    if (sortField != null) {
        // not a pseudo field
        // the name of the field from XML to sort by
        String sortFieldName = sortField.getName();
        if (ReportBeansToXML.hasExtraSortField(sortField.getFieldID())) {
            sortFieldName = sortFieldName + TReportLayoutBean.PSEUDO_COLUMN_NAMES.ORDER;
        }
        SortOrderEnum sortOrderEnum = null;
        if (sortField.isDescending()) {
            sortOrderEnum = SortOrderEnum.DESCENDING;
        } else {
            sortOrderEnum = SortOrderEnum.ASCENDING;
        }
        try {
            jasperDesign.addSortField(new JRDesignSortField(sortFieldName, SortFieldTypeEnum.FIELD, sortOrderEnum));
        } catch (JRException e) {
            LOGGER.warn("Adding the sort field " + sortFieldName + " for sorting failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
        }
    }
}
项目:ireport-fork    文件:SortFieldsDialog.java   
private void jButtonAscDescActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAscDescActionPerformed

        // get selected sortfield...
        int[] items = jList1.getSelectedIndices();
        for (int i=0; i<items.length; ++i)
        {
            JRDesignSortField field = (JRDesignSortField)jList1.getModel().getElementAt(items[i]);
            if (field.getOrderValue() == SortOrderEnum.ASCENDING)
            {
                field.setOrder( SortOrderEnum.DESCENDING);
            }
            else
            {
                field.setOrder( SortOrderEnum.ASCENDING);
            }
        }
        updateDatasetSortFieldList();
        jList1.updateUI();

    }
项目:jasperreports    文件:JRBaseSortField.java   
/**
 *
 */
public void setOrder(SortOrderEnum orderValue)
{
    Object old = this.orderValue;
    this.orderValue = orderValue;
    getEventSupport().firePropertyChange(PROPERTY_ORDER, old, this.orderValue);
}
项目:jasperreports    文件:JRBaseSortField.java   
@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)
    {
        orderValue = SortOrderEnum.getByValue((byte)(order + 1));
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_5)
    {
        type = SortFieldTypeEnum.FIELD;
    }
}
项目:jasperreports    文件:JRXmlWriter.java   
/**
 *
 */
private void writeSortField(JRSortField sortField) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_sortField);
    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, sortField.getName());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_order, sortField.getOrderValue(), SortOrderEnum.ASCENDING);
    if(isNewerVersionOrEqual(JRConstants.VERSION_3_7_5))
    {
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_type, sortField.getType(), SortFieldTypeEnum.FIELD);
    }
    writer.closeElement();
}
项目:jasperreports    文件:JRApiWriter.java   
/**
 *
 */
private void writeSortField( JRSortField sortField, String sortFieldName)
{
    if(sortField != null)
    {
        write( "JRDesignSortField " + sortFieldName + " = new JRDesignSortField();\n");
        write( sortFieldName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(sortField.getName()));
        write( sortFieldName + ".setOrder({0});\n", sortField.getOrderValue(), SortOrderEnum.ASCENDING);
        write( sortFieldName + ".setType({0});\n", sortField.getType(), SortFieldTypeEnum.FIELD);
        flush();
    }
}
项目:jasperreports    文件:JRDesignSortField.java   
/**
 *
 */
public JRDesignSortField(
    String name,
    SortFieldTypeEnum type,
    SortOrderEnum order
    )
{
    this.name = name;
    this.type = type;
    this.orderValue = order;
}
项目: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    文件:OrderByColumnOrderer.java   
@Override
public int compareOrderValues(Object orderValue, Object orderValue2)
{
    int order;
    if (orderValue == null)
    {
        if (orderValue2 == null)
        {
            order = 0;
        }
        else
        {
            // by convention nulls come before
            order = -1;
        }
    }
    else
    {
        if (orderValue2 == null)
        {
            order = 1;
        }
        else
        {
            // assuming natural ordering
            order = ((Comparable) orderValue).compareTo(orderValue2);
        }
    }
    return orderInfo.getOrder() == SortOrderEnum.DESCENDING ? -order : order;
}
项目:jasperreports    文件:SortParameterContributor.java   
private void overwriteExistingSortField(List<JRSortField> sortFields, JRSortField newSortField) {
    int indexOfExistingSortField = sortFields.indexOf(newSortField);
    if (indexOfExistingSortField != -1) {
        // remove sortfield if previos order was 'Descending'
        boolean mustRemove = (sortFields.get(indexOfExistingSortField)).getOrderValue().equals(SortOrderEnum.DESCENDING);
        if (mustRemove) {
            sortFields.remove(indexOfExistingSortField);
        } else {
            ((JRDesignSortField)sortFields.get(indexOfExistingSortField)).setOrder(newSortField.getOrderValue());
        }

    } else if (newSortField.getOrderValue() != null) { // this is necessary because a dummy order - None - is introduced
        sortFields.add(newSortField);
    }
}
项目:PDFReporter-Studio    文件:MBucket.java   
/**
 * Creates the property descriptors.
 * 
 * @param desc
 *            the desc
 */
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc,
        Map<String, Object> defaultsMap) {
    orderD = new JSSEnumPropertyDescriptor(
            JRDesignCrosstabBucket.PROPERTY_ORDER, Messages.common_order,
            SortOrderEnum.class, NullEnum.NOTNULL);
    orderD.setDescription(Messages.MBucket_order_description);
    desc.add(orderD);

    JRExpressionPropertyDescriptor orderByExprD = new JRExpressionPropertyDescriptor(
            JRDesignCrosstabBucket.PROPERTY_ORDER_BY_EXPRESSION,
            Messages.MBucket_order_by_expression);
    orderByExprD
            .setDescription(Messages.MBucket_order_by_expression_description);
    desc.add(orderByExprD);

    JRExpressionPropertyDescriptor compExprD = new JRExpressionPropertyDescriptor(
            JRDesignCrosstabBucket.PROPERTY_COMPARATOR_EXPRESSION,
            Messages.MBucket_comparator_expression);
    compExprD
            .setDescription(Messages.MBucket_comparator_expression_description);
    desc.add(compExprD);

    JRExpressionPropertyDescriptor exprD = new JRExpressionPropertyDescriptor(
            JRDesignCrosstabBucket.PROPERTY_EXPRESSION,
            Messages.MBucket_expression);
    exprD.setDescription(Messages.MBucket_expression_description);
    desc.add(exprD);

    NClassTypePropertyDescriptor classD = new NClassTypePropertyDescriptor(
            JRDesignCrosstabBucket.PROPERTY_VALUE_CLASS, Messages.MBucket_valueClassTitle);
    classD.setDescription(Messages.MBucket_valueClassDescription);
    desc.add(classD);

    defaultsMap.put(JRDesignCrosstabBucket.PROPERTY_VALUE_CLASS, null);

}
项目:PDFReporter-Studio    文件:MSortField.java   
/**
 * Creates the property descriptors.
 * 
 * @param desc
 *          the desc
 */
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
    nameD = new RComboBoxPropertyDescriptor(JRDesignSortField.PROPERTY_NAME, Messages.common_name, new String[] { "" }); //$NON-NLS-1$
    nameD.setDescription(Messages.MSortField_name_description);
    desc.add(nameD);

    typeD = new JSSEnumPropertyDescriptor(JRDesignSortField.PROPERTY_TYPE, Messages.MSortField_typeTitle,
            SortFieldTypeEnum.class, NullEnum.NOTNULL) {
        public ASPropertyWidget createWidget(Composite parent, AbstractSection section) {
            Image[] images = new Image[] {
                    JaspersoftStudioPlugin.getInstance().getImage("icons/resources/fields-sort-16.png"), //$NON-NLS-1$
                    JaspersoftStudioPlugin.getInstance().getImage("icons/resources/variables-sort-16.png") }; //$NON-NLS-1$
            return new SPToolBarEnum(parent, section, this, images, false);
        }
    };
    typeD.setDescription("Sort field type"); //$NON-NLS-1$
    desc.add(typeD);

    orderD = new JSSEnumPropertyDescriptor(JRDesignSortField.PROPERTY_ORDER, Messages.common_order,
            SortOrderEnum.class, NullEnum.NOTNULL) {
        public ASPropertyWidget createWidget(Composite parent, AbstractSection section) {
            Image[] images = new Image[] {
                    JaspersoftStudioPlugin.getInstance().getImage("icons/resources/sort-number-column.png"), //$NON-NLS-1$
                    JaspersoftStudioPlugin.getInstance().getImage("icons/resources/sort-number-descending.png") }; //$NON-NLS-1$
            return new SPToolBarEnum(parent, section, this, images, false);
        }
    };
    orderD.setDescription(Messages.MSortField_order_description);
    desc.add(orderD);

    defaultsMap.put(JRDesignSortField.PROPERTY_ORDER, typeD.getEnumValue(SortOrderEnum.ASCENDING));
    defaultsMap.put(JRDesignSortField.PROPERTY_TYPE, orderD.getEnumValue(SortFieldTypeEnum.FIELD));

    setHelpPrefix(desc, "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#sortField"); //$NON-NLS-1$
}
项目:ireport-fork    文件:CrosstabGroupNode.java   
@SuppressWarnings("unchecked")
public BucketOrderProperty(JRDesignCrosstabBucket bucket, JRDesignCrosstab crosstab)
{
    super(SortOrderEnum.class,  bucket);
    this.crosstab = crosstab;
    this.bucket = bucket;
}
项目:ireport-fork    文件:CrosstabGroupNode.java   
@Override
public List getTagList() 
{
    List tags = new java.util.ArrayList();
    tags.add(new Tag(SortOrderEnum.ASCENDING, "Ascending"));
    tags.add(new Tag(SortOrderEnum.DESCENDING, "Descending"));
    return tags;
}
项目:ireport-fork    文件:SortFieldDialog.java   
public SortFieldDialog(java.awt.Dialog parent, boolean modal) {

    super(parent, modal);
    initComponents();
    jComboBoxSortBy.setEditable(false);

    jComboBoxSortType.addItem(new Tag(SortOrderEnum.ASCENDING,"Ascending"));
    jComboBoxSortType.addItem(new Tag(SortOrderEnum.DESCENDING,"Descending"));

    ExpObjectCellRenderer renderer = new ExpObjectCellRenderer();
    renderer.setShowObjectType(true);
    renderer.setShowObjectClass(false);
    jComboBoxSortBy.setRenderer(renderer);

    javax.swing.KeyStroke escape =  javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false);
    javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            jButtonCancelActionPerformed(e);
        }
    };

    getRootPane().getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, I18n.getString("Global.Pane.Escape"));
    getRootPane().getActionMap().put(I18n.getString("Global.Pane.Escape"), escapeAction);


    //to make the default button ...
    this.getRootPane().setDefaultButton(this.jButtonOK);

    //applyI18n();
    this.pack();

}
项目:ireport-fork    文件:SortFieldDialog.java   
private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed

    Object obj = this.jComboBoxSortBy.getSelectedItem();

    if (obj == null)
    {
        javax.swing.JOptionPane.showMessageDialog(this,
                //I18n.getString("sortFieldDialog.messageNotValidField",
                I18n.getString("SortFieldDialog.Message.Error"),
                //I18n.getString("sortFieldDialog.messageTitleNotValidField",
                I18n.getString("SortFieldDialog.Message.Error2"),
                javax.swing.JOptionPane.WARNING_MESSAGE );
        return;
    }

    String fieldName = "";
    tmpSortField = new JRDesignSortField();

    if (obj instanceof JRDesignField)
    {
        fieldName = ((JRDesignField)obj).getName();
        tmpSortField.setType(SortFieldTypeEnum.FIELD);
    }
    else if (obj instanceof JRDesignVariable)
    {
        fieldName = ((JRDesignVariable)obj).getName();
        tmpSortField.setType(SortFieldTypeEnum.VARIABLE);
    }


    tmpSortField.setName(fieldName);
    tmpSortField.setOrder( (jComboBoxSortType.getSelectedIndex() == 1) ? 
                SortOrderEnum.DESCENDING : SortOrderEnum.ASCENDING);

    setVisible(false);
    this.setDialogResult( javax.swing.JOptionPane.OK_OPTION);
    dispose();
}
项目:ireport-fork    文件:SortFieldDialog.java   
public void setSortField(JRDesignSortField sortField) {
    this.tmpSortField = new JRDesignSortField();
    this.tmpSortField.setName(  sortField.getName() );
    this.tmpSortField.setOrder(  sortField.getOrderValue() );
    this.tmpSortField.setType( sortField.getType() );
    this.tmpSortField.setName( sortField.getName());

    for (int i=0; i<jComboBoxSortBy.getItemCount(); ++i)
    {
        Object item = jComboBoxSortBy.getItemAt(i);

        if (item instanceof JRDesignField &&
            sortField.getType() == SortFieldTypeEnum.FIELD &&
            ((JRDesignField)item).getName().equals(sortField.getName()))
        {
            jComboBoxSortBy.setSelectedIndex(i);
            break;
        }
        else if (item instanceof JRDesignVariable &&
            sortField.getType() == SortFieldTypeEnum.VARIABLE &&
            ((JRDesignVariable)item).getName().equals(sortField.getName()))
        {
            jComboBoxSortBy.setSelectedIndex(i);
            break;
        }
    }

    this.jComboBoxSortType.setSelectedIndex( ((tmpSortField.getOrderValue() == SortOrderEnum.DESCENDING) ? 1 : 0) );
}
项目:jasperreports    文件:JRBaseSortField.java   
@Override
public SortOrderEnum getOrderValue()
{
    return orderValue;
}
项目:jasperreports    文件:JRSortableDataSource.java   
/**
 *
 */
public JRSortableDataSource(JRDataSource ds, JRField[] fields, JRSortField[] sortFields, Locale locale) throws JRException
{
    if (fields == null)
    {
        //avoid testing for null later
        fields = new JRField[0];
    }

    if (sortFields == null)
    {
        //avoid testing for null later
        sortFields = new JRSortField[0];
    }

    /*   */
    verifySortFields(fields, sortFields);

    collator = Collator.getInstance(locale);

    for(int i = 0; i < fields.length; i++)
    {
        fieldIndexMap.put(fields[i].getName(), Integer.valueOf(i));
    }

    int[] sortIndexes = new int[sortFields.length];
    int[] sortOrders = new int[sortFields.length];
    boolean[] collatorFlags = new boolean[sortFields.length];
    for(int i = 0; i < sortFields.length; i++)
    {
        JRSortField sortField = sortFields[i];
        sortIndexes[i] = fieldIndexMap.get(sortField.getName()).intValue();
        sortOrders[i] = (SortOrderEnum.ASCENDING == sortField.getOrderValue() ? 1 : -1);

        collatorFlags[i] = false;
        for(int j = 0; j < fields.length; j++)
        {
            JRField field = fields[j];
            if (sortField.getName().equals(field.getName()))
            {
                //it is certain that a matching field will be found, due to verifySortFields();
                collatorFlags[i] = String.class.getName().equals(field.getValueClassName());
                break;
            }
        }
    }

    if (ds != null)
    {
        while(ds.next())
        {
            // check whether the fill thread was interrupted
            if (Thread.currentThread().isInterrupted())
            {
                throw new JRFillInterruptedException();
            }

            Object[] record = new Object[fields.length];
            for(int i = 0; i < fields.length; i++)
            {
                record[i] = ds.getFieldValue(fields[i]);
            }
            records.add(record);
        }
    }

    /*   */
    Collections.sort(records, new DataSourceComparator(sortIndexes, sortOrders, collatorFlags));

    iterator = records.iterator();
}
项目:jasperreports    文件:JRFillCrosstab.java   
private JRFillCellContents decorateWithSortIcon(JRFillCellContents cell, SortOrderEnum order)
{
    // check whether the contents contain a single text element
    JRElement[] elements = cell.getElements();
    if (elements.length != 1)
    {
        if (log.isDebugEnabled())
        {
            log.debug("order by column header has " + elements.length + " elements");
        }

        return cell;
    }

    if (!(elements[0] instanceof JRTextElement))
    {
        if (log.isDebugEnabled())
        {
            log.debug("order by column header has element " + elements[0].getClass().getName());
        }

        return cell;
    }

    // TODO lucianc cache
    JRFillTextElement textElement = (JRFillTextElement) elements[0];
    if (log.isDebugEnabled())
    {
        log.debug("wrapping column header element " + textElement.getUUID() + " in iconLabel");
    }

    BuiltinExpressionEvaluatorFactory builtinExpressions = new BuiltinExpressionEvaluatorFactory();
    JRDesignComponentElement iconLabelElement = createIconLabelElement(order, textElement, builtinExpressions);

    JRFillExpressionEvaluator decoratedEvaluator = builtinExpressions.decorate(cell.expressionEvaluator);
    IconLabelFillObjectFactory factory = new IconLabelFillObjectFactory(fillFactory, decoratedEvaluator);
    JRFillComponentElement fillIconLabelElement = new JRFillComponentElement(filler, iconLabelElement, factory);

    JRFillCellContents clonedCell = (JRFillCellContents) cell.createClone();
    clonedCell.addElement(1, fillIconLabelElement);

    JRFillElement clonedTextElement = (JRFillElement) clonedCell.getElements()[0];
    clonedTextElement.setExpressionEvaluator(decoratedEvaluator);
    clonedTextElement.addDynamicProperty(MatcherExporterFilter.PROPERTY_MATCHER_EXPORT_FILTER_KEY, 
            builtinExpressions.createConstantExpression(TableReport.TABLE_HEADER_LABEL_MATCHER_EXPORT_KEY));

    return clonedCell;
}
项目:jasperreports    文件:DatasetSortInfo.java   
public boolean isDescending()
{
    return SortOrderEnum.DESCENDING == sortField.getOrderValue();
}
项目:jasperreports    文件:OrderByColumnInfo.java   
public SortOrderEnum getOrder()
{
    return order;
}
项目:jasperreports    文件:OrderByColumnInfo.java   
public void setOrder(SortOrderEnum order)
{
    this.order = order;
}
项目:jasperreports    文件:HeaderToolbarElementUtils.java   
public static SortOrderEnum getSortOrder(String sortOrder) {
    return sortOrderMapping.get(sortOrder);
}
项目:jasperreports    文件:SortElementUtils.java   
public static SortOrderEnum getSortOrder(String sortOrder) {
    return sortOrderMapping.get(sortOrder);
}
项目:jasperreports    文件:SortCommand.java   
@Override
public void execute() throws CommandException 
{
    SortOrderEnum sortOrder = HeaderToolbarElementUtils.getSortOrder(sortData.getSortOrder());//FIXMEJIVE use labels in JR enum, even if they are longer

    JRDesignSortField newSortField = 
        new JRDesignSortField(
            sortData.getSortColumnName(),
            SortFieldTypeEnum.getByName(sortData.getSortColumnType()),
            sortOrder
            );

    JRSortField oldSortField = null;
    List<JRSortField> sortFields = dataset.getSortFieldsList();
    if (
        JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(dataset, PROPERTY_CREATE_SORT_FIELDS_FOR_GROUPS, false)
        && (sortFields == null || sortFields.isEmpty())
        )
    {
        List<JRGroup> groups = dataset.getGroupsList();
        for (JRGroup group : groups)
        {
            JRExpression expression = group.getExpression();
            if (expression != null)
            {
                JRExpressionChunk[] chunks = expression.getChunks();
                if (chunks != null && chunks.length == 1)
                {
                    JRExpressionChunk chunk = chunks[0];
                    if (
                        chunk.getType() == JRExpressionChunk.TYPE_FIELD
                        || chunk.getType() == JRExpressionChunk.TYPE_VARIABLE
                        )
                    {
                        JRDesignSortField groupSortField = 
                            new JRDesignSortField(
                                chunk.getText(),
                                chunk.getType() == JRExpressionChunk.TYPE_FIELD 
                                    ? SortFieldTypeEnum.FIELD
                                    : SortFieldTypeEnum.VARIABLE,
                                SortOrderEnum.ASCENDING
                                );
                        individualCommandStack.execute(new AddSortFieldCommand(dataset, groupSortField));
                    }
                }
            }
        }
    }

    for (JRSortField crtSortField : sortFields)
    {
        if (
            newSortField.getName().equals(crtSortField.getName())
            && newSortField.getType() == crtSortField.getType()
            )
        {
            oldSortField = crtSortField;
            break;
        }
    }

    if (oldSortField != null)
    {
        individualCommandStack.execute(new RemoveSortFieldCommand(dataset, oldSortField));
    }

    if (sortOrder != null)
    {
        individualCommandStack.execute(new AddSortFieldCommand(dataset, newSortField));
    }
}
项目:ireport-fork    文件:CrosstabGroupNode.java   
@Override
public Object getDefaultValue()
{
    return SortOrderEnum.ASCENDING;
}
项目:ireport-fork    文件:CrosstabGroupNode.java   
@Override
public void setPropertyValue(Object order)
{
    bucket.setOrder((SortOrderEnum)order);
}
项目:jasperreports    文件:DesignDataLevelBucket.java   
/**
 * Sets the sorting type.
 * 
 * @param orderValue one of
 * <ul>
 *  <li>{@link SortOrderEnum#ASCENDING SortOrderEnum.ASCENDING}</li>
 *  <li>{@link SortOrderEnum#DESCENDING SortOrderEnum.DESCENDING}</li>
 * </ul>
 * @see DataLevelBucket#getOrder()
 * 
 * @deprecated replaced by {@link #setOrder(BucketOrder)}
 */
@Deprecated
public void setOrder(SortOrderEnum orderValue)
{
    BucketOrder order = BucketOrder.fromSortOrderEnum(orderValue);
    setOrder(order);
}
项目:jasperreports    文件:JRDesignCrosstabBucket.java   
/**
 * Sets the sorting type.
 * 
 * @param orderValue one of
 * <ul>
 *  <li>{@link SortOrderEnum#ASCENDING SortOrderEnum.ASCENDING}</li>
 *  <li>{@link SortOrderEnum#DESCENDING SortOrderEnum.DESCENDING}</li>
 * </ul>
 * @see net.sf.jasperreports.crosstabs.JRCrosstabBucket#getOrder()
 * 
 * @deprecated replaced by {@link #setOrder(BucketOrder)}
 */
@Deprecated
public void setOrder(SortOrderEnum orderValue)
{
    BucketOrder order = BucketOrder.fromSortOrderEnum(orderValue);
    setOrder(order);
}
项目:ireport-fork    文件:SortFieldCellRenderer.java   
@Override
public java.awt.Component getListCellRendererComponent(javax.swing.JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

    java.awt.Component retValue;

    retValue = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

    if (value instanceof JRDesignSortField && retValue instanceof JLabel)
    {
        JRDesignSortField sf = (JRDesignSortField)value;
        JLabel label = (JLabel)retValue;

        String t = sf.getType() == SortFieldTypeEnum.FIELD ? "Field" : "Variable";

        Color cf = Color.green.darker().darker();
        Color cv = Color.BLUE;
        String c = sf.getType() == SortFieldTypeEnum.FIELD ? getEncodedColor(cf) : getEncodedColor(cv);

        String text = "<html>" + sf.getName() + " " + ((isSelected) ? t : "<font color=\"" + c + "\">" + t + "</font>");


        label.setText( text);

        label.setIcon( sf.getOrderValue() == SortOrderEnum.DESCENDING ? descIcon : ascIcon );
    }

    return retValue;
}
项目:jasperreports    文件:JRDesignDataset.java   
/**
 * Removes a sort field from the dataset.
 * 
 * @param fieldName the field name
 * @return the removed sort field, or <code>null</code> if the sort field was not found
 * @deprecated To be removed.
 */
public JRSortField removeSortField(String fieldName)
{
    return removeSortField(sortFieldsMap.get(getSortFieldKey(new JRDesignSortField(fieldName, SortFieldTypeEnum.FIELD, SortOrderEnum.ASCENDING))));
}
项目:jasperreports    文件:JRSortField.java   
/**
 * Gets the sort order for the field.
 */
public SortOrderEnum getOrderValue();