/* * SmartDoc : Ultimate document format based on XML * Copyright (C) 1998-2001 ASAMI, Tomoharu (asami@zeomtech.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.xmlsmartdoc.SmartDoc; import java.util.*; import java.io.*; import java.text.*; import com.AsamiOffice.jaba2.util.MessageMap; import com.AsamiOffice.jaba2.j2fw.J2Resource; /** * AbstractSmartDocResource * * @since Aug. 15, 1999 * @version Apr. 5, 2001 * @author ASAMI, Tomoharu (asami@zeomtech.com) */ public abstract class AbstractSmartDocResource extends J2Resource implements ISmartDocResource { protected MessageMap messages_; protected AbstractSmartDocResource( String property, String messages ) throws IOException { super( SmartDoc.class.getResource(property), SmartDoc.class.getResource(messages) ); } public String getPartLabel(int number) { return ("Part " + number); } public String getChapterLabel(int number) { return ("Chapter " + number); } public String getSectionLabel(int number) { return ("Section " + number); } public String getSubSectionLabel(int section, int subSection) { return ("Section " + section + "." + subSection); } public String getSubSubSectionLabel( int section, int subSection, int subSubSection ) { return ("Section " + section + "." + subSection + "." + subSubSection); } public String[] getLabelParts(String key) { String[] parts = new String[2]; parts[0] = getLabel(key); parts[1] = null; return (parts); } public String getYearLabel(int year) { return (Integer.toString(year)); } public String getMonthLabel(int month) { DateFormatSymbols symbols = new DateFormatSymbols(Locale.ENGLISH); return (symbols.getShortMonths()[month - 1] + "."); } public String getEditionLabel(int edition) { switch (edition) { case 1: return ("1st"); case 2: return ("2nd"); case 3: return ("3rd"); default: return (edition + "th"); } } public String getEditorLabel() { return ("(ed.)"); } public String getEditorsLabel() { return ("(eds.)"); } }