当前位置: 首页>>代码示例>>Java>>正文


Java IdName.getId方法代码示例

本文整理汇总了Java中ro.nextreports.engine.queryexec.IdName.getId方法的典型用法代码示例。如果您正苦于以下问题:Java IdName.getId方法的具体用法?Java IdName.getId怎么用?Java IdName.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ro.nextreports.engine.queryexec.IdName的用法示例。


在下文中一共展示了IdName.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getListCellRendererComponent

import ro.nextreports.engine.queryexec.IdName; //导入方法依赖的package包/类
public Component getListCellRendererComponent(JList list, Object value,
											  int index, boolean isSelected, boolean cellHasFocus) {
	if (value != null) {
           if (!(value instanceof String)) {
			IdName in = (IdName) value;
			if (in.getName() != null) {
				value = in.getName();
			} else {
				value = in.getId();
			}                
           }

           if (value instanceof Date) {
               value = sdf.format((Date)value);
           } else if (value instanceof Time) {
               value = sdf.format(new Date(((Time)value).getTime()));
           } else if (value instanceof Timestamp)  {
               value = sdf.format(new Date(((Timestamp)value).getTime()));
           }
       }
	return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:23,代码来源:IdNameRenderer.java

示例2: getSelectedValues

import ro.nextreports.engine.queryexec.IdName; //导入方法依赖的package包/类
private List<Serializable> getSelectedValues(List<IdName> values, List<Serializable> defaultValues) {
    List<Serializable> selectedValues = new ArrayList<Serializable>();
    if (defaultValues == null) {
        return selectedValues;
    }
    for (Serializable s : defaultValues) {
        for  (IdName in : values) {
            if (s instanceof IdName) {
                if ((in.getId() != null) && in.getId().equals( ((IdName)s).getId())) {
                    selectedValues.add(in);
                    break;
                }
            } else if ((in.getId() != null) && in.getId().equals(s)) {
                selectedValues.add(in);
                break;
            }
        }
    }
    
    return selectedValues;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:22,代码来源:ParameterRuntimePanel.java

示例3: getIdValue

import ro.nextreports.engine.queryexec.IdName; //导入方法依赖的package包/类
public String getIdValue(Object object, int index) {
    if (object == null) {
        return "";
    }

    if (!(object instanceof IdName)) {
        return object.toString();
    }

    IdName value = (IdName) object;
    if (value.getId() == null) {
        return Integer.toString(index);
    }            

    Object returnValue = value.getId();
    if (returnValue == null) {
        return "";
    }

    // IMPORTANT : if values start or end with space , on submit first rawValue will be ignored!
    // so we assure that the id never starts or ends with space!
    //
    // replace comma with other character (otherwise values with comma will be interpreted as two 
    // values and no selection will be done for them)
    return "@" + returnValue.toString().replace(",", "-") + "@";
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:27,代码来源:ParameterRuntimePanel.java

示例4: findIdName

import ro.nextreports.engine.queryexec.IdName; //导入方法依赖的package包/类
private IdName findIdName(List list, Serializable id) {
    for (int i = 0, size = list.size(); i < size; i++) {
        IdName in = (IdName) list.get(i);
        if (in.getId() == null) {
        	LOG.error("A value from select used in default values is null! and it is ignored");
        } else {
        	if (in.getId().equals(id)) {
        		return in;
        	}
        }
    }
    return null;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:14,代码来源:RuntimeParametersPanel.java

示例5: compare

import ro.nextreports.engine.queryexec.IdName; //导入方法依赖的package包/类
public int compare(IdName i1, IdName i2) {
    if (i1 == null) {
        return -1;
    } else if (i2 == null) {
        return 1;
    } else {
        Serializable name1 = i1.getName();
        Serializable name2 = i2.getName();
        if ( ((name1 != null) || (name2 != null)) && (orderBy == QueryParameter.ORDER_BY_NAME)) {
            if (name1 == null) {
                return -1;
            }
            if (name2 == null) {
                return 1;
            }
            if (name1 instanceof Integer) {
                return ((Integer) name1).compareTo((Integer) name2);
            } else if (name1 instanceof Double) {
                return ((Double) name1).compareTo((Double) name2);
            } else if (name1 instanceof Date) {
                return ((Date) name1).compareTo((Date) name2);
            } else if (name1 instanceof Timestamp) {
                return ((Timestamp) name1).compareTo((Timestamp) name2);
            } else if (name1 instanceof Time) {
                return ((Time) name1).compareTo((Time) name2);
            } else if (name1 instanceof String) {
                return ((String) name1).compareTo((String) name2);
            } else if (name1 instanceof BigDecimal) {
                return ((BigDecimal) name1).compareTo((BigDecimal) name2);
            } else {
                return (name1.toString()).compareTo(name2.toString());
            }
        } else {
            Serializable id1 = i1.getId();
            Serializable id2 = i2.getId();
            if ((id1 != null) && (id2 != null)) {
                if (id1 instanceof Integer) {
                    return ((Integer) id1).compareTo((Integer) id2);
                } else if (id1 instanceof Double) {
                    return ((Double) id1).compareTo((Double) id2);
                } else if (id1 instanceof Date) {
                    return ((Date) id1).compareTo((Date) id2);
                } else if (id1 instanceof Timestamp) {
                    return ((Timestamp) id1).compareTo((Timestamp) id2);
                } else if (id1 instanceof Time) {
                    return ((Time) id1).compareTo((Time) id2);
                } else if (id1 instanceof String) {
                    return ((String) id1).compareTo((String) id2);
                } else if (id1 instanceof BigDecimal) {
                    return ((BigDecimal) id1).compareTo((BigDecimal) id2);    
                } else {
                    return (id1.toString()).compareTo(id2.toString());
                }
            } else if (id1 == null) {
                return -1;
            } else {                
                return 1;
            }
        }
    }
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:62,代码来源:IdNameComparator.java

示例6: getDisplayValue

import ro.nextreports.engine.queryexec.IdName; //导入方法依赖的package包/类
public Object getDisplayValue(Object object) {
    IdName value = (IdName) object;
    return (value.getName() == null) ? value.getId() : value.getName();
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:5,代码来源:ParameterRuntimePanel.java


注:本文中的ro.nextreports.engine.queryexec.IdName.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。