本文整理汇总了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);
}
示例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;
}
示例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(",", "-") + "@";
}
示例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;
}
示例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;
}
}
}
}
示例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();
}