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

项目: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;
}
项目:PDFReporter-Studio    文件:MSortField.java   
public Object getPropertyValue(Object id) {
    JRDesignSortField jrField = (JRDesignSortField) getValue();
    if (id.equals(JRDesignSortField.PROPERTY_NAME))
        return jrField.getName();
    if (id.equals(JRDesignSortField.PROPERTY_ORDER)) {
        if (orderD == null)
            getPropertyDescriptors();
        return orderD.getEnumValue(jrField.getOrderValue());
    }
    if (id.equals(JRDesignSortField.PROPERTY_TYPE)) {
        if (typeD == null)
            getPropertyDescriptors();
        return typeD.getEnumValue(jrField.getType());
    }
    return null;
}
项目: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   
/**
 * This function replace the list.
 * The replacement is done removing each single SortField and adding all the fields again
 * reading them by the list model.
 */
private void updateDatasetSortFieldList()
{

    while (getDataset().getSortFieldsList().size() > 0)
        {
            JRDesignSortField field = (JRDesignSortField)getDataset().getSortFieldsList().get(0);
            getDataset().removeSortField(field);
        }

        DefaultListModel dlm = (DefaultListModel)jList1.getModel();
        for (int i=0; i<dlm.getSize(); ++i)
        {
            try {
                getDataset().addSortField( (JRDesignSortField)dlm.get(i) );
            } catch (Exception ex) {}
        }

}
项目: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();

    }
项目:ireport-fork    文件:SortFieldsDialog.java   
private void jButtonModifyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModifyActionPerformed

        // get selected sortfield...
        if (jList1.getSelectedIndex() >= 0)
        {
            JRDesignSortField field = (JRDesignSortField)jList1.getSelectedValue();
            SortFieldDialog sfd = new SortFieldDialog(this, true);
            sfd.setDataset( getDataset() );
            sfd.setSortField( field );

            sfd.setVisible(true);

            if (sfd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION)
            {
                field.setName( sfd.getSortField().getName() );
                field.setOrder( sfd.getSortField().getOrderValue() );
                jList1.updateUI();
            }
            updateDatasetSortFieldList();
        }
    }
项目:ireport-fork    文件:SortFieldsDialog.java   
private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed

        SortFieldDialog jrpd = new SortFieldDialog(this, true);
        jrpd.setDataset( getDataset() );
        jrpd.setVisible(true);

        if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION)
        {

            JRDesignSortField field = jrpd.getSortField();
            ((DefaultListModel)jList1.getModel()).addElement(field);
            try {
                getDataset().addSortField( field );
            } catch (Exception ex) { }
        }


    }
项目: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    文件:SortFieldsTable.java   
public String getColumnText(Object element, int columnIndex) {
    JRDesignSortField field = (JRDesignSortField) element;
    switch (columnIndex) {
    case 0:
        return field.getName();
    case 1:
        return field.getType().getName();
    case 2:
        if (field.getOrderValue() != null)
            return field.getOrderValue().getName();
    }
    return ""; //$NON-NLS-1$
}
项目:PDFReporter-Studio    文件:SortFieldsTable.java   
public Image getColumnImage(Object element, int columnIndex) {
    JRDesignSortField field = (JRDesignSortField) element;
    switch (columnIndex) {
    case 0:
        if (field.getType().equals(SortFieldTypeEnum.FIELD))
            return JaspersoftStudioPlugin.getInstance().getImage(MField.getIconDescriptor().getIcon16());
        else
            return JaspersoftStudioPlugin.getInstance().getImage(MVariable.getIconDescriptor().getIcon16());
    }
    return null; //$NON-NLS-1$
}
项目:PDFReporter-Studio    文件:SortFieldSection.java   
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

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

    ASPropertyWidget nameWidget = createWidget4Property(parent, JRDesignSortField.PROPERTY_NAME);
    nameWidget.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    createWidget4Property(parent, JRDesignSortField.PROPERTY_TYPE);
    createWidget4Property(parent, JRDesignSortField.PROPERTY_ORDER);
}
项目:PDFReporter-Studio    文件:SortFieldSection.java   
@Override
protected void initializeProvidedProperties() {
    super.initializeProvidedProperties();
    addProvidedProperties(JRDesignSortField.PROPERTY_NAME, Messages.common_name);
    addProvidedProperties(JRDesignSortField.PROPERTY_TYPE, Messages.MSortField_typeTitle);
    addProvidedProperties(JRDesignSortField.PROPERTY_ORDER, Messages.common_order);
}
项目:PDFReporter-Studio    文件:SortFieldSection.java   
protected Command getChangePropertyCommand(Object property, Object newValue, APropertyNode n) {
    if (property.equals(JRDesignSortField.PROPERTY_TYPE)){
        //reopen the wizard to select an unique name
        return new ChangeSortFieldTypeCommand((MSortFields)n.getParent(), (MSortField)n);
    } else if (property.equals(JRDesignSortField.PROPERTY_NAME)){
        return new ChangeSortFieldNameCommand((MSortFields)n.getParent(), (MSortField)n, (String)newValue);
    } else {
        return super.getChangePropertyCommand(property, newValue, n);
    }
}
项目:PDFReporter-Studio    文件:PostSetVariableName.java   
/**
 * Get a list of all the Sortfield that are using a variable, and if one of them is using
 * the renamed variable then its name also is updated with the new one
 */
@Override
public Command postSetValue(IPropertySource target, Object prop, Object newValue, Object oldValue) {
    JSSCompoundCommand c = new JSSCompoundCommand(null);
    if (target instanceof MVariable && prop.equals(JRDesignVariable.PROPERTY_NAME)) {
        MVariable targetNode = (MVariable) target;
        c.setReferenceNodeIfNull(targetNode);
        JRDesignDataset d = ModelUtils.getDataset(targetNode);
        if (d != null){
            for(INode field : ModelUtils.getSortFields(targetNode)){
                APropertyNode sortField = (APropertyNode)field;
                JRDesignSortField jrField = (JRDesignSortField) sortField.getValue();
                if (jrField != null){
                    Object fieldName = jrField.getName();
                    Object fieldType = jrField.getType();
                    if (SortFieldTypeEnum.VARIABLE.equals(fieldType) && fieldName != null && fieldName.equals(oldValue)){
                        SetValueCommand updateSFCommand = new SetValueCommand();
                        updateSFCommand.setTarget(sortField);
                        updateSFCommand.setPropertyId(JRDesignSortField.PROPERTY_NAME);
                        updateSFCommand.setPropertyValue(newValue);
                        c.add(updateSFCommand);
                    }
                }
            }
        }
    }
    return c;
}
项目:PDFReporter-Studio    文件:MSortField.java   
public ImageDescriptor getImagePath() {
    if (getValue() != null) {
        JRDesignSortField sortField = (JRDesignSortField) getValue();
        if (sortField.getType().equals(SortFieldTypeEnum.FIELD))
            return MField.getIconDescriptor().getIcon16();
        if (sortField.getType().equals(SortFieldTypeEnum.VARIABLE))
            return MVariable.getIconDescriptor().getIcon16();
    }
    return getIconDescriptor().getIcon16();
}
项目: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$
}
项目:PDFReporter-Studio    文件:MSortField.java   
/**
 * Change the name and the type of the sortfields updating also its entry
 * in the dataset map
 * 
 * @param oldName the old name
 * @param oldType the old type
 * @param newName the new name
 * @param newType the new type
 * @param field the field
 */
