summaryrefslogtreecommitdiff
path: root/javax/swing/text
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2005-05-20 18:20:46 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2005-05-20 18:20:46 +0000
commitc521023082fc793b1236b9964f0efaffc0aec767 (patch)
treefc3c9b5ec9734e75db6d555a2624ea11b1467868 /javax/swing/text
parentce52995bef1e166d56cbfe68770c19e43ce50765 (diff)
downloadclasspath-c521023082fc793b1236b9964f0efaffc0aec767.tar.gz
2005-05-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD to generics-branch for 2005/04/28 - 2005/05/19 Changelog: 2005-05-19 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/net/URI.java: Added more documentation. (RFC2396_MARK): Removed. (RFC2396_UNRESERVED): Changed to RFC3986_UNRESERVED and updated. (RFC2396_REG_NAME): Changed to RFC3986_REG_NAME and updated. (RFC2396_PCHAR): Changed to RFC3986_PCHAR and updated. (RFC2396_SEGMENT): Changed to RFC3986_SEGMENT and updated. (RFC2396_PATH_SEGMENTS): Changed to RFC3986_PATH_SEGMENTS. (RFC3986_UNRESERVED): New field. (RFC3986_SSP): New field. (RFC3986_HOST): New field. (RFC3986_USERINFO): New field. (static): New initializer to initialize patterns with class. (parseURI()): Moved authority parsing to parseServerAuthority(). (unquote(String)): Removed invalid exception for non-ASCII chars. (quote(String)): Implemented. (quoteAuthority(String)): Adapted to use new fields. (quote(String,String)): Moved escaping of characters to another method. (quoteHost(String)): Implemented. (quotePath(String)): Adapted to use new fields. (quoteUserInfo(String)): Implemented. (parseServerAuthority()): Implemented. (normalize()): Implemented. (normalizePath(String)): Implemented as part of normalize(). (removeLastSegment(StringBuffer)): Likewise. (relativize(java.net.URI)): Implemented. (equals(Object)): Implemented. (hashCode()): Implemented. (compareTo(Object)): Implemented. (compareFragments(java.net.URI)): Implemented. (toString()): Use fields directly. (toASCIIString()): Implemented. (escapeCharacters(String)): Implemented to escape non-ASCII characters. 2005-05-19 Roman Kennke <roman@kennke.org> * javax/swing/SizeRequirements.java (constructors): Implemented. (getTiledSizeRequirements): Implemented. (calculateTiledPositions): Implemented. 2005-05-19 Roman Kennke <roman@kennke.org> * javax/swing/SizeRequirements.java: Added API documentation for this class. 2005-05-19 Roman Kennke <roman@kennke.org> * javax/swing/SizeRequirements.java: Reformatted file to meet our coding standards. 2005-05-19 Roman Kennke <roman@kennke.org> * javax/swing/SwingUtilities.java (getUIInputMap): Return the InputMap that has been set by the UI of the component, not the component's own InputMap. (getUIActionMap): Return the ActionMap that has been set by the UI of the component, not the component's own ActionMap. 2005-05-19 Roman Kennke <roman@kennke.org> * javax/swing/FocusManager.java: Reformatted this file to match our coding standard. 2005-05-19 Roman Kennke <roman@kennke.org> * javax/swing/plaf/metal/BasicFileChooserUI.java: (installComponents): Include parents ComboBox. This has been commented out because ComboBox was broken (see previous entry). 2005-05-19 Roman Kennke <roman@kennke.org> * javax/swing/plaf/metal/MetalComboBoxUI.java (createUI): Do not share instances of this UI class between different JComboBoxes. 2005-05-19 Kim Ho <kho@luxsci.net> * javax/swing/DefaultComboBoxModel.java: (addElement): Set index to be the element of the added item. (removeAllElements): Clear before retrieving new size. Use correct size. * javax/swing/JFileChooser.java: Implemented. * javax/swing/filechooser/FileSystemView.java: Implemented. * javax/swing/filechooser/UnixFileSystemView.java: New file. Implemented. * javax/swing/plaf/basic/BasicComboBoxUI.java: (intervalAdded): Set initial index to start. * javax/swing/plaf/basic/BasicDirectoryModel.java: New file. Implemented. * javax/swing/plaf/basic/BasicFileChooserUI.java: New file. Implemented. * javax/swing/plaf/basic/BasicLookAndFeel.java: Add FileChooserUI. Commented out GIF properties for FileChooser stuff. 2005-05-19 Michael Koch <konqueror@gmx.de> * lib/Makefile.am: Remove accidentally commited -nowarn option for jikes. 2005-05-19 Michael Koch <konqueror@gmx.de> * java/text/DateFormatSymbols.java (getStringArray): New method. (getZoneStrings): Likewise. (DateFormatSymbols): Load symbols from properties files. * java/util/Locale.java (getDisplayLanguage): Handle new way to load language names. (getDisplayCountry): Handle new way to load territory names. (getDisplayVariant): Handle new way to load variant names. * lib/Makefile.am, lib/gen-classlist.sh.in: No need to special case classes from gnu.java.locale anymore. * scripts/generate-locale-list.sh: Generate list from the new properties files. * LICENSE: Added license of locale data properties files. 2005-05-19 Michael Koch <konqueror@gmx.de> * resource/gnu/java/locale/LocaleInformation_aa_DJ.properties, resource/gnu/java/locale/LocaleInformation_aa_ER.properties, resource/gnu/java/locale/LocaleInformation_aa_ER_SAAHO.properties, resource/gnu/java/locale/LocaleInformation_aa_ET.properties, resource/gnu/java/locale/LocaleInformation_aa.properties, resource/gnu/java/locale/LocaleInformation_af.properties, resource/gnu/java/locale/LocaleInformation_af_ZA.properties, resource/gnu/java/locale/LocaleInformation_am_ET.properties, resource/gnu/java/locale/LocaleInformation_am.properties, resource/gnu/java/locale/LocaleInformation_ar_DZ.properties, resource/gnu/java/locale/LocaleInformation_ar_IN.properties, resource/gnu/java/locale/LocaleInformation_ar_IQ.properties, resource/gnu/java/locale/LocaleInformation_ar_JO.properties, resource/gnu/java/locale/LocaleInformation_ar_KW.properties, resource/gnu/java/locale/LocaleInformation_ar_LB.properties, resource/gnu/java/locale/LocaleInformation_ar_LY.properties, resource/gnu/java/locale/LocaleInformation_ar_MA.properties, resource/gnu/java/locale/LocaleInformation_ar.properties, resource/gnu/java/locale/LocaleInformation_ar_QA.properties, resource/gnu/java/locale/LocaleInformation_ar_SA.properties, resource/gnu/java/locale/LocaleInformation_ar_SY.properties, resource/gnu/java/locale/LocaleInformation_ar_TN.properties, resource/gnu/java/locale/LocaleInformation_ar_YE.properties, resource/gnu/java/locale/LocaleInformation_as_IN.properties, resource/gnu/java/locale/LocaleInformation_as.properties, resource/gnu/java/locale/LocaleInformation_az_Cyrl.properties, resource/gnu/java/locale/LocaleInformation_be_BY.properties, resource/gnu/java/locale/LocaleInformation_be.properties, resource/gnu/java/locale/LocaleInformation_bg_BG.properties, resource/gnu/java/locale/LocaleInformation_bg.properties, resource/gnu/java/locale/LocaleInformation_bn_IN.properties, resource/gnu/java/locale/LocaleInformation_bn.properties, resource/gnu/java/locale/LocaleInformation_ca_ES.properties, resource/gnu/java/locale/LocaleInformation_ca.properties, resource/gnu/java/locale/LocaleInformation_cs_CZ.properties, resource/gnu/java/locale/LocaleInformation_cs.properties, resource/gnu/java/locale/LocaleInformation_cy_GB.properties, resource/gnu/java/locale/LocaleInformation_cy.properties, resource/gnu/java/locale/LocaleInformation_da_DK.properties, resource/gnu/java/locale/LocaleInformation_da.properties, resource/gnu/java/locale/LocaleInformation_de_AT.properties, resource/gnu/java/locale/LocaleInformation_de_BE.properties, resource/gnu/java/locale/LocaleInformation_de_CH.properties, resource/gnu/java/locale/LocaleInformation_de_DE.properties, resource/gnu/java/locale/LocaleInformation_de_LI.properties, resource/gnu/java/locale/LocaleInformation_de_LU.properties, resource/gnu/java/locale/LocaleInformation_de.properties, resource/gnu/java/locale/LocaleInformation_dv_MV.properties, resource/gnu/java/locale/LocaleInformation_dv.properties, resource/gnu/java/locale/LocaleInformation_dz_BT.properties, resource/gnu/java/locale/LocaleInformation_dz.properties, resource/gnu/java/locale/LocaleInformation_el_GR.properties, resource/gnu/java/locale/LocaleInformation_el.properties, resource/gnu/java/locale/LocaleInformation_en_AS.properties, resource/gnu/java/locale/LocaleInformation_en_AU.properties, resource/gnu/java/locale/LocaleInformation_en_BE.properties, resource/gnu/java/locale/LocaleInformation_en_BW.properties, resource/gnu/java/locale/LocaleInformation_en_BZ.properties, resource/gnu/java/locale/LocaleInformation_en_CA.properties, resource/gnu/java/locale/LocaleInformation_en_GB.properties, resource/gnu/java/locale/LocaleInformation_en_GU.properties, resource/gnu/java/locale/LocaleInformation_en_HK.properties, resource/gnu/java/locale/LocaleInformation_en_IE.properties, resource/gnu/java/locale/LocaleInformation_en_IN.properties, resource/gnu/java/locale/LocaleInformation_en_MH.properties, resource/gnu/java/locale/LocaleInformation_en_MP.properties, resource/gnu/java/locale/LocaleInformation_en_MT.properties, resource/gnu/java/locale/LocaleInformation_en_NZ.properties, resource/gnu/java/locale/LocaleInformation_en_PH.properties, resource/gnu/java/locale/LocaleInformation_en_PK.properties, resource/gnu/java/locale/LocaleInformation_en.properties, resource/gnu/java/locale/LocaleInformation_en_SG.properties, resource/gnu/java/locale/LocaleInformation_en_UM.properties, resource/gnu/java/locale/LocaleInformation_en_US_POSIX.properties, resource/gnu/java/locale/LocaleInformation_en_US.properties, resource/gnu/java/locale/LocaleInformation_en_VI.properties, resource/gnu/java/locale/LocaleInformation_en_ZA.properties, resource/gnu/java/locale/LocaleInformation_en_ZW.properties, resource/gnu/java/locale/LocaleInformation_eo.properties, resource/gnu/java/locale/LocaleInformation_es_AR.properties, resource/gnu/java/locale/LocaleInformation_es_BO.properties, resource/gnu/java/locale/LocaleInformation_es_CL.properties, resource/gnu/java/locale/LocaleInformation_es_CO.properties, resource/gnu/java/locale/LocaleInformation_es_CR.properties, resource/gnu/java/locale/LocaleInformation_es_DO.properties, resource/gnu/java/locale/LocaleInformation_es_EC.properties, resource/gnu/java/locale/LocaleInformation_es_ES.properties, resource/gnu/java/locale/LocaleInformation_es_GT.properties, resource/gnu/java/locale/LocaleInformation_es_HN.properties, resource/gnu/java/locale/LocaleInformation_es_MX.properties, resource/gnu/java/locale/LocaleInformation_es_NI.properties, resource/gnu/java/locale/LocaleInformation_es_PA.properties, resource/gnu/java/locale/LocaleInformation_es_PE.properties, resource/gnu/java/locale/LocaleInformation_es.properties, resource/gnu/java/locale/LocaleInformation_es_PR.properties, resource/gnu/java/locale/LocaleInformation_es_PY.properties, resource/gnu/java/locale/LocaleInformation_es_SV.properties, resource/gnu/java/locale/LocaleInformation_es_US.properties, resource/gnu/java/locale/LocaleInformation_es_UY.properties, resource/gnu/java/locale/LocaleInformation_es_VE.properties, resource/gnu/java/locale/LocaleInformation_et_EE.properties, resource/gnu/java/locale/LocaleInformation_et.properties, resource/gnu/java/locale/LocaleInformation_eu_ES.properties, resource/gnu/java/locale/LocaleInformation_eu.properties, resource/gnu/java/locale/LocaleInformation_fa_AF.properties, resource/gnu/java/locale/LocaleInformation_fa_IR.properties, resource/gnu/java/locale/LocaleInformation_fa.properties, resource/gnu/java/locale/LocaleInformation_fi_FI.properties, resource/gnu/java/locale/LocaleInformation_fi.properties, resource/gnu/java/locale/LocaleInformation_fo_FO.properties, resource/gnu/java/locale/LocaleInformation_fo.properties, resource/gnu/java/locale/LocaleInformation_fr_BE.properties, resource/gnu/java/locale/LocaleInformation_fr_CA.properties, resource/gnu/java/locale/LocaleInformation_fr_CH.properties, resource/gnu/java/locale/LocaleInformation_fr_LU.properties, resource/gnu/java/locale/LocaleInformation_fr.properties, resource/gnu/java/locale/LocaleInformation_ga_IE.properties, resource/gnu/java/locale/LocaleInformation_ga.properties, resource/gnu/java/locale/LocaleInformation_gl_ES.properties, resource/gnu/java/locale/LocaleInformation_gl.properties, resource/gnu/java/locale/LocaleInformation_gu_IN.properties, resource/gnu/java/locale/LocaleInformation_gu.properties, resource/gnu/java/locale/LocaleInformation_gv_GB.properties, resource/gnu/java/locale/LocaleInformation_gv.properties, resource/gnu/java/locale/LocaleInformation_he_IL.properties, resource/gnu/java/locale/LocaleInformation_he.properties, resource/gnu/java/locale/LocaleInformation_hi_IN.properties, resource/gnu/java/locale/LocaleInformation_hi.properties, resource/gnu/java/locale/LocaleInformation_hr.properties, resource/gnu/java/locale/LocaleInformation_hu_HU.properties, resource/gnu/java/locale/LocaleInformation_hu.properties, resource/gnu/java/locale/LocaleInformation_hy_AM.properties, resource/gnu/java/locale/LocaleInformation_hy_AM_REVISED.properties, resource/gnu/java/locale/LocaleInformation_hy.properties, resource/gnu/java/locale/LocaleInformation_id_ID.properties, resource/gnu/java/locale/LocaleInformation_id.properties, resource/gnu/java/locale/LocaleInformation_is_IS.properties, resource/gnu/java/locale/LocaleInformation_is.properties, resource/gnu/java/locale/LocaleInformation_it_CH.properties, resource/gnu/java/locale/LocaleInformation_it_IT.properties, resource/gnu/java/locale/LocaleInformation_it.properties, resource/gnu/java/locale/LocaleInformation_iu.properties, resource/gnu/java/locale/LocaleInformation_ja_JP.properties, resource/gnu/java/locale/LocaleInformation_ja.properties, resource/gnu/java/locale/LocaleInformation_ka.properties, resource/gnu/java/locale/LocaleInformation_kk_KZ.properties, resource/gnu/java/locale/LocaleInformation_kk.properties, resource/gnu/java/locale/LocaleInformation_kl_GL.properties, resource/gnu/java/locale/LocaleInformation_kl.properties, resource/gnu/java/locale/LocaleInformation_km_KH.properties, resource/gnu/java/locale/LocaleInformation_km.properties, resource/gnu/java/locale/LocaleInformation_kn_IN.properties, resource/gnu/java/locale/LocaleInformation_kn.properties, resource/gnu/java/locale/LocaleInformation_ko_KR.properties, resource/gnu/java/locale/LocaleInformation_ko.properties, resource/gnu/java/locale/LocaleInformation_kw_GB.properties, resource/gnu/java/locale/LocaleInformation_kw.properties, resource/gnu/java/locale/LocaleInformation_ky.properties, resource/gnu/java/locale/LocaleInformation_lo_LA.properties, resource/gnu/java/locale/LocaleInformation_lo.properties, resource/gnu/java/locale/LocaleInformation_lt_LT.properties, resource/gnu/java/locale/LocaleInformation_lt.properties, resource/gnu/java/locale/LocaleInformation_lv_LV.properties, resource/gnu/java/locale/LocaleInformation_lv.properties, resource/gnu/java/locale/LocaleInformation_mk.properties, resource/gnu/java/locale/LocaleInformation_ml_IN.properties, resource/gnu/java/locale/LocaleInformation_ml.properties, resource/gnu/java/locale/LocaleInformation_mn_MN.properties, resource/gnu/java/locale/LocaleInformation_mn.properties, resource/gnu/java/locale/LocaleInformation_mr_IN.properties, resource/gnu/java/locale/LocaleInformation_mr.properties, resource/gnu/java/locale/LocaleInformation_ms_BN.properties, resource/gnu/java/locale/LocaleInformation_ms_MY.properties, resource/gnu/java/locale/LocaleInformation_ms.properties, resource/gnu/java/locale/LocaleInformation_mt_MT.properties, resource/gnu/java/locale/LocaleInformation_mt.properties, resource/gnu/java/locale/LocaleInformation_nb_NO.properties, resource/gnu/java/locale/LocaleInformation_nb.properties, resource/gnu/java/locale/LocaleInformation_nl_BE.properties, resource/gnu/java/locale/LocaleInformation_nl_NL.properties, resource/gnu/java/locale/LocaleInformation_nl.properties, resource/gnu/java/locale/LocaleInformation_nn_NO.properties, resource/gnu/java/locale/LocaleInformation_nn.properties, resource/gnu/java/locale/LocaleInformation_om_ET.properties, resource/gnu/java/locale/LocaleInformation_om_KE.properties, resource/gnu/java/locale/LocaleInformation_om.properties, resource/gnu/java/locale/LocaleInformation_or_IN.properties, resource/gnu/java/locale/LocaleInformation_or.properties, resource/gnu/java/locale/LocaleInformation_pa_IN.properties, resource/gnu/java/locale/LocaleInformation_pa.properties, resource/gnu/java/locale/LocaleInformation_pl_PL.properties, resource/gnu/java/locale/LocaleInformation_pl.properties, resource/gnu/java/locale/LocaleInformation.properties, resource/gnu/java/locale/LocaleInformation_ps_AF.properties, resource/gnu/java/locale/LocaleInformation_ps.properties, resource/gnu/java/locale/LocaleInformation_pt_BR.properties, resource/gnu/java/locale/LocaleInformation_pt.properties, resource/gnu/java/locale/LocaleInformation_pt_PT.properties, resource/gnu/java/locale/LocaleInformation_ro.properties, resource/gnu/java/locale/LocaleInformation_ro_RO.properties, resource/gnu/java/locale/LocaleInformation_ru.properties, resource/gnu/java/locale/LocaleInformation_ru_RU.properties, resource/gnu/java/locale/LocaleInformation_ru_UA.properties, resource/gnu/java/locale/LocaleInformation_sa_IN.properties, resource/gnu/java/locale/LocaleInformation_sa.properties, resource/gnu/java/locale/LocaleInformation_sk.properties, resource/gnu/java/locale/LocaleInformation_sk_SK.properties, resource/gnu/java/locale/LocaleInformation_sl.properties, resource/gnu/java/locale/LocaleInformation_so_DJ.properties, resource/gnu/java/locale/LocaleInformation_so_ET.properties, resource/gnu/java/locale/LocaleInformation_so_KE.properties, resource/gnu/java/locale/LocaleInformation_so.properties, resource/gnu/java/locale/LocaleInformation_so_SO.properties, resource/gnu/java/locale/LocaleInformation_sq_AL.properties, resource/gnu/java/locale/LocaleInformation_sq.properties, resource/gnu/java/locale/LocaleInformation_sr_Latn.properties, resource/gnu/java/locale/LocaleInformation_sr.properties, resource/gnu/java/locale/LocaleInformation_sv_FI.properties, resource/gnu/java/locale/LocaleInformation_sv.properties, resource/gnu/java/locale/LocaleInformation_sv_SE.properties, resource/gnu/java/locale/LocaleInformation_sw_KE.properties, resource/gnu/java/locale/LocaleInformation_sw.properties, resource/gnu/java/locale/LocaleInformation_sw_TZ.properties, resource/gnu/java/locale/LocaleInformation_ta_IN.properties, resource/gnu/java/locale/LocaleInformation_ta.properties, resource/gnu/java/locale/LocaleInformation_te_IN.properties, resource/gnu/java/locale/LocaleInformation_te.properties, resource/gnu/java/locale/LocaleInformation_th.properties, resource/gnu/java/locale/LocaleInformation_th_TH.properties, resource/gnu/java/locale/LocaleInformation_ti_ER.properties, resource/gnu/java/locale/LocaleInformation_ti_ET.properties, resource/gnu/java/locale/LocaleInformation_ti.properties, resource/gnu/java/locale/LocaleInformation_tr.properties, resource/gnu/java/locale/LocaleInformation_tr_TR.properties, resource/gnu/java/locale/LocaleInformation_tt.properties, resource/gnu/java/locale/LocaleInformation_tt_RU.properties, resource/gnu/java/locale/LocaleInformation_uk.properties, resource/gnu/java/locale/LocaleInformation_uk_UA.properties, resource/gnu/java/locale/LocaleInformation_ur.properties, resource/gnu/java/locale/LocaleInformation_uz_AF.properties, resource/gnu/java/locale/LocaleInformation_uz.properties, resource/gnu/java/locale/LocaleInformation_vi.properties, resource/gnu/java/locale/LocaleInformation_zh_CN_Hans.properties, resource/gnu/java/locale/LocaleInformation_zh_Hant.properties, resource/gnu/java/locale/LocaleInformation_zh_HK_Hant.properties, resource/gnu/java/locale/LocaleInformation_zh_MO_Hant.properties, resource/gnu/java/locale/LocaleInformation_zh.properties, resource/gnu/java/locale/LocaleInformation_zh_SG_Hans.properties, resource/gnu/java/locale/LocaleInformation_zh_TW_Hant.properties: New files. * gnu/java/locale/LocaleInformation_aa_DJ.java, gnu/java/locale/LocaleInformation_aa_ER.java, gnu/java/locale/LocaleInformation_aa_ER_SAAHO.java, gnu/java/locale/LocaleInformation_aa_ET.java, gnu/java/locale/LocaleInformation_aa.java, gnu/java/locale/LocaleInformation_af.java, gnu/java/locale/LocaleInformation_af_ZA.java, gnu/java/locale/LocaleInformation_am_ET.java, gnu/java/locale/LocaleInformation_am.java, gnu/java/locale/LocaleInformation_ar_DZ.java, gnu/java/locale/LocaleInformation_ar_IN.java, gnu/java/locale/LocaleInformation_ar_IQ.java, gnu/java/locale/LocaleInformation_ar.java, gnu/java/locale/LocaleInformation_ar_JO.java, gnu/java/locale/LocaleInformation_ar_KW.java, gnu/java/locale/LocaleInformation_ar_LB.java, gnu/java/locale/LocaleInformation_ar_LY.java, gnu/java/locale/LocaleInformation_ar_MA.java, gnu/java/locale/LocaleInformation_ar_QA.java, gnu/java/locale/LocaleInformation_ar_SA.java, gnu/java/locale/LocaleInformation_ar_SY.java, gnu/java/locale/LocaleInformation_ar_TN.java, gnu/java/locale/LocaleInformation_ar_YE.java, gnu/java/locale/LocaleInformation_as_IN.java, gnu/java/locale/LocaleInformation_as.java, gnu/java/locale/LocaleInformation_az_Cyrl.java, gnu/java/locale/LocaleInformation_az.java, gnu/java/locale/LocaleInformation_be_BY.java, gnu/java/locale/LocaleInformation_be.java, gnu/java/locale/LocaleInformation_bg_BG.java, gnu/java/locale/LocaleInformation_bg.java, gnu/java/locale/LocaleInformation_bn_IN.java, gnu/java/locale/LocaleInformation_bn.java, gnu/java/locale/LocaleInformation_br_FR.java, gnu/java/locale/LocaleInformation_bs_BA.java, gnu/java/locale/LocaleInformation_byn_ER.java, gnu/java/locale/LocaleInformation_byn.java, gnu/java/locale/LocaleInformation_ca_ES.java, gnu/java/locale/LocaleInformation_ca.java, gnu/java/locale/LocaleInformation_cs_CZ.java, gnu/java/locale/LocaleInformation_cs.java, gnu/java/locale/LocaleInformation_cy_GB.java, gnu/java/locale/LocaleInformation_cy.java, gnu/java/locale/LocaleInformation_da_DK.java, gnu/java/locale/LocaleInformation_da.java, gnu/java/locale/LocaleInformation_de_AT.java, gnu/java/locale/LocaleInformation_de_BE.java, gnu/java/locale/LocaleInformation_de_CH.java, gnu/java/locale/LocaleInformation_de_DE.java, gnu/java/locale/LocaleInformation_de.java, gnu/java/locale/LocaleInformation_de_LI.java, gnu/java/locale/LocaleInformation_de_LU.java, gnu/java/locale/LocaleInformation_dv.java, gnu/java/locale/LocaleInformation_dv_MV.java, gnu/java/locale/LocaleInformation_dz_BT.java, gnu/java/locale/LocaleInformation_dz.java, gnu/java/locale/LocaleInformation_el_GR.java, gnu/java/locale/LocaleInformation_el.java, gnu/java/locale/LocaleInformation_en_AS.java, gnu/java/locale/LocaleInformation_en_AU.java, gnu/java/locale/LocaleInformation_en_BE.java, gnu/java/locale/LocaleInformation_en_BW.java, gnu/java/locale/LocaleInformation_en_BZ.java, gnu/java/locale/LocaleInformation_en_CA.java, gnu/java/locale/LocaleInformation_en_DK.java, gnu/java/locale/LocaleInformation_en_GB.java, gnu/java/locale/LocaleInformation_en_GU.java, gnu/java/locale/LocaleInformation_en_HK.java, gnu/java/locale/LocaleInformation_en_IE.java, gnu/java/locale/LocaleInformation_en_IN.java, gnu/java/locale/LocaleInformation_en.java, gnu/java/locale/LocaleInformation_en_MH.java, gnu/java/locale/LocaleInformation_en_MP.java, gnu/java/locale/LocaleInformation_en_MT.java, gnu/java/locale/LocaleInformation_en_NZ.java, gnu/java/locale/LocaleInformation_en_PH.java, gnu/java/locale/LocaleInformation_en_PK.java, gnu/java/locale/LocaleInformation_en_SG.java, gnu/java/locale/LocaleInformation_en_UM.java, gnu/java/locale/LocaleInformation_en_US.java, gnu/java/locale/LocaleInformation_en_US_POSIX.java, gnu/java/locale/LocaleInformation_en_VI.java, gnu/java/locale/LocaleInformation_en_ZA.java, gnu/java/locale/LocaleInformation_en_ZW.java, gnu/java/locale/LocaleInformation_eo.java, gnu/java/locale/LocaleInformation_es_AR.java, gnu/java/locale/LocaleInformation_es_BO.java, gnu/java/locale/LocaleInformation_es_CL.java, gnu/java/locale/LocaleInformation_es_CO.java, gnu/java/locale/LocaleInformation_es_CR.java, gnu/java/locale/LocaleInformation_es_DO.java, gnu/java/locale/LocaleInformation_es_EC.java, gnu/java/locale/LocaleInformation_es_ES.java, gnu/java/locale/LocaleInformation_es_GT.java, gnu/java/locale/LocaleInformation_es_HN.java, gnu/java/locale/LocaleInformation_es.java, gnu/java/locale/LocaleInformation_es_MX.java, gnu/java/locale/LocaleInformation_es_NI.java, gnu/java/locale/LocaleInformation_es_PA.java, gnu/java/locale/LocaleInformation_es_PE.java, gnu/java/locale/LocaleInformation_es_PR.java, gnu/java/locale/LocaleInformation_es_PY.java, gnu/java/locale/LocaleInformation_es_SV.java, gnu/java/locale/LocaleInformation_es_US.java, gnu/java/locale/LocaleInformation_es_UY.java, gnu/java/locale/LocaleInformation_es_VE.java, gnu/java/locale/LocaleInformation_et_EE.java, gnu/java/locale/LocaleInformation_et.java, gnu/java/locale/LocaleInformation_eu_ES.java, gnu/java/locale/LocaleInformation_eu.java, gnu/java/locale/LocaleInformation_fa_AF.java, gnu/java/locale/LocaleInformation_fa_IR.java, gnu/java/locale/LocaleInformation_fa.java, gnu/java/locale/LocaleInformation_fi_FI.java, gnu/java/locale/LocaleInformation_fi.java, gnu/java/locale/LocaleInformation_fo_FO.java, gnu/java/locale/LocaleInformation_fo.java, gnu/java/locale/LocaleInformation_fr_BE.java, gnu/java/locale/LocaleInformation_fr_CA.java, gnu/java/locale/LocaleInformation_fr_CH.java, gnu/java/locale/LocaleInformation_fr.java, gnu/java/locale/LocaleInformation_fr_LU.java, gnu/java/locale/LocaleInformation_ga_IE.java, gnu/java/locale/LocaleInformation_ga.java, gnu/java/locale/LocaleInformation_gez_ER.java, gnu/java/locale/LocaleInformation_gez_ET.java, gnu/java/locale/LocaleInformation_gez.java, gnu/java/locale/LocaleInformation_gl_ES.java, gnu/java/locale/LocaleInformation_gl.java, gnu/java/locale/LocaleInformation_gu_IN.java, gnu/java/locale/LocaleInformation_gu.java, gnu/java/locale/LocaleInformation_gv_GB.java, gnu/java/locale/LocaleInformation_gv.java, gnu/java/locale/LocaleInformation_haw.java, gnu/java/locale/LocaleInformation_haw_US.java, gnu/java/locale/LocaleInformation_he_IL.java, gnu/java/locale/LocaleInformation_he.java, gnu/java/locale/LocaleInformation_hi_IN.java, gnu/java/locale/LocaleInformation_hi.java, gnu/java/locale/LocaleInformation_hr.java, gnu/java/locale/LocaleInformation_hu_HU.java, gnu/java/locale/LocaleInformation_hu.java, gnu/java/locale/LocaleInformation_hy_AM.java, gnu/java/locale/LocaleInformation_hy_AM_REVISED.java, gnu/java/locale/LocaleInformation_hy.java, gnu/java/locale/LocaleInformation_id_ID.java, gnu/java/locale/LocaleInformation_id.java, gnu/java/locale/LocaleInformation_is_IS.java, gnu/java/locale/LocaleInformation_is.java, gnu/java/locale/LocaleInformation_it_CH.java, gnu/java/locale/LocaleInformation_it_IT.java, gnu/java/locale/LocaleInformation_it.java, gnu/java/locale/LocaleInformation_iu.java, gnu/java/locale/LocaleInformation_iw_IL.java, gnu/java/locale/LocaleInformation_ja.java, gnu/java/locale/LocaleInformation_ja_JP.java, gnu/java/locale/LocaleInformation.java, gnu/java/locale/LocaleInformation_ka.java, gnu/java/locale/LocaleInformation_kk.java, gnu/java/locale/LocaleInformation_kk_KZ.java, gnu/java/locale/LocaleInformation_kl_GL.java, gnu/java/locale/LocaleInformation_kl.java, gnu/java/locale/LocaleInformation_km.java, gnu/java/locale/LocaleInformation_km_KH.java, gnu/java/locale/LocaleInformation_kn_IN.java, gnu/java/locale/LocaleInformation_kn.java, gnu/java/locale/LocaleInformation_ko.java, gnu/java/locale/LocaleInformation_kok_IN.java, gnu/java/locale/LocaleInformation_kok.java, gnu/java/locale/LocaleInformation_ko_KR.java, gnu/java/locale/LocaleInformation_kw_GB.java, gnu/java/locale/LocaleInformation_kw.java, gnu/java/locale/LocaleInformation_ky.java, gnu/java/locale/LocaleInformation_lo.java, gnu/java/locale/LocaleInformation_lo_LA.java, gnu/java/locale/LocaleInformation_lt.java, gnu/java/locale/LocaleInformation_lt_LT.java, gnu/java/locale/LocaleInformation_lv.java, gnu/java/locale/LocaleInformation_lv_LV.java, gnu/java/locale/LocaleInformation_mk.java, gnu/java/locale/LocaleInformation_ml_IN.java, gnu/java/locale/LocaleInformation_ml.java, gnu/java/locale/LocaleInformation_mn.java, gnu/java/locale/LocaleInformation_mn_MN.java, gnu/java/locale/LocaleInformation_mr_IN.java, gnu/java/locale/LocaleInformation_mr.java, gnu/java/locale/LocaleInformation_ms_BN.java, gnu/java/locale/LocaleInformation_ms.java, gnu/java/locale/LocaleInformation_ms_MY.java, gnu/java/locale/LocaleInformation_mt.java, gnu/java/locale/LocaleInformation_mt_MT.java, gnu/java/locale/LocaleInformation_nb.java, gnu/java/locale/LocaleInformation_nb_NO.java, gnu/java/locale/LocaleInformation_nl_BE.java, gnu/java/locale/LocaleInformation_nl.java, gnu/java/locale/LocaleInformation_nl_NL.java, gnu/java/locale/LocaleInformation_nn.java, gnu/java/locale/LocaleInformation_nn_NO.java, gnu/java/locale/LocaleInformation_no_NO.java, gnu/java/locale/LocaleInformation_oc_FR.java, gnu/java/locale/LocaleInformation_om_ET.java, gnu/java/locale/LocaleInformation_om.java, gnu/java/locale/LocaleInformation_om_KE.java, gnu/java/locale/LocaleInformation_or_IN.java, gnu/java/locale/LocaleInformation_or.java, gnu/java/locale/LocaleInformation_pa_IN.java, gnu/java/locale/LocaleInformation_pa.java, gnu/java/locale/LocaleInformation_pl.java, gnu/java/locale/LocaleInformation_pl_PL.java, gnu/java/locale/LocaleInformation_ps_AF.java, gnu/java/locale/LocaleInformation_ps.java, gnu/java/locale/LocaleInformation_pt_BR.java, gnu/java/locale/LocaleInformation_pt.java, gnu/java/locale/LocaleInformation_pt_PT.java, gnu/java/locale/LocaleInformation_ro.java, gnu/java/locale/LocaleInformation_ro_RO.java, gnu/java/locale/LocaleInformation_ru.java, gnu/java/locale/LocaleInformation_ru_RU.java, gnu/java/locale/LocaleInformation_ru_UA.java, gnu/java/locale/LocaleInformation_sa_IN.java, gnu/java/locale/LocaleInformation_sa.java, gnu/java/locale/LocaleInformation_se_NO.java, gnu/java/locale/LocaleInformation_sid_ET.java, gnu/java/locale/LocaleInformation_sid.java, gnu/java/locale/LocaleInformation_sk.java, gnu/java/locale/LocaleInformation_sk_SK.java, gnu/java/locale/LocaleInformation_sl.java, gnu/java/locale/LocaleInformation_so_DJ.java, gnu/java/locale/LocaleInformation_so_ET.java, gnu/java/locale/LocaleInformation_so.java, gnu/java/locale/LocaleInformation_so_KE.java, gnu/java/locale/LocaleInformation_so_SO.java, gnu/java/locale/LocaleInformation_sq_AL.java, gnu/java/locale/LocaleInformation_sq.java, gnu/java/locale/LocaleInformation_sr.java, gnu/java/locale/LocaleInformation_sr_Latn.java, gnu/java/locale/LocaleInformation_sv_FI.java, gnu/java/locale/LocaleInformation_sv.java, gnu/java/locale/LocaleInformation_sv_SE.java, gnu/java/locale/LocaleInformation_sw.java, gnu/java/locale/LocaleInformation_sw_KE.java, gnu/java/locale/LocaleInformation_sw_TZ.java, gnu/java/locale/LocaleInformation_syr.java, gnu/java/locale/LocaleInformation_syr_SY.java, gnu/java/locale/LocaleInformation_ta_IN.java, gnu/java/locale/LocaleInformation_ta.java, gnu/java/locale/LocaleInformation_te_IN.java, gnu/java/locale/LocaleInformation_te.java, gnu/java/locale/LocaleInformation_tg_TJ.java, gnu/java/locale/LocaleInformation_th.java, gnu/java/locale/LocaleInformation_th_TH.java, gnu/java/locale/LocaleInformation_ti_ER.java, gnu/java/locale/LocaleInformation_ti_ET.java, gnu/java/locale/LocaleInformation_tig_ER.java, gnu/java/locale/LocaleInformation_tig.java, gnu/java/locale/LocaleInformation_ti.java, gnu/java/locale/LocaleInformation_tr.java, gnu/java/locale/LocaleInformation_tr_TR.java, gnu/java/locale/LocaleInformation_tt.java, gnu/java/locale/LocaleInformation_tt_RU.java, gnu/java/locale/LocaleInformation_uk.java, gnu/java/locale/LocaleInformation_uk_UA.java, gnu/java/locale/LocaleInformation_ur.java, gnu/java/locale/LocaleInformation_uz_AF.java, gnu/java/locale/LocaleInformation_uz.java, gnu/java/locale/LocaleInformation_vi.java, gnu/java/locale/LocaleInformation_wal_ET.java, gnu/java/locale/LocaleInformation_wal.java, gnu/java/locale/LocaleInformation_zh_CN_Hans.java, gnu/java/locale/LocaleInformation_zh_Hant.java, gnu/java/locale/LocaleInformation_zh_HK_Hant.java, gnu/java/locale/LocaleInformation_zh.java, gnu/java/locale/LocaleInformation_zh_MO_Hant.java, gnu/java/locale/LocaleInformation_zh_SG_Hans.java, gnu/java/locale/LocaleInformation_zh_TW_Hant.java: Removed. 2005-05-18 Thomas Fitzsimmons <fitzsim@redhat.com> * java/awt/Window.java (createBufferStrategy): Remove unnecessary try-catch blocks. * java/awt/Canvas.java (createBufferStrategy): Likewise. * gnu
Diffstat (limited to 'javax/swing/text')
-rw-r--r--javax/swing/text/AbstractDocument.java4
-rw-r--r--javax/swing/text/FieldView.java79
-rw-r--r--javax/swing/text/GapContent.java227
-rw-r--r--javax/swing/text/JTextComponent.java27
-rw-r--r--javax/swing/text/PlainDocument.java42
-rw-r--r--javax/swing/text/PlainView.java39
-rw-r--r--javax/swing/text/Utilities.java2
-rw-r--r--javax/swing/text/View.java199
8 files changed, 553 insertions, 66 deletions
diff --git a/javax/swing/text/AbstractDocument.java b/javax/swing/text/AbstractDocument.java
index 29be0ad06..efeb85db6 100644
--- a/javax/swing/text/AbstractDocument.java
+++ b/javax/swing/text/AbstractDocument.java
@@ -847,8 +847,8 @@ public abstract class AbstractDocument
public class LeafElement extends AbstractElement
{
private static final long serialVersionUID = 5115368706941283802L;
- private int start;
- private int end;
+ int start;
+ int end;
public LeafElement(Element parent, AttributeSet attributes, int start,
int end)
diff --git a/javax/swing/text/FieldView.java b/javax/swing/text/FieldView.java
index 3f1de3772..e81a19fe5 100644
--- a/javax/swing/text/FieldView.java
+++ b/javax/swing/text/FieldView.java
@@ -39,10 +39,15 @@ exception statement from your version. */
package javax.swing.text;
import java.awt.Component;
+import java.awt.ComponentOrientation;
import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Rectangle;
import java.awt.Shape;
+import javax.swing.JTextField;
+import javax.swing.event.DocumentEvent;
+
public class FieldView extends PlainView
{
public FieldView(Element elem)
@@ -56,6 +61,55 @@ public class FieldView extends PlainView
return container.getFontMetrics(container.getFont());
}
+ /**
+ * Vertically centers the single line of text within the
+ * bounds of the input shape. The returned Rectangle is centered
+ * vertically within <code>shape</code> and has a height of the
+ * preferred span along the Y axis. Horizontal adjustment is done according
+ * to the horizontalAligment property of the component that is rendered.
+ *
+ * @param shape the shape within which the line is beeing centered
+ */
+ protected Shape adjustAllocation(Shape shape)
+ {
+ Rectangle rectIn = shape.getBounds();
+ // vertical adjustment
+ int height = (int) getPreferredSpan(Y_AXIS);
+ int y = rectIn.y + (rectIn.height - height) / 2;
+ // horizontal adjustment
+ JTextField textField = (JTextField) getContainer();
+ int halign = textField.getHorizontalAlignment();
+ int width = (int) getPreferredSpan(X_AXIS);
+ int x;
+ ComponentOrientation orientation = textField.getComponentOrientation();
+ switch (halign)
+ {
+ case JTextField.CENTER:
+ x = rectIn.x + (rectIn.width - width) / 2;
+ break;
+ case JTextField.RIGHT:
+ x = rectIn.x + (rectIn.width - width);
+ break;
+ case JTextField.TRAILING:
+ if (orientation.isLeftToRight())
+ x = rectIn.x + (rectIn.width - width);
+ else
+ x = rectIn.x;
+ break;
+ case JTextField.LEADING:
+ if (orientation.isLeftToRight())
+ x = rectIn.x;
+ else
+ x = rectIn.x + (rectIn.width - width);
+ break;
+ case JTextField.LEFT:
+ default:
+ x = rectIn.x;
+ break;
+ }
+ return new Rectangle(x, y, width, height);
+ }
+
public float getPreferredSpan(int axis)
{
if (axis != X_AXIS && axis != Y_AXIS)
@@ -91,11 +145,32 @@ public class FieldView extends PlainView
public Shape modelToView(int pos, Shape a, Position.Bias bias)
throws BadLocationException
{
- return super.modelToView(pos, a, bias);
+ Shape newAlloc = adjustAllocation(a);
+ return super.modelToView(pos, newAlloc, bias);
}
public void paint(Graphics g, Shape s)
{
- super.paint(g, s);
+ Shape newAlloc = adjustAllocation(s);
+ super.paint(g, newAlloc);
+ }
+
+ public void insertUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ Shape newAlloc = adjustAllocation(shape);
+ super.insertUpdate(ev, newAlloc, vf);
+ }
+
+ public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ Shape newAlloc = adjustAllocation(shape);
+ super.removeUpdate(ev, newAlloc, vf);
}
+
+ public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ Shape newAlloc = adjustAllocation(shape);
+ super.removeUpdate(ev, newAlloc, vf);
+ }
+
}
diff --git a/javax/swing/text/GapContent.java b/javax/swing/text/GapContent.java
index a22aeed51..111617e94 100644
--- a/javax/swing/text/GapContent.java
+++ b/javax/swing/text/GapContent.java
@@ -40,8 +40,6 @@ package javax.swing.text;
import java.io.Serializable;
-// too lazy to make a real gapcontent.
-// lets just use a stringbuffer instead.
import javax.swing.undo.UndoableEdit;
/**
@@ -53,20 +51,41 @@ import javax.swing.undo.UndoableEdit;
* has to be shifted around when the insertion point moves (then the gap also
* moves and one array copy is necessary) or when the gap is filled up and
* the buffer has to be enlarged.
+ *
+ * TODO: Implement UndoableEdit support stuff
*/
public class GapContent
implements AbstractDocument.Content, Serializable
{
private static final long serialVersionUID = 8374645204155842629L;
-
- StringBuffer buf = new StringBuffer();
+
+ /**
+ * This is the default buffer size and the amount of bytes that
+ * a buffer is extended if it is full.
+ */
+ static final int DEFAULT_BUFSIZE = 64;
+
+ /**
+ * The text buffer.
+ */
+ char[] buffer;
+
+ /**
+ * The index of the first character of the gap.
+ */
+ int gapStart;
+
+ /**
+ * The index of the character after the last character of the gap.
+ */
+ int gapEnd;
/**
* Creates a new GapContent object.
*/
public GapContent()
{
- this(10);
+ this(DEFAULT_BUFSIZE);
}
/**
@@ -76,30 +95,33 @@ public class GapContent
*/
public GapContent(int size)
{
- buf.append("\n");
+ buffer = (char[]) allocateArray(size);
+ gapStart = 0;
+ gapEnd = size - 1;
+ buffer[size - 1] = '\n';
}
/**
- * Creates and returns a mark at the specified position.
- *
- * @param offset the position at which to create the mark
+ * Allocates an array of the specified length that can then be used as
+ * buffer.
*
- * @return the create Position object for the mark
+ * @param size the size of the array to be allocated
*
- * @throws BadLocationException if the offset is not a valid position in
- * the buffer
+ * @return the allocated array
*/
- public Position createPosition(final int offset) throws BadLocationException
+ protected Object allocateArray(int size)
{
- return new Position()
- {
- int off = offset;
+ return new char[size];
+ }
- public int getOffset()
- {
- return off;
- }
- };
+ /**
+ * Returns the length of the allocated buffer array.
+ *
+ * @return the length of the allocated buffer array
+ */
+ protected int getArrayLength()
+ {
+ return buffer.length;
}
/**
@@ -109,7 +131,7 @@ public class GapContent
*/
public int length()
{
- return buf.length();
+ return buffer.length - (gapEnd - gapStart);
}
/**
@@ -127,7 +149,27 @@ public class GapContent
public UndoableEdit insertString(int where, String str)
throws BadLocationException
{
- buf.insert(where, str);
+ // check arguments
+ int length = length();
+ int strLen = str.length();
+
+ if (where >= length)
+ throw new BadLocationException("the where argument cannot be greater"
+ + " than the content length", where);
+
+ // check if the gap is big enough to hold the string
+ if ((gapEnd - gapStart) < strLen)
+ // make room for this string and some more
+ shiftEnd(strLen + DEFAULT_BUFSIZE);
+
+ // are we at the gap boundary?
+ if (where != gapStart)
+ shiftGap(where);
+
+ // now we can simple copy the string into the gap and adjust the
+ // gap boundaries
+ System.arraycopy(str.toCharArray(), 0, buffer, gapStart, strLen);
+ gapStart += strLen;
return null;
}
@@ -146,7 +188,23 @@ public class GapContent
public UndoableEdit remove(int where, int nitems)
throws BadLocationException
{
- buf.delete(where, where + nitems);
+ // check arguments
+ int length = length();
+
+ if (where >= length)
+ throw new BadLocationException("the where argument cannot be greater"
+ + " than the content length", where);
+ if ((where + nitems) > length)
+ throw new BadLocationException("where + nitems cannot be greater"
+ + " than the content length",
+ where + nitems);
+
+ // check if we are at the gap boundary
+ if (where != gapStart)
+ shiftGap(where);
+
+ // now we simply have to enlarge the gap
+ gapEnd += nitems;
return null;
}
@@ -161,12 +219,18 @@ public class GapContent
*/
public String getString(int where, int len) throws BadLocationException
{
- return buf.substring(where, where+len);
+ Segment seg = new Segment();
+ getChars(where, len, seg);
+ return new String(seg.array, seg.offset, seg.count);
}
/**
* Fetches a piece of content and stores it in a {@link Segment} object.
*
+ * If the requested piece of text spans the gap, the content is copied
+ * into a new array. If it doesn't then it is contiguous and the
+ * actual content store is returned.
+ *
* @param where the start location of the fragment
* @param len the length of the fragment
* @param txt the Segment object to store the fragment in
@@ -177,11 +241,116 @@ public class GapContent
public void getChars(int where, int len, Segment txt)
throws BadLocationException
{
- txt.array = new char[len];
+ // check arguments
+ int length = length();
+ if (where >= length)
+ throw new BadLocationException("the where argument cannot be greater"
+ + " than the content length", where);
+ if ((where + len) > length)
+ throw new BadLocationException("len plus where cannot be greater"
+ + " than the content length",
+ len + where);
- System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len);
+ // check if requested segment is contiguous
+ if ((where < gapStart) && ((gapStart - where) < len))
+ {
+ // requested segment is not contiguous -> copy the pieces together
+ char[] copy = new char[len];
+ int lenFirst = gapStart - where; // the length of the first segment
+ System.arraycopy(buffer, where, copy, 0, lenFirst);
+ System.arraycopy(buffer, gapEnd, copy, lenFirst, len - lenFirst);
+ txt.array = copy;
+ txt.offset = 0;
+ txt.count = len;
+ }
+ else
+ {
+ // requested segment is contiguous -> we can simply return the
+ // actual content
+ txt.array = buffer;
+ if (where < gapStart)
+ txt.offset = where;
+ else
+ txt.offset = where + (gapEnd - gapStart);
+ txt.count = len;
+ }
+ }
- txt.count = len;
- txt.offset = 0;
+ /**
+ * Creates and returns a mark at the specified position.
+ *
+ * @param offset the position at which to create the mark
+ *
+ * @return the create Position object for the mark
+ *
+ * @throws BadLocationException if the offset is not a valid position in
+ * the buffer
+ */
+ public Position createPosition(final int offset) throws BadLocationException
+ {
+ return new Position()
+ {
+ int off = offset;
+
+ public int getOffset()
+ {
+ return off;
+ }
+ };
+ }
+
+ /**
+ * Enlarges the gap. This allocates a new bigger buffer array, copy the
+ * segment before the gap as it is and the segment after the gap at
+ * the end of the new buffer array. This does change the gapEnd mark
+ * but not the gapStart mark.
+ *
+ * @param newSize the new size of the gap
+ */
+ protected void shiftEnd(int newSize)
+ {
+ char[] newBuf = (char[]) allocateArray(length() + newSize);
+ System.arraycopy(buffer, 0, newBuf, 0, gapStart);
+ System.arraycopy(buffer, gapEnd, newBuf, gapStart + newSize,
+ buffer.length - gapEnd);
+ gapEnd = gapStart + newSize;
+ buffer = newBuf;
+ }
+
+ /**
+ * Shifts the gap to the specified position.
+ *
+ * @param newGapStart the new start position of the gap
+ */
+ protected void shiftGap(int newGapStart)
+ {
+ int newGapEnd = newGapStart + (gapEnd - gapStart);
+
+ if (newGapStart == gapStart)
+ return;
+ else if (newGapStart < gapStart)
+ {
+ System.arraycopy(buffer, newGapStart, buffer, newGapEnd,
+ gapStart - newGapStart);
+ gapStart = newGapStart;
+ gapEnd = newGapEnd;
+ }
+ else
+ {
+ System.arraycopy(buffer, gapEnd, buffer, gapStart,
+ newGapStart - gapStart);
+ gapStart = newGapStart;
+ gapEnd = newGapEnd;
+ }
+ }
+
+ /**
+ * Returns the allocated buffer array.
+ *
+ * @return the allocated buffer array
+ */
+ protected Object getArray()
+ {
+ return buffer;
}
}
diff --git a/javax/swing/text/JTextComponent.java b/javax/swing/text/JTextComponent.java
index 6b464b5de..68b2161d1 100644
--- a/javax/swing/text/JTextComponent.java
+++ b/javax/swing/text/JTextComponent.java
@@ -895,30 +895,11 @@ public abstract class JTextComponent extends JComponent
private Insets margin;
private boolean dragEnabled;
- /** Issues repaint request on document changes. */
- private DocumentListener repaintListener;
-
/**
* Creates a new <code>JTextComponent</code> instance.
*/
public JTextComponent()
{
- repaintListener = new DocumentListener()
- {
- public void changedUpdate(DocumentEvent ev)
- {
- repaint();
- }
- public void insertUpdate(DocumentEvent ev)
- {
- repaint();
- }
- public void removeUpdate(DocumentEvent ev)
- {
- repaint();
- }
- };
-
Keymap defkeymap = getKeymap(DEFAULT_KEYMAP);
boolean creatingKeymap = false;
if (defkeymap == null)
@@ -929,6 +910,7 @@ public abstract class JTextComponent extends JComponent
}
setFocusable(true);
+ setEditable(true);
enableEvents(AWTEvent.KEY_EVENT_MASK);
updateUI();
@@ -952,13 +934,6 @@ public abstract class JTextComponent extends JComponent
{
Document oldDoc = doc;
doc = newDoc;
-
- // setup document listener
- if (oldDoc != null)
- oldDoc.removeDocumentListener(repaintListener);
- if (newDoc != null)
- newDoc.addDocumentListener(repaintListener);
-
firePropertyChange("document", oldDoc, newDoc);
revalidate();
repaint();
diff --git a/javax/swing/text/PlainDocument.java b/javax/swing/text/PlainDocument.java
index 64e9c8ab3..3a44725fc 100644
--- a/javax/swing/text/PlainDocument.java
+++ b/javax/swing/text/PlainDocument.java
@@ -47,7 +47,7 @@ public class PlainDocument extends AbstractDocument
public static final String lineLimitAttribute = "lineLimit";
public static final String tabSizeAttribute = "tabSize";
- private Element rootElement;
+ private BranchElement rootElement;
private int tabSize;
public PlainDocument()
@@ -59,7 +59,7 @@ public class PlainDocument extends AbstractDocument
{
super(content);
tabSize = 8;
- rootElement = createDefaultRoot();
+ rootElement = (BranchElement) createDefaultRoot();
}
private void reindex()
@@ -114,9 +114,43 @@ public class PlainDocument extends AbstractDocument
protected void removeUpdate(DefaultDocumentEvent event)
{
- reindex();
-
super.removeUpdate(event);
+
+ int p0 = event.getOffset();
+ int p1 = event.getLength() + p0;
+ int len = event.getLength();
+
+ // check if we must collapse some elements
+ int i1 = rootElement.getElementIndex(p0);
+ int i2 = rootElement.getElementIndex(p1);
+ if (i1 != i2)
+ {
+ Element el1 = rootElement.getElement(i1);
+ Element el2 = rootElement.getElement(i2);
+ int start = el1.getStartOffset();
+ int end = el2.getEndOffset();
+ // collapse elements if the removal spans more than 1 line
+ Element newEl = createLeafElement(rootElement,
+ SimpleAttributeSet.EMPTY,
+ start, end - len);
+ rootElement.replace(start, end - start, new Element[]{ newEl });
+ }
+ else
+ {
+ // otherwise only adjust indices of the element
+ LeafElement el1 = (LeafElement) rootElement.getElement(i1);
+ el1.end -= len;
+ }
+
+ // reindex remaining elements
+ for (int i = rootElement.getElementIndex(p0) + 1;
+ i < rootElement.getElementCount(); i++)
+ {
+ LeafElement el = (LeafElement) rootElement.getElement(i);
+ el.start -= len;
+ el.end -= len;
+ }
+
}
public Element getDefaultRootElement()
diff --git a/javax/swing/text/PlainView.java b/javax/swing/text/PlainView.java
index c852c1d69..cc58dd065 100644
--- a/javax/swing/text/PlainView.java
+++ b/javax/swing/text/PlainView.java
@@ -148,7 +148,7 @@ public class PlainView extends View
g.setColor(unselectedColor);
Segment segment = new Segment();
getDocument().getText(p0, p1 - p0, segment);
- return Utilities.drawTabbedText(segment, x, y, g, this, 0);
+ return Utilities.drawTabbedText(segment, x, y, g, this, segment.offset);
}
public void paint(Graphics g, Shape s)
@@ -200,7 +200,42 @@ public class PlainView extends View
if (axis != X_AXIS && axis != Y_AXIS)
throw new IllegalArgumentException();
- return 10;
+ // make sure we have the metrics
+ updateMetrics();
+
+ float span = 0;
+ Element el = getElement();
+ Document doc = el.getDocument();
+ Segment seg = new Segment();
+
+ switch (axis)
+ {
+ case X_AXIS:
+ // calculate the maximum of the line's widths
+ for (int i = 0; i < el.getElementCount(); i++)
+ {
+ Element child = el.getElement(i);
+ int start = child.getStartOffset();
+ int end = child.getEndOffset();
+ try {
+ doc.getText(start, start + end, seg);
+ }
+ catch (BadLocationException ex)
+ {
+ // throw new ClasspathAssertionError
+ // ("no BadLocationException should be thrown here");
+ }
+ int width = metrics.charsWidth(seg.array, seg.offset, seg.count);
+ span = Math.max(span, width);
+ }
+ break;
+ case Y_AXIS:
+ default:
+ span = metrics.getHeight() * el.getElementCount();
+ break;
+ }
+
+ return span;
}
}
diff --git a/javax/swing/text/Utilities.java b/javax/swing/text/Utilities.java
index c55f48e0a..79047014d 100644
--- a/javax/swing/text/Utilities.java
+++ b/javax/swing/text/Utilities.java
@@ -92,7 +92,7 @@ public class Utilities
int ascent = metrics.getAscent();
int pixelWidth = 0;
- int pos = 0;
+ int pos = s.offset;
int len = 0;
for (int offset = s.offset; offset < (s.offset + s.count); ++offset)
diff --git a/javax/swing/text/View.java b/javax/swing/text/View.java
index 46f42b503..760e3b0ae 100644
--- a/javax/swing/text/View.java
+++ b/javax/swing/text/View.java
@@ -40,9 +40,12 @@ package javax.swing.text;
import java.awt.Container;
import java.awt.Graphics;
+import java.awt.Rectangle;
import java.awt.Shape;
+import javax.swing.JComponent;
import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
public abstract class View implements SwingConstants
{
@@ -59,6 +62,11 @@ public abstract class View implements SwingConstants
private View parent;
/**
+ * The child views.
+ */
+ View[] children;
+
+ /**
* Creates a new <code>View</code> instance.
*
* @param elem an <code>Element</code> value
@@ -66,6 +74,7 @@ public abstract class View implements SwingConstants
public View(Element elem)
{
elt = elem;
+ children = new View[0];
}
public abstract void paint(Graphics g, Shape s);
@@ -241,6 +250,8 @@ public abstract class View implements SwingConstants
{
if (parent != null)
parent.preferenceChanged(this, width, height);
+ else
+ ((JComponent) getContainer()).revalidate();
}
public int getBreakWeight(int axis, float pos, float len)
@@ -260,5 +271,193 @@ public abstract class View implements SwingConstants
{
return -1;
}
+
+ /**
+ * Receive notification about an insert update to the text model.
+ *
+ * The default implementation of this method does the following:
+ * <ul>
+ * <li>Call {@link #updateChildren} if the element that this view is
+ * responsible for has changed. This makes sure that the children can
+ * correctly represent the model.<li>
+ * <li>Call {@link #forwardUpdate}. This forwards the DocumentEvent to
+ * the child views.<li>
+ * <li>Call {@link #updateLayout}. Gives the view a chance to either
+ * repair its layout, reschedule layout or do nothing at all.</li>
+ * </ul>
+ *
+ * @param ev the DocumentEvent that describes the change
+ * @param shape the shape of the view
+ * @param vf the ViewFactory for creating child views
+ */
+ public void insertUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ Element el = getElement();
+ DocumentEvent.ElementChange ec = ev.getChange(el);
+ if (ec != null)
+ updateChildren(ec, ev, vf);
+ forwardUpdate(ec, ev, shape, vf);
+ updateLayout(ec, ev, shape);
+ }
+
+ /**
+ * Receive notification about a remove update to the text model.
+ *
+ * The default implementation of this method does the following:
+ * <ul>
+ * <li>Call {@link #updateChildren} if the element that this view is
+ * responsible for has changed. This makes sure that the children can
+ * correctly represent the model.<li>
+ * <li>Call {@link #forwardUpdate}. This forwards the DocumentEvent to
+ * the child views.<li>
+ * <li>Call {@link #updateLayout}. Gives the view a chance to either
+ * repair its layout, reschedule layout or do nothing at all.</li>
+ * </ul>
+ *
+ * @param ev the DocumentEvent that describes the change
+ * @param shape the shape of the view
+ * @param vf the ViewFactory for creating child views
+ */
+ public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ Element el = getElement();
+ DocumentEvent.ElementChange ec = ev.getChange(el);
+ if (ec != null)
+ updateChildren(ec, ev, vf);
+ forwardUpdate(ec, ev, shape, vf);
+ updateLayout(ec, ev, shape);
+ }
+
+ /**
+ * Receive notification about a change update to the text model.
+ *
+ * The default implementation of this method does the following:
+ * <ul>
+ * <li>Call {@link #updateChildren} if the element that this view is
+ * responsible for has changed. This makes sure that the children can
+ * correctly represent the model.<li>
+ * <li>Call {@link #forwardUpdate}. This forwards the DocumentEvent to
+ * the child views.<li>
+ * <li>Call {@link #updateLayout}. Gives the view a chance to either
+ * repair its layout, reschedule layout or do nothing at all.</li>
+ * </ul>
+ *
+ * @param ev the DocumentEvent that describes the change
+ * @param shape the shape of the view
+ * @param vf the ViewFactory for creating child views
+ */
+ public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ Element el = getElement();
+ DocumentEvent.ElementChange ec = ev.getChange(el);
+ if (ec != null)
+ updateChildren(ec, ev, vf);
+ forwardUpdate(ec, ev, shape, vf);
+ updateLayout(ec, ev, shape);
+ }
+
+ /**
+ * Updates the list of children that is returned by {@link #getView}
+ * and {@link #getViewCount}.
+ *
+ * Element that are specified as beeing added in the ElementChange record are
+ * assigned a view for using the ViewFactory. Views of Elements that
+ * are specified as beeing removed are removed from the list.
+ *
+ * @param ec the ElementChange record that describes the change of the
+ * element
+ * @param ev the DocumentEvent describing the change of the document model
+ * @param vf the ViewFactory to use for creating new views
+ *
+ * @return whether or not the child views represent the child elements of
+ * the element that this view is responsible for. Some views may
+ * create views that are responsible only for parts of the element
+ * that they are responsible for and should then return false.
+ *
+ * @since 1.3
+ */
+ protected boolean updateChildren(DocumentEvent.ElementChange ec,
+ DocumentEvent ev,
+ ViewFactory vf)
+ {
+ Element[] added = ec.getChildrenAdded();
+ Element[] removed = ec.getChildrenRemoved();
+ View[] newChildren = new View[children.length + added.length
+ - removed.length];
+ int index = ec.getIndex();
+ System.arraycopy(children, 0, newChildren, 0, index);
+ System.arraycopy(children, index, added, 0, added.length);
+ int index2 = index + removed.length;
+ int len2 = children.length - index2;
+ System.arraycopy(children, index2, newChildren, index + added.length,
+ len2);
+ children = newChildren;
+
+ return true;
+ }
+
+ /**
+ * Forwards the DocumentEvent to child views that need to get notified
+ * of the change to the model. This calles {@link #forwardUpdateToView}
+ * for each View that must be forwarded to.
+ *
+ * @param ec the ElementChange describing the element changes (may be
+ * <code>null</code> if there were no changes)
+ * @param ev the DocumentEvent describing the changes to the model
+ * @param shape the current allocation of the view
+ * @param vf the ViewFactory used to create new Views
+ *
+ * @since 1.3
+ */
+ protected void forwardUpdate(DocumentEvent.ElementChange ec,
+ DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ for (int i = 0; i < children.length; i++)
+ {
+ View child = children[i];
+ forwardUpdateToView(child, ev, shape, vf);
+ }
+ }
+
+ /**
+ * Forwards an update event to the given child view. This calls
+ * {@link #insertUpdate}, {@link #removeUpdate} or {@link #changedUpdate},
+ * depending on the type of document event.
+ *
+ * @param view the View to forward the event to
+ * @param ev the DocumentEvent to forward
+ * @param shape the current allocation of the View
+ * @param vf the ViewFactory used to create new Views
+ *
+ * @since 1.3
+ */
+ protected void forwardUpdateToView(View view, DocumentEvent ev, Shape shape,
+ ViewFactory vf)
+ {
+ DocumentEvent.EventType type = ev.getType();
+ if (type == DocumentEvent.EventType.INSERT)
+ view.insertUpdate(ev, shape, vf);
+ else if (type == DocumentEvent.EventType.REMOVE)
+ view.removeUpdate(ev, shape, vf);
+ else if (type == DocumentEvent.EventType.CHANGE)
+ view.changedUpdate(ev, shape, vf);
+ }
+
+ /**
+ * Updates the layout.
+ *
+ * @param ec the ElementChange that describes the changes to the element
+ * @param ev the DocumentEvent that describes the changes to the model
+ * @param shape the current allocation for this view
+ *
+ * @since 1.3
+ */
+ protected void updateLayout(DocumentEvent.ElementChange ec,
+ DocumentEvent ev, Shape shape)
+ {
+ Rectangle b = shape.getBounds();
+ if (ec != null)
+ preferenceChanged(this, true, true);
+ }
}