GUAC-1213: Add date and time fields, along with corresponding template/controller stubs.

This commit is contained in:
Michael Jumper
2015-08-10 10:04:14 -07:00
parent 225297746d
commit 2e52382fd9
10 changed files with 230 additions and 20 deletions

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2015 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.form;
/**
* Represents a date field. The field may contain only date values which
* conform to a standard pattern, defined by DateField.FORMAT.
*
* @author Michael Jumper
*/
public class DateField extends Field {
/**
* The date format used by date fields, compatible with SimpleDateFormat.
*/
public static final String FORMAT = "yyyy-MM-dd";
/**
* Creates a new DateField with the given name.
*
* @param name
* The unique name to associate with this field.
*/
public DateField(String name) {
super(name, Field.Type.DATE);
}
}

View File

@@ -90,6 +90,18 @@ public class Field {
*/
public static String TIMEZONE = "TIMEZONE";
/**
* A date field whose legal values conform to the pattern "YYYY-MM-DD",
* zero-padded.
*/
public static String DATE = "DATE";
/**
* A time field whose legal values conform to the pattern "HH:MM:SS",
* zero-padded, 24-hour.
*/
public static String TIME = "TIME";
}
/**

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2015 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.form;
/**
* Represents a time field. The field may contain only time values which
* conform to a standard pattern, defined by TimeField.FORMAT.
*
* @author Michael Jumper
*/
public class TimeField extends Field {
/**
* The time format used by time fields, compatible with SimpleDateFormat.
*/
public static final String FORMAT = "HH:mm:ss";
/**
* Creates a new TimeField with the given name.
*
* @param name
* The unique name to associate with this field.
*/
public TimeField(String name) {
super(name, Field.Type.TIME);
}
}