private void changeNameAndType(String oldName, String oldType, String newName, SortFieldTypeEnum newType, JRSortField field){
    JRDesignDataset d = ModelUtils.getDataset(this);
    if (d != null) {
        String oldKey = getSortFieldKey(oldName, oldType);
        d.getSortFieldsMap().remove(oldKey);
        d.getSortFieldsMap().put(getSortFieldKey(newName, newType.getName()), field);
        JRDesignSortField jrField = (JRDesignSortField) field;
        jrField.setName(newName);
        jrField.setType(newType);
    }
}
项目:PDFReporter-Studio    文件:ChangeSortFieldTypeCommand.java   
@Override
public void execute() {
    if (jrField != null) {
        oldName = jrField.getName();
        oldType = jrField.getType();
        jrDataSet.getSortFieldsMap().remove(getSortFieldKey(jrField));

        SortFieldWizard wizard = new SortFieldWizard();
        JRDesignSortField dummyField = new JRDesignSortField();
        wizard.init(jrDataSet, dummyField);
        if (jrField.getType() == SortFieldTypeEnum.FIELD) {
            dummyField.setType(SortFieldTypeEnum.VARIABLE);
            wizard.setShownElementsType(SHOW_TYPE.VARIABLES);
        } else {
            dummyField.setType(SortFieldTypeEnum.FIELD);
            wizard.setShownElementsType(SHOW_TYPE.FIELDS);
        }
        WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard);
        dialog.create();
        if (dialog.open() != Dialog.OK) {
            oldName = null;
            oldType = null;
        } else {
            jrField.setType(dummyField.getType());
            jrField.setName(dummyField.getName());
        }
        jrDataSet.getSortFieldsMap().put(getSortFieldKey(jrField), jrField);
    }
}
项目:PDFReporter-Studio    文件:WizardSortFieldPage.java   
public WizardSortFieldPage(JRDesignDataset jrDataset, JRDesignSortField jrSortField) {
    super("sortfieldpage"); //$NON-NLS-1$
    this.jrDataset = jrDataset;
    this.jrSortfield = jrSortField;
    setTitle(Messages.WizardSortFieldPage_Title);
    setDescription(Messages.WizardSortFieldPage_Description);
}
项目:PDFReporter-Studio    文件:ChangeSortFieldNameCommand.java   
@Override
public void execute() {
    if (oldFieldModel.getValue() != null) {
        JRDesignSortField sortField = (JRDesignSortField)oldFieldModel.getValue();
        oldName = sortField.getName();
        //Don't do anything if the name is the same
        if (oldName.equals(newName)) return;
        jrDataSet.getSortFieldsMap().remove(getSortFieldKey(sortField));
        sortField.setName(newName);
        jrDataSet.getSortFieldsMap().put(getSortFieldKey(sortField), sortField);
    }
}
项目:PDFReporter-Studio    文件:ChangeSortFieldNameCommand.java   
@Override
public void undo() {
    JRDesignSortField sortField = (JRDesignSortField)oldFieldModel.getValue();
    if (oldName.equals(newName)) return;
    jrDataSet.getSortFieldsMap().remove(getSortFieldKey(sortField));
    sortField.setName(oldName);
    jrDataSet.getSortFieldsMap().put(getSortFieldKey(sortField), sortField);
    oldName = null;
}
项目:PDFReporter-Studio    文件:PostSetFieldName.java   
/**
 * Get a list of all the Sortfield that are using a field, and if one of them is using
 * the renamed field then its name also is updated with the new one
 */
@Override
public Command postSetValue(IPropertySource target, Object prop, Object newValue, Object oldValue) {
    JSSCompoundCommand c = new JSSCompoundCommand(null);
    if (target instanceof MField && prop.equals(JRDesignField.PROPERTY_NAME)) {
        MField targetNode = (MField) target;
        c.setReferenceNodeIfNull(targetNode);
        JRDesignDataset d = ModelUtils.getDataset(targetNode);
        if (d != null){
            for(INode field : ModelUtils.getSortFields(targetNode)){
                APropertyNode sortField = (APropertyNode)field;
                JRDesignSortField jrField = (JRDesignSortField) sortField.getValue();
                if (jrField != null){
                    Object sortFieldName = jrField.getName();
                    Object sortFieldType = jrField.getType();
                    if (SortFieldTypeEnum.FIELD.equals(sortFieldType) && sortFieldName != null && sortFieldName.equals(oldValue)){
                        SetValueCommand updateSFCommand = new SetValueCommand();
                        updateSFCommand.setTarget(sortField);
                        updateSFCommand.setPropertyId(JRDesignSortField.PROPERTY_NAME);
                        updateSFCommand.setPropertyValue(newValue);
                        c.add(updateSFCommand);
                    }
                }
            }
        }
    }
    return c;
}
项目:ireport-fork    文件:SortFieldsDialog.java   
private void jButtonRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemoveActionPerformed

        if (jList1.getSelectedValues() != null)
        {
            Object[] values = jList1.getSelectedValues();
            for (int i=0; i<values.length; ++i)
            {
                JRDesignSortField field = (JRDesignSortField)values[i];
                ((DefaultListModel)jList1.getModel()).removeElement(field);
                getDataset().removeSortField( field );
            }
        }


    }
