BF[2779142] time control doesn't work
This commit is contained in:
parent
6050c6a05f
commit
b34957e242
|
|
@ -25,32 +25,32 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zul.Timebox;
|
import org.zkoss.zul.Timebox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*/
|
*/
|
||||||
public class WTimeEditor extends WEditor
|
public class WTimeEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
logger = CLogger.getCLogger(WDateEditor.class);
|
logger = CLogger.getCLogger(WDateEditor.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Timestamp oldValue = new Timestamp(0);
|
private Timestamp oldValue = new Timestamp(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param gridField
|
* @param gridField
|
||||||
*/
|
*/
|
||||||
public WTimeEditor(GridField gridField)
|
public WTimeEditor(GridField gridField)
|
||||||
{
|
{
|
||||||
super(new Timebox(), gridField);
|
super(new Timebox(), gridField);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param columnName
|
* @param columnName
|
||||||
* @param mandatory
|
* @param mandatory
|
||||||
* @param readonly
|
* @param readonly
|
||||||
|
|
@ -62,10 +62,10 @@ public class WTimeEditor extends WEditor
|
||||||
{
|
{
|
||||||
super(new Timebox(), columnName, title, null, mandatory, readonly, updateable);
|
super(new Timebox(), columnName, title, null, mandatory, readonly, updateable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for use if a grid field is unavailable
|
* Constructor for use if a grid field is unavailable
|
||||||
*
|
*
|
||||||
* @param label
|
* @param label
|
||||||
* column name (not displayed)
|
* column name (not displayed)
|
||||||
* @param description
|
* @param description
|
||||||
|
|
@ -82,24 +82,24 @@ public class WTimeEditor extends WEditor
|
||||||
super(new Timebox(), label, description, mandatory, readonly, updateable);
|
super(new Timebox(), label, description, mandatory, readonly, updateable);
|
||||||
setColumnName("Time");
|
setColumnName("Time");
|
||||||
}
|
}
|
||||||
|
|
||||||
public WTimeEditor()
|
public WTimeEditor()
|
||||||
{
|
{
|
||||||
this("Time", "Time", false, false, true);
|
this("Time", "Time", false, false, true);
|
||||||
} // VDate
|
} // VDate
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
{
|
{
|
||||||
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()))
|
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()))
|
||||||
{
|
{
|
||||||
Date date = getComponent().getValue();
|
Date date = getComponent().getValue();
|
||||||
Timestamp newValue = null;
|
Timestamp newValue = null;
|
||||||
|
|
||||||
if (date != null)
|
if (date != null)
|
||||||
{
|
{
|
||||||
newValue = new Timestamp(date.getTime());
|
newValue = new Timestamp(date.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
|
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
oldValue = newValue;
|
oldValue = newValue;
|
||||||
|
|
@ -152,7 +152,7 @@ public class WTimeEditor extends WEditor
|
||||||
logger.log(Level.SEVERE, "New field value is not of type timestamp");
|
logger.log(Level.SEVERE, "New field value is not of type timestamp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Timebox getComponent() {
|
public Timebox getComponent() {
|
||||||
return (Timebox) component;
|
return (Timebox) component;
|
||||||
|
|
@ -174,4 +174,7 @@ public class WTimeEditor extends WEditor
|
||||||
return LISTENER_EVENTS;
|
return LISTENER_EVENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fillHorizontal() {
|
||||||
|
//do nothing, can't stretch a timebox
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue