1 2 /** 3 * Copyright 2004 Juan Heyns. All rights reserved. 4 * <p/> 5 * Redistribution and use in source and binary forms, with or without modification, are 6 * permitted provided that the following conditions are met: 7 * <p/> 8 * 1. Redistributions of source code must retain the above copyright notice, this list of 9 * conditions and the following disclaimer. 10 * <p/> 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 * of conditions and the following disclaimer in the documentation and/or other materials 13 * provided with the distribution. 14 * <p/> 15 * THIS SOFTWARE IS PROVIDED BY JUAN HEYNS ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 17 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JUAN HEYNS OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * <p/> 25 * The views and conclusions contained in the software and documentation are those of the 26 * authors and should not be interpreted as representing official policies, either expressed 27 * or implied, of Juan Heyns. 28 */ 29 package fr.ifremer.quadrige3.ui.swing.component.date; 30 31 /* 32 * #%L 33 * Reef DB :: UI 34 * $Id:$ 35 * $HeadURL:$ 36 * %% 37 * Copyright (C) 2014 - 2015 Ifremer 38 * %% 39 * This program is free software: you can redistribute it and/or modify 40 * it under the terms of the GNU Affero General Public License as published by 41 * the Free Software Foundation, either version 3 of the License, or 42 * (at your option) any later version. 43 * 44 * This program is distributed in the hope that it will be useful, 45 * but WITHOUT ANY WARRANTY; without even the implied warranty of 46 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 47 * GNU General Public License for more details. 48 * 49 * You should have received a copy of the GNU Affero General Public License 50 * along with this program. If not, see <http://www.gnu.org/licenses/>. 51 * #L% 52 */ 53 54 import java.text.SimpleDateFormat; 55 public final class ComponentFormatDefaults extends AbstractComponentFormat implements Cloneable { 56 57 private static ComponentFormatDefaults instance; 58 59 /** 60 * <p>Getter for the field <code>instance</code>.</p> 61 * 62 * @return a {@link ComponentFormatDefaults} object. 63 */ 64 public static ComponentFormatDefaults getInstance() { 65 if (instance == null) { 66 instance = new ComponentFormatDefaults(); 67 } 68 return instance; 69 } 70 71 private ComponentFormatDefaults() { 72 super(); 73 formats.put(Key.TODAY_SELECTOR, SimpleDateFormat.getDateInstance(SimpleDateFormat.MEDIUM)); 74 formats.put(Key.DOW_HEADER, new SimpleDateFormat("EE")); 75 formats.put(Key.MONTH_SELECTOR, new SimpleDateFormat("MMMM")); 76 formats.put(Key.OUTPUT_DATE_FIELD, SimpleDateFormat.getDateInstance(SimpleDateFormat.MEDIUM)); 77 formats.put(Key.INPUT_DATE_FIELD, SimpleDateFormat.getDateInstance(SimpleDateFormat.MEDIUM)); 78 } 79 80 /** {@inheritDoc} */ 81 @Override 82 protected ComponentFormatDefaults clone() throws CloneNotSupportedException { 83 return (ComponentFormatDefaults) super.clone(); 84 } 85 }