项目:ireport-fork    文件:SortFieldsDialog.java   
public void setDataset(JRDesignDataset dataset) {
    this.dataset = dataset;
    List cp = dataset.getSortFieldsList();
    for (int i=0; i<cp.size(); ++i) {
        ((DefaultListModel)jList1.getModel()).addElement( (JRDesignSortField)cp.get(i) );
    }
}
项目: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    文件: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));
    }
}
项目:jasperreports    文件:AddSortFieldCommand.java   
/**
 * 
 */
public AddSortFieldCommand(JRDesignDataset dataset, JRDesignSortField sortField) 
{
    this.dataset = dataset;
    this.sortField = sortField;
}
项目:PDFReporter-Studio    文件:SortFieldsTable.java   
public List<JRDesignSortField> getFields() {
    return (List<JRDesignSortField>) tviewer.getInput();
}
项目:PDFReporter-Studio    文件:MSortField.java   
public String getDisplayText() {
    return ((JRDesignSortField) getValue()).getName();
}
项目:PDFReporter-Studio    文件:SortFieldWizard.java   
public void init(JRDesignDataset jd, JRDesignSortField sortField) {
    this.jrDataSet = jd;
    this.jrSortField = sortField;
}
项目:PDFReporter-Studio    文件:WizardSortFieldPage.java   
public WizardSortFieldPage(JRDesignDataset jrDataset, JRDesignSortField jrSortField, SHOW_TYPE showType) {
    this(jrDataset, jrSortField);
    this.showType = showType;
}
项目:PDFReporter-Studio    文件:CreateSortFieldCommand.java   
public CreateSortFieldCommand(JRDesignDataset destNode, JRDesignSortField srcNode, int index) {
    super();
    this.jrDataSet = destNode;
    this.index = index;
    this.jrField = srcNode;
}
项目:ireport-fork    文件:SortFieldDialog.java   
/**
 * return a new sortField instance
 */
public JRDesignSortField getSortField() {
    return tmpSortField;
}
项目:dynamicreports-jasper    文件:MainDatasetExpressionTransform.java   
@Override
protected void addSort(JRDesignSortField sort) throws JRException {
    accessor.getDesign().addSortField(sort);
}
项目:dynamicreports-jasper    文件:DatasetExpressionTransform.java   
@Override
protected void addSort(JRDesignSortField sort) throws JRException {
    jrDataset.addSortField(sort);
}
项目:PDFReporter-Studio    文件:ReorderSortFieldCommand.java   
/**
 * Instantiates a new reorder field command.
 * 
 * @param child
 *          the child
 * @param parent
 *          the parent
 * @param newIndex
 *          the new index
 */
public ReorderSortFieldCommand(MSortField child, MSortFields parent, int newIndex) {
    super(Messages.common_reorder_elements);

    this.newIndex = Math.max(0, newIndex);
    this.jrDataset = (JRDesignDataset) parent.getValue();
    this.jrField = (JRDesignSortField) child.getValue();
}
项目:PDFReporter-Studio    文件:CreateSortFieldCommand.java   
/**
 * Instantiates a new creates the field command.
 * 
 * @param destNode
 *          the dest node
 * @param srcNode
 *          the src node
 * @param index
 *          the index
 */
public CreateSortFieldCommand(MSortFields destNode, MSortField srcNode, int index) {
    super();
    this.jrDataSet = (JRDesignDataset) destNode.getValue();
    this.index = index;
    if (srcNode != null && srcNode.getValue() != null)
        this.jrField = (JRDesignSortField) srcNode.getValue();
}
项目: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;
}