/** * Searches for a comboitem that has a label that matches the specified value. The search is * case insensitive. * * @param label Label text to find. * @return A comboitem with a matching label., or null if not found. */ public Dateitem findMatchingItem(String label) { for (BaseComponent child : getChildren()) { Dateitem item = (Dateitem) child; if (label.equalsIgnoreCase(item.getLabel())) { return item; } } return null; }
/** * If set to true, the user may select "Custom..." from the choice list and enter a custom date * range. If set to false, this choice is hidden and any existing custom entries are removed * from the list. * * @param allowCustom Determines whether or not custom entries are allowed. */ @PropertySetter("allowCustom") public void setAllowCustom(boolean allowCustom) { customItem.setVisible(allowCustom); if (!allowCustom) { BaseComponent sibling; while ((sibling = customItem.getNextSibling()) != null) { sibling.destroy(); } } }
/** * Returns the date range item that is currently selected. * * @return Selected date range item, or null if none selected. */ public DateRange getSelectedRange() { Dateitem selected = getSelectedItem(); return selected == null ? null : (DateRange) selected.getData(); }
/** * Returns true if custom ranges are allowed. * * @return True if custom ranges are allowed. */ @PropertyGetter("allowCustom") public boolean isAllowCustom() { return customItem.isVisible(); }