📄 ware.java
字号:
package com.niis.myprice.domain;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.niis.myprice.util.message.Messages;
public class Ware extends Node {
private double price;
private Date updDate;
private static final String DATE_FORMAT_DISPLAY = Messages.getString("Ware.dataformat"); //$NON-NLS-1$
private static final String DATE_FORMAT_SAVE = "yyyy-MM-dd HH:mm"; //$NON-NLS-1$
public Ware(Kind parent){
this.parent = parent;
if (parent != null) {
parent.addChild(this);
}
}
public Ware(int num, String name, String desc, Kind parent,double price) {
this.num = num;
this.name = name;
this.desc = desc;
this.price = price;
this.updDate = new Date();
this.parent = parent;
if (parent != null) {
parent.addChild(this);
}
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public Date getUpdDate() {
return updDate;
}
public void setUpdDate(Date updDate) {
this.updDate = updDate;
}
public void setUpdDate(String updDate) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_SAVE);
try{
this.updDate = sdf.parse(updDate) ;
}catch(Exception e){
e.printStackTrace();
}
}
public String getSaveUpdDate() {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_SAVE);
return sdf.format(updDate);
}
public String getDisplayNum(){
if(num ==0){
return ""; //$NON-NLS-1$
}
return String.valueOf(num);
}
public String getDisplayName(){
if(name == null){
return ""; //$NON-NLS-1$
}
return name;
}
public String getDisplayDesc(){
if(desc == null){
return ""; //$NON-NLS-1$
}
return desc;
}
public String getDisplayPrice(){
if(price == 0){
return ""; //$NON-NLS-1$
}
return String.valueOf(price);
}
public String getDisplayUpdDate(){
if(updDate == null){
return "";
}
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_DISPLAY);
return sdf.format(updDate);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -