use of org.apache.pivot.util.CalendarDate in project pivot by apache.
the class ExpenseSheet method clear.
@Override
public void clear() {
super.clear();
// Set date to today
dateSpinner.setSelectedItem(new CalendarDate());
}
use of org.apache.pivot.util.CalendarDate in project pivot by apache.
the class Pivot714 method getWindow.
public Window getWindow(final Window ownerArgument) {
this.owner = ownerArgument;
final BXMLSerializer bxmlSerializer = new BXMLSerializer();
try {
result = (Dialog) bxmlSerializer.readObject(Pivot714.class.getResource("pivot_714.bxml"));
} catch (IOException e) {
e.printStackTrace();
} catch (SerializationException e) {
e.printStackTrace();
}
final ListButton motif = (ListButton) bxmlSerializer.getNamespace().get("motif");
ArrayList<String> al = new ArrayList<>();
al.add("One");
al.add("Two");
motif.setListData(al);
CalendarButton cbDate = (CalendarButton) bxmlSerializer.getNamespace().get("date");
dcl = (new DialogCloseListener() {
@Override
public void dialogClosed(Dialog dialog, boolean modal) {
// empty block
}
});
cbDate.getCalendarButtonSelectionListeners().add(new CalendarButtonSelectionListener() {
@Override
public void selectedDateChanged(CalendarButton calendarButton, CalendarDate previousSelectedDate) {
// empty block
}
});
return result;
}
use of org.apache.pivot.util.CalendarDate in project pivot by apache.
the class TableViewDateCellRenderer method toString.
@Override
public String toString(Object row, String columnName) {
Object cellData = JSON.get(row, columnName);
String string;
if (cellData instanceof Date) {
string = dateFormat.format((Date) cellData);
} else if (cellData instanceof Long) {
string = dateFormat.format(new Date((Long) cellData));
} else if (cellData instanceof Calendar) {
string = dateFormat.format(((Calendar) cellData).getTime());
} else if (cellData instanceof CalendarDate) {
string = dateFormat.format(((CalendarDate) cellData).toCalendar().getTime());
} else {
string = (cellData == null) ? null : cellData.toString();
}
return string;
}
use of org.apache.pivot.util.CalendarDate in project pivot by apache.
the class CalendarButton method setSelectedDate.
/**
* Sets the selected date.
*
* @param selectedDate The date to select, or <tt>null</tt> to clear the
* selection.
*/
public void setSelectedDate(CalendarDate selectedDate) {
CalendarDate previousSelectedDate = this.selectedDate;
if (previousSelectedDate != selectedDate) {
this.selectedDate = selectedDate;
calendarButtonSelectionListeners.selectedDateChanged(this, previousSelectedDate);
}
}
use of org.apache.pivot.util.CalendarDate in project pivot by apache.
the class Calendar method load.
@Override
public void load(Object context) {
if (selectedDateKey != null && JSON.containsKey(context, selectedDateKey) && selectedDateBindType != BindType.STORE) {
Object value = JSON.get(context, selectedDateKey);
CalendarDate selectedDateLocal = null;
if (value instanceof CalendarDate) {
selectedDateLocal = (CalendarDate) value;
} else if (selectedDateBindMapping == null) {
if (value != null) {
selectedDateLocal = CalendarDate.decode(value.toString());
}
} else {
selectedDateLocal = selectedDateBindMapping.toDate(value);
}
setSelectedDate(selectedDateLocal);
}
}
Aggregations