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

项目:PDFReporter-Studio    文件:EnumHelper.java   
/**
 * 
 * @param jrEnum
 * @param nullable
 * @param skipPositions
 *          - 0-based index of the JREnum to be skipped
 * @return
 */
public static String[] getEnumNames(JREnum[] jrEnum, NullEnum nullable, Integer... skipPositions) {
    List<String> res = new ArrayList<String>();
    if (nullable != NullEnum.NOTNULL)
        res.add(nullable.getName());
    for (int i = 0; i < jrEnum.length; i++) {
        boolean skip = false;

        for (int j = 0; j < skipPositions.length; j++) {
            if (i == skipPositions[j]) {
                skip = true;
            }
        }

        if (!skip) {
            res.add(MessagesByKeys.getString(jrEnum[i].getName()));
        }
    }
    return res.toArray(new String[res.size()]);
}
项目:PDFReporter-Studio    文件:EnumHelper.java   
public static JREnum getSetValue(JREnum[] values, Object value, int offset, boolean isNull) {
    if (value != null) {
        if (value instanceof JREnum)
            return (JREnum) value;
        else if (value instanceof Number) {
            if (isNull && offset == 0)
                offset = -1;
            else if (!isNull && offset == 1)
                offset = 1;
            else
                offset = 0;
            return EnumUtil.getByValue(values, ((Number) value).intValue() + offset);
        }
    }
    return null;
}
项目:PDFReporter-Studio    文件:JSSEnumPropertyDescriptor.java   
public JSSEnumPropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type,
        int skipPositions) {
    super(id, displayName, EnumHelper.getEnumNames(jrEnum.getEnumConstants(), type, skipPositions));
    this.type = type;
    jrEnums = jrEnum.getEnumConstants();
    this.start = jrEnums[0].getValue();
}
项目:PDFReporter-Studio    文件:JSSPopupPropertyDescriptor.java   
public JSSPopupPropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type) {
    super(id, displayName, EnumHelper.getEnumNames(jrEnum.getEnumConstants(), type));
    this.type = type;
    jrEnums = jrEnum.getEnumConstants();
    this.start = jrEnums[0].getValue();
    setItemsToDefault();
}
项目:PDFReporter-Studio    文件:JSSPopupPropertyDescriptor.java   
public JSSPopupPropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type,
        List<ComboItem> items) {
    super(id, displayName, EnumHelper.getEnumNames(jrEnum.getEnumConstants(), type));
    jrEnums = jrEnum.getEnumConstants();
    this.start = jrEnums[0].getValue();
    this.items = items;
}
项目:PDFReporter-Studio    文件:JSSPopupPropertyDescriptor.java   
private void setItemsToDefault() {
    items = new ArrayList<ComboItem>();
    int offset = 0;
    if (type != NullEnum.NOTNULL) {
        items.add(new ComboItem(type.getName(), true, 0, type, 0));
        offset = 1;
    }
    for (int i = 0; i < jrEnums.length; i++) {
        JREnum actualValue = jrEnums[i];
        items.add(new ComboItem(actualValue.getName(), true, i + offset, actualValue, i + offset));
    }
}
项目:PDFReporter-Studio    文件:SPGroupTypeCombo.java   
public void setData(Integer et, String group, String[] items) {
    hasFirstFakeElement = false;
    int selection = 0;
    JREnum sel = EnumHelper.getSetValue(getEnumValues(), et, 1, false);
    boolean found = false;
    for (int i = 0; i < items.length; i++) {
        if (items[i].equals(sel.getName())) {
            selection = i;
            found = true;
            break;
        }
        if (items[i].startsWith(GROUPPREFIX) && sel.equals(getGroupEnum())) {
            if (items[i].substring(GROUPPREFIX.length()).equals(group)) {
                selection = i;
                found = true;
                break;
            }
        }
    }
    String[] comboItems = items;
    // If the group can't be found set a fake item
    if (!found && group != null && !group.isEmpty()) {
        List<String> newItems = new ArrayList<String>();
        newItems.add(MessageFormat.format(Messages.SPGroupTypeCombo_groupNotFounError, group));
        newItems.addAll(new ArrayList<String>(Arrays.asList(items)));
        comboItems = newItems.toArray(new String[newItems.size()]);
        hasFirstFakeElement = true;
    }
    combo.setItems(comboItems);
    combo.select(selection);
}
项目:PDFReporter-Studio    文件:EnumHelper.java   
public static String[] getEnumNames(JREnum[] jrEnum, NullEnum nullable) {
    List<String> res = new ArrayList<String>();
    if (nullable != NullEnum.NOTNULL)
        res.add(nullable.getName());
    for (int i = 0; i < jrEnum.length; i++) {
        res.add(MessagesByKeys.getString(jrEnum[i].getName()));
    }
    return res.toArray(new String[res.size()]);
}
项目:PDFReporter-Studio    文件:EnumHelper.java   
public static Integer getValue(JREnum jrEnum, int offset, boolean isNull) {
    if (jrEnum == null)
        return new Integer(0);
    if (isNull && offset == 0)
        offset = -1;
    else if (!isNull && offset == 1)
        offset = 1;
    else
        offset = 0;

    return new Integer(jrEnum.getValue() - offset);
}
项目:PDFReporter-Studio    文件:EnumHelper.java   
/**
 * Retrieves the correct {@link JREnum} instance which name translation matches the specified one.
 * 
 * @param enums
 *          a list of enumerations to look into
 * @param translatedName
 *          the translated name to match
 * @return the correct enum, <code>null</code> otherwise
 */
public static JREnum getEnumByTranslatedName(JREnum[] enums, String translatedName) {
    Assert.isNotNull(translatedName);
    for(JREnum e : enums){
        if (translatedName.equals(MessagesByKeys.getString(e.getName()))){
            return e;
        }
    }
    return null;
}
项目:jasperreports    文件:XmlConstantPropertyRule.java   
public XmlConstantPropertyRule(String attributeName, JREnum[] values)
{
    this(attributeName, (NamedEnum[]) values);
}
项目:jasperreports    文件:XmlConstantPropertyRule.java   
public XmlConstantPropertyRule(String attributeName, String propertyName, 
        JREnum[] values)
{
    this(attributeName, propertyName, (NamedEnum[]) values);
}
项目:jasperreports    文件:JRXmlWriteHelper.java   
public void addAttribute(String name, JREnum value)
{
    addAttribute(name, (NamedEnum) value);
}
项目:jasperreports    文件:JRXmlWriteHelper.java   
public void addAttribute(String name, JREnum value, JREnum defaultValue)
{
    addAttribute(name, (NamedEnum) value, (NamedEnum) defaultValue);
}
项目:PDFReporter-Studio    文件:VAlignPropertyDescriptor.java   
public VAlignPropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type) {
    super(id, displayName, jrEnum, type);
}
项目:PDFReporter-Studio    文件:EdgePropertyDescriptor.java   
public EdgePropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type) {
    super(id, displayName, jrEnum, type);
}
项目:PDFReporter-Studio    文件:HAlignPropertyDescriptor.java   
public HAlignPropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type) {
    super(id, displayName, jrEnum, type);
}
项目:PDFReporter-Studio    文件:RotationPropertyDescriptor.java   
public RotationPropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type) {
    super(id, displayName, jrEnum, type);
}
项目:PDFReporter-Studio    文件:JSSEnumPropertyDescriptor.java   
public JSSEnumPropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type) {
    super(id, displayName, EnumHelper.getEnumNames(jrEnum.getEnumConstants(), type));
    this.type = type;
    jrEnums = jrEnum.getEnumConstants();
    this.start = jrEnums[0].getValue();
}
项目:PDFReporter-Studio    文件:JSSEnumPropertyDescriptor.java   
public Integer getEnumValue(JREnum jrvalue) {
    return EnumHelper.getValue(jrvalue, start, type != NullEnum.NOTNULL);
}
项目:PDFReporter-Studio    文件:JSSEnumPropertyDescriptor.java   
public JREnum getEnumValue(Object value) {
    return EnumHelper.getSetValue(jrEnums, value, start, type != NullEnum.NOTNULL);
}
项目:PDFReporter-Studio    文件:JSSEnumPropertyDescriptor.java   
public JREnum[] getJrEnums() {
    return jrEnums;
}
项目:PDFReporter-Studio    文件:OpaqueModePropertyDescriptor.java   
public OpaqueModePropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type) {
    super(id, displayName, jrEnum, type);
}
项目:PDFReporter-Studio    文件:LineStylePropertyDescriptor.java   
public LineStylePropertyDescriptor(Object id, String displayName, Class<? extends JREnum> jrEnum, NullEnum type) {
    super(id, displayName, jrEnum, type);
}
项目:PDFReporter-Studio    文件:JSSPopupPropertyDescriptor.java   
public Integer getEnumValue(JREnum jrvalue) {
    return EnumHelper.getValue(jrvalue, start, type != NullEnum.NOTNULL);
}
项目:PDFReporter-Studio    文件:JSSPopupPropertyDescriptor.java   
public JREnum getEnumValue(Object value) {
    return EnumHelper.getSetValue(jrEnums, value, start, type != NullEnum.NOTNULL);
}
项目:PDFReporter-Studio    文件:JSSPopupPropertyDescriptor.java   
public JREnum[] getJrEnums() {
    return jrEnums;
}
项目:PDFReporter-Studio    文件:SPEvaluationTime.java   
@Override
protected JREnum[] getEnumValues() {
    return EvaluationTimeEnum.values();
}
项目:PDFReporter-Studio    文件:SPEvaluationTime.java   
@Override
protected JREnum getGroupEnum() {
    return EvaluationTimeEnum.GROUP;
}
项目:PDFReporter-Studio    文件:SPEvaluationTime.java   
@Override
protected JREnum getByName(String name) {
    return EvaluationTimeEnum.getByName(name);
}
项目:PDFReporter-Studio    文件:SPIncrementType.java   
@Override
protected JREnum[] getEnumValues() {
    return IncrementTypeEnum.values();
}
项目:PDFReporter-Studio    文件:SPIncrementType.java   
@Override
protected JREnum getGroupEnum() {
    return IncrementTypeEnum.GROUP;
}
项目:PDFReporter-Studio    文件:SPIncrementType.java   
@Override
protected JREnum getByName(String name) {
    return IncrementTypeEnum.getByName(name);
}
项目:PDFReporter-Studio    文件:SPResetType.java   
@Override
protected JREnum[] getEnumValues() {
    return ResetTypeEnum.values();
}
项目:PDFReporter-Studio    文件:SPResetType.java   
@Override
protected JREnum getGroupEnum() {
    return ResetTypeEnum.GROUP;
}
项目:PDFReporter-Studio    文件:SPResetType.java   
@Override
protected JREnum getByName(String name) {
    return ResetTypeEnum.getByName(name);
}
项目:PDFReporter-Studio    文件:EnumHelper.java   
public static String[] getEnumNames(Class<? extends JREnum> jrEnum, NullEnum type) {
    JREnum[] enums = jrEnum.getEnumConstants();
    return getEnumNames(enums, type);
}
项目:PDFReporter-Studio    文件:EnumHelper.java   
public static Integer getValue(JREnum jrEnum) {
    return getValue(jrEnum, 1, false);
}
项目:PDFReporter-Studio    文件:SPGroupTypeCombo.java   
/**
 * Return the enumerations selectable on this element
 * 
 * @return the list of enumerations that can be selected
 */
protected abstract JREnum[] getEnumValues();
项目:PDFReporter-Studio    文件:SPGroupTypeCombo.java   
/**
 * Return the group enumeration for the element
 * 
 * @return the enumeration corresponding to group
 */
protected abstract JREnum getGroupEnum();