Prvotní přidání zdrojáků JFTable – Swingová tabulka s možností řazení
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 28 Feb 2009 16:51:54 +0100
changeset 00359f2c3b3ba
child 1 41e8def54cbd
Prvotní přidání zdrojáků JFTable – Swingová tabulka s možností řazení
.hgignore
java/JFTable/manifest.mf
java/JFTable/nbproject/build-impl.xml
java/JFTable/nbproject/genfiles.properties
java/JFTable/nbproject/project.properties
java/JFTable/nbproject/project.xml
java/JFTable/src/cz/frantovo/gui/tabulky/JTable.java
java/JFTable/src/cz/frantovo/gui/tabulky/TableSorterModel.java
java/JFTable/src/cz/frantovo/gui/tabulky/dolu.png
java/JFTable/src/cz/frantovo/gui/tabulky/nahoru.png
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgignore	Sat Feb 28 16:51:54 2009 +0100
     1.3 @@ -0,0 +1,3 @@
     1.4 +java/JFTable/dist/*
     1.5 +java/JFTable/build/*
     1.6 +java/JFTable/nbproject/private
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/java/JFTable/manifest.mf	Sat Feb 28 16:51:54 2009 +0100
     2.3 @@ -0,0 +1,3 @@
     2.4 +Manifest-Version: 1.0
     2.5 +X-COMMENT: Main-Class will be added automatically by build
     2.6 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/java/JFTable/nbproject/build-impl.xml	Sat Feb 28 16:51:54 2009 +0100
     3.3 @@ -0,0 +1,627 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<!--
     3.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
     3.7 +***         EDIT ../build.xml INSTEAD         ***
     3.8 +
     3.9 +For the purpose of easier reading the script
    3.10 +is divided into following sections:
    3.11 +
    3.12 +  - initialization
    3.13 +  - compilation
    3.14 +  - jar
    3.15 +  - execution
    3.16 +  - debugging
    3.17 +  - javadoc
    3.18 +  - junit compilation
    3.19 +  - junit execution
    3.20 +  - junit debugging
    3.21 +  - applet
    3.22 +  - cleanup
    3.23 +
    3.24 +        -->
    3.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="JFTable-impl">
    3.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
    3.27 +    <!-- 
    3.28 +                ======================
    3.29 +                INITIALIZATION SECTION 
    3.30 +                ======================
    3.31 +            -->
    3.32 +    <target name="-pre-init">
    3.33 +        <!-- Empty placeholder for easier customization. -->
    3.34 +        <!-- You can override this target in the ../build.xml file. -->
    3.35 +    </target>
    3.36 +    <target depends="-pre-init" name="-init-private">
    3.37 +        <property file="nbproject/private/config.properties"/>
    3.38 +        <property file="nbproject/private/configs/${config}.properties"/>
    3.39 +        <property file="nbproject/private/private.properties"/>
    3.40 +    </target>
    3.41 +    <target depends="-pre-init,-init-private" name="-init-user">
    3.42 +        <property file="${user.properties.file}"/>
    3.43 +        <!-- The two properties below are usually overridden -->
    3.44 +        <!-- by the active platform. Just a fallback. -->
    3.45 +        <property name="default.javac.source" value="1.4"/>
    3.46 +        <property name="default.javac.target" value="1.4"/>
    3.47 +    </target>
    3.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
    3.49 +        <property file="nbproject/configs/${config}.properties"/>
    3.50 +        <property file="nbproject/project.properties"/>
    3.51 +    </target>
    3.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
    3.53 +        <available file="${manifest.file}" property="manifest.available"/>
    3.54 +        <condition property="manifest.available+main.class">
    3.55 +            <and>
    3.56 +                <isset property="manifest.available"/>
    3.57 +                <isset property="main.class"/>
    3.58 +                <not>
    3.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
    3.60 +                </not>
    3.61 +            </and>
    3.62 +        </condition>
    3.63 +        <condition property="manifest.available+main.class+mkdist.available">
    3.64 +            <and>
    3.65 +                <istrue value="${manifest.available+main.class}"/>
    3.66 +                <isset property="libs.CopyLibs.classpath"/>
    3.67 +            </and>
    3.68 +        </condition>
    3.69 +        <condition property="have.tests">
    3.70 +            <or>
    3.71 +                <available file="${test.src.dir}"/>
    3.72 +            </or>
    3.73 +        </condition>
    3.74 +        <condition property="have.sources">
    3.75 +            <or>
    3.76 +                <available file="${src.dir}"/>
    3.77 +            </or>
    3.78 +        </condition>
    3.79 +        <condition property="netbeans.home+have.tests">
    3.80 +            <and>
    3.81 +                <isset property="netbeans.home"/>
    3.82 +                <isset property="have.tests"/>
    3.83 +            </and>
    3.84 +        </condition>
    3.85 +        <condition property="no.javadoc.preview">
    3.86 +            <and>
    3.87 +                <isset property="javadoc.preview"/>
    3.88 +                <isfalse value="${javadoc.preview}"/>
    3.89 +            </and>
    3.90 +        </condition>
    3.91 +        <property name="run.jvmargs" value=""/>
    3.92 +        <property name="javac.compilerargs" value=""/>
    3.93 +        <property name="work.dir" value="${basedir}"/>
    3.94 +        <condition property="no.deps">
    3.95 +            <and>
    3.96 +                <istrue value="${no.dependencies}"/>
    3.97 +            </and>
    3.98 +        </condition>
    3.99 +        <property name="javac.debug" value="true"/>
   3.100 +        <property name="javadoc.preview" value="true"/>
   3.101 +        <property name="application.args" value=""/>
   3.102 +        <property name="source.encoding" value="${file.encoding}"/>
   3.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
   3.104 +            <and>
   3.105 +                <isset property="javadoc.encoding"/>
   3.106 +                <not>
   3.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
   3.108 +                </not>
   3.109 +            </and>
   3.110 +        </condition>
   3.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
   3.112 +        <property name="includes" value="**"/>
   3.113 +        <property name="excludes" value=""/>
   3.114 +        <property name="do.depend" value="false"/>
   3.115 +        <condition property="do.depend.true">
   3.116 +            <istrue value="${do.depend}"/>
   3.117 +        </condition>
   3.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
   3.119 +            <and>
   3.120 +                <isset property="jaxws.endorsed.dir"/>
   3.121 +                <available file="nbproject/jaxws-build.xml"/>
   3.122 +            </and>
   3.123 +        </condition>
   3.124 +    </target>
   3.125 +    <target name="-post-init">
   3.126 +        <!-- Empty placeholder for easier customization. -->
   3.127 +        <!-- You can override this target in the ../build.xml file. -->
   3.128 +    </target>
   3.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
   3.130 +        <fail unless="src.dir">Must set src.dir</fail>
   3.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
   3.132 +        <fail unless="build.dir">Must set build.dir</fail>
   3.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
   3.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
   3.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
   3.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
   3.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
   3.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
   3.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
   3.140 +    </target>
   3.141 +    <target name="-init-macrodef-property">
   3.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.143 +            <attribute name="name"/>
   3.144 +            <attribute name="value"/>
   3.145 +            <sequential>
   3.146 +                <property name="@{name}" value="${@{value}}"/>
   3.147 +            </sequential>
   3.148 +        </macrodef>
   3.149 +    </target>
   3.150 +    <target name="-init-macrodef-javac">
   3.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.152 +            <attribute default="${src.dir}" name="srcdir"/>
   3.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
   3.154 +            <attribute default="${javac.classpath}" name="classpath"/>
   3.155 +            <attribute default="${includes}" name="includes"/>
   3.156 +            <attribute default="${excludes}" name="excludes"/>
   3.157 +            <attribute default="${javac.debug}" name="debug"/>
   3.158 +            <attribute default="" name="sourcepath"/>
   3.159 +            <element name="customize" optional="true"/>
   3.160 +            <sequential>
   3.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
   3.162 +                    <classpath>
   3.163 +                        <path path="@{classpath}"/>
   3.164 +                    </classpath>
   3.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
   3.166 +                    <customize/>
   3.167 +                </javac>
   3.168 +            </sequential>
   3.169 +        </macrodef>
   3.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.171 +            <attribute default="${src.dir}" name="srcdir"/>
   3.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
   3.173 +            <attribute default="${javac.classpath}" name="classpath"/>
   3.174 +            <sequential>
   3.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
   3.176 +                    <classpath>
   3.177 +                        <path path="@{classpath}"/>
   3.178 +                    </classpath>
   3.179 +                </depend>
   3.180 +            </sequential>
   3.181 +        </macrodef>
   3.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
   3.184 +            <sequential>
   3.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
   3.186 +                <pathconvert pathsep="," property="javac.includes.binary">
   3.187 +                    <path>
   3.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
   3.189 +                    </path>
   3.190 +                    <globmapper from="*.java" to="*.class"/>
   3.191 +                </pathconvert>
   3.192 +                <delete>
   3.193 +                    <files includes="${javac.includes.binary}"/>
   3.194 +                </delete>
   3.195 +            </sequential>
   3.196 +        </macrodef>
   3.197 +    </target>
   3.198 +    <target name="-init-macrodef-junit">
   3.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.200 +            <attribute default="${includes}" name="includes"/>
   3.201 +            <attribute default="${excludes}" name="excludes"/>
   3.202 +            <attribute default="**" name="testincludes"/>
   3.203 +            <sequential>
   3.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
   3.205 +                    <batchtest todir="${build.test.results.dir}">
   3.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
   3.207 +                            <filename name="@{testincludes}"/>
   3.208 +                        </fileset>
   3.209 +                    </batchtest>
   3.210 +                    <classpath>
   3.211 +                        <path path="${run.test.classpath}"/>
   3.212 +                    </classpath>
   3.213 +                    <syspropertyset>
   3.214 +                        <propertyref prefix="test-sys-prop."/>
   3.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
   3.216 +                    </syspropertyset>
   3.217 +                    <formatter type="brief" usefile="false"/>
   3.218 +                    <formatter type="xml"/>
   3.219 +                    <jvmarg line="${run.jvmargs}"/>
   3.220 +                </junit>
   3.221 +            </sequential>
   3.222 +        </macrodef>
   3.223 +    </target>
   3.224 +    <target name="-init-macrodef-nbjpda">
   3.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.226 +            <attribute default="${main.class}" name="name"/>
   3.227 +            <attribute default="${debug.classpath}" name="classpath"/>
   3.228 +            <attribute default="" name="stopclassname"/>
   3.229 +            <sequential>
   3.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
   3.231 +                    <classpath>
   3.232 +                        <path path="@{classpath}"/>
   3.233 +                    </classpath>
   3.234 +                </nbjpdastart>
   3.235 +            </sequential>
   3.236 +        </macrodef>
   3.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.238 +            <attribute default="${build.classes.dir}" name="dir"/>
   3.239 +            <sequential>
   3.240 +                <nbjpdareload>
   3.241 +                    <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
   3.242 +                </nbjpdareload>
   3.243 +            </sequential>
   3.244 +        </macrodef>
   3.245 +    </target>
   3.246 +    <target name="-init-debug-args">
   3.247 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
   3.248 +        <condition property="have-jdk-older-than-1.4">
   3.249 +            <or>
   3.250 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
   3.251 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
   3.252 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
   3.253 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
   3.254 +            </or>
   3.255 +        </condition>
   3.256 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
   3.257 +            <istrue value="${have-jdk-older-than-1.4}"/>
   3.258 +        </condition>
   3.259 +    </target>
   3.260 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
   3.261 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.262 +            <attribute default="${main.class}" name="classname"/>
   3.263 +            <attribute default="${debug.classpath}" name="classpath"/>
   3.264 +            <element name="customize" optional="true"/>
   3.265 +            <sequential>
   3.266 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   3.267 +                    <jvmarg line="${debug-args-line}"/>
   3.268 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
   3.269 +                    <jvmarg line="${run.jvmargs}"/>
   3.270 +                    <classpath>
   3.271 +                        <path path="@{classpath}"/>
   3.272 +                    </classpath>
   3.273 +                    <syspropertyset>
   3.274 +                        <propertyref prefix="run-sys-prop."/>
   3.275 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   3.276 +                    </syspropertyset>
   3.277 +                    <customize/>
   3.278 +                </java>
   3.279 +            </sequential>
   3.280 +        </macrodef>
   3.281 +    </target>
   3.282 +    <target name="-init-macrodef-java">
   3.283 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.284 +            <attribute default="${main.class}" name="classname"/>
   3.285 +            <element name="customize" optional="true"/>
   3.286 +            <sequential>
   3.287 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   3.288 +                    <jvmarg line="${run.jvmargs}"/>
   3.289 +                    <classpath>
   3.290 +                        <path path="${run.classpath}"/>
   3.291 +                    </classpath>
   3.292 +                    <syspropertyset>
   3.293 +                        <propertyref prefix="run-sys-prop."/>
   3.294 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   3.295 +                    </syspropertyset>
   3.296 +                    <customize/>
   3.297 +                </java>
   3.298 +            </sequential>
   3.299 +        </macrodef>
   3.300 +    </target>
   3.301 +    <target name="-init-presetdef-jar">
   3.302 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.303 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
   3.304 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
   3.305 +            </jar>
   3.306 +        </presetdef>
   3.307 +    </target>
   3.308 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
   3.309 +    <!--
   3.310 +                ===================
   3.311 +                COMPILATION SECTION
   3.312 +                ===================
   3.313 +            -->
   3.314 +    <target depends="init" name="deps-jar" unless="no.deps"/>
   3.315 +    <target depends="init,deps-jar" name="-pre-pre-compile">
   3.316 +        <mkdir dir="${build.classes.dir}"/>
   3.317 +    </target>
   3.318 +    <target name="-pre-compile">
   3.319 +        <!-- Empty placeholder for easier customization. -->
   3.320 +        <!-- You can override this target in the ../build.xml file. -->
   3.321 +    </target>
   3.322 +    <target if="do.depend.true" name="-compile-depend">
   3.323 +        <j2seproject3:depend/>
   3.324 +    </target>
   3.325 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
   3.326 +        <j2seproject3:javac/>
   3.327 +        <copy todir="${build.classes.dir}">
   3.328 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   3.329 +        </copy>
   3.330 +    </target>
   3.331 +    <target name="-post-compile">
   3.332 +        <!-- Empty placeholder for easier customization. -->
   3.333 +        <!-- You can override this target in the ../build.xml file. -->
   3.334 +    </target>
   3.335 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
   3.336 +    <target name="-pre-compile-single">
   3.337 +        <!-- Empty placeholder for easier customization. -->
   3.338 +        <!-- You can override this target in the ../build.xml file. -->
   3.339 +    </target>
   3.340 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
   3.341 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   3.342 +        <j2seproject3:force-recompile/>
   3.343 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
   3.344 +    </target>
   3.345 +    <target name="-post-compile-single">
   3.346 +        <!-- Empty placeholder for easier customization. -->
   3.347 +        <!-- You can override this target in the ../build.xml file. -->
   3.348 +    </target>
   3.349 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
   3.350 +    <!--
   3.351 +                ====================
   3.352 +                JAR BUILDING SECTION
   3.353 +                ====================
   3.354 +            -->
   3.355 +    <target depends="init" name="-pre-pre-jar">
   3.356 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
   3.357 +        <mkdir dir="${dist.jar.dir}"/>
   3.358 +    </target>
   3.359 +    <target name="-pre-jar">
   3.360 +        <!-- Empty placeholder for easier customization. -->
   3.361 +        <!-- You can override this target in the ../build.xml file. -->
   3.362 +    </target>
   3.363 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
   3.364 +        <j2seproject1:jar/>
   3.365 +    </target>
   3.366 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
   3.367 +        <j2seproject1:jar manifest="${manifest.file}"/>
   3.368 +    </target>
   3.369 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
   3.370 +        <j2seproject1:jar manifest="${manifest.file}">
   3.371 +            <j2seproject1:manifest>
   3.372 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
   3.373 +            </j2seproject1:manifest>
   3.374 +        </j2seproject1:jar>
   3.375 +        <echo>To run this application from the command line without Ant, try:</echo>
   3.376 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   3.377 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   3.378 +        <pathconvert property="run.classpath.with.dist.jar">
   3.379 +            <path path="${run.classpath}"/>
   3.380 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
   3.381 +        </pathconvert>
   3.382 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
   3.383 +    </target>
   3.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
   3.385 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   3.386 +        <pathconvert property="run.classpath.without.build.classes.dir">
   3.387 +            <path path="${run.classpath}"/>
   3.388 +            <map from="${build.classes.dir.resolved}" to=""/>
   3.389 +        </pathconvert>
   3.390 +        <pathconvert pathsep=" " property="jar.classpath">
   3.391 +            <path path="${run.classpath.without.build.classes.dir}"/>
   3.392 +            <chainedmapper>
   3.393 +                <flattenmapper/>
   3.394 +                <globmapper from="*" to="lib/*"/>
   3.395 +            </chainedmapper>
   3.396 +        </pathconvert>
   3.397 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
   3.398 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
   3.399 +            <fileset dir="${build.classes.dir}"/>
   3.400 +            <manifest>
   3.401 +                <attribute name="Main-Class" value="${main.class}"/>
   3.402 +                <attribute name="Class-Path" value="${jar.classpath}"/>
   3.403 +            </manifest>
   3.404 +        </copylibs>
   3.405 +        <echo>To run this application from the command line without Ant, try:</echo>
   3.406 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   3.407 +        <echo>java -jar "${dist.jar.resolved}"</echo>
   3.408 +    </target>
   3.409 +    <target name="-post-jar">
   3.410 +        <!-- Empty placeholder for easier customization. -->
   3.411 +        <!-- You can override this target in the ../build.xml file. -->
   3.412 +    </target>
   3.413 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
   3.414 +    <!--
   3.415 +                =================
   3.416 +                EXECUTION SECTION
   3.417 +                =================
   3.418 +            -->
   3.419 +    <target depends="init,compile" description="Run a main class." name="run">
   3.420 +        <j2seproject1:java>
   3.421 +            <customize>
   3.422 +                <arg line="${application.args}"/>
   3.423 +            </customize>
   3.424 +        </j2seproject1:java>
   3.425 +    </target>
   3.426 +    <target name="-do-not-recompile">
   3.427 +        <property name="javac.includes.binary" value=""/>
   3.428 +    </target>
   3.429 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
   3.430 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   3.431 +        <j2seproject1:java classname="${run.class}"/>
   3.432 +    </target>
   3.433 +    <!--
   3.434 +                =================
   3.435 +                DEBUGGING SECTION
   3.436 +                =================
   3.437 +            -->
   3.438 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
   3.439 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
   3.440 +    </target>
   3.441 +    <target depends="init,compile" name="-debug-start-debuggee">
   3.442 +        <j2seproject3:debug>
   3.443 +            <customize>
   3.444 +                <arg line="${application.args}"/>
   3.445 +            </customize>
   3.446 +        </j2seproject3:debug>
   3.447 +    </target>
   3.448 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
   3.449 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
   3.450 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
   3.451 +    </target>
   3.452 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
   3.453 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
   3.454 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
   3.455 +        <j2seproject3:debug classname="${debug.class}"/>
   3.456 +    </target>
   3.457 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
   3.458 +    <target depends="init" name="-pre-debug-fix">
   3.459 +        <fail unless="fix.includes">Must set fix.includes</fail>
   3.460 +        <property name="javac.includes" value="${fix.includes}.java"/>
   3.461 +    </target>
   3.462 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
   3.463 +        <j2seproject1:nbjpdareload/>
   3.464 +    </target>
   3.465 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
   3.466 +    <!--
   3.467 +                ===============
   3.468 +                JAVADOC SECTION
   3.469 +                ===============
   3.470 +            -->
   3.471 +    <target depends="init" name="-javadoc-build">
   3.472 +        <mkdir dir="${dist.javadoc.dir}"/>
   3.473 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
   3.474 +            <classpath>
   3.475 +                <path path="${javac.classpath}"/>
   3.476 +            </classpath>
   3.477 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
   3.478 +                <filename name="**/*.java"/>
   3.479 +            </fileset>
   3.480 +        </javadoc>
   3.481 +    </target>
   3.482 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
   3.483 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
   3.484 +    </target>
   3.485 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
   3.486 +    <!--
   3.487 +                =========================
   3.488 +                JUNIT COMPILATION SECTION
   3.489 +                =========================
   3.490 +            -->
   3.491 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
   3.492 +        <mkdir dir="${build.test.classes.dir}"/>
   3.493 +    </target>
   3.494 +    <target name="-pre-compile-test">
   3.495 +        <!-- Empty placeholder for easier customization. -->
   3.496 +        <!-- You can override this target in the ../build.xml file. -->
   3.497 +    </target>
   3.498 +    <target if="do.depend.true" name="-compile-test-depend">
   3.499 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   3.500 +    </target>
   3.501 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
   3.502 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   3.503 +        <copy todir="${build.test.classes.dir}">
   3.504 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   3.505 +        </copy>
   3.506 +    </target>
   3.507 +    <target name="-post-compile-test">
   3.508 +        <!-- Empty placeholder for easier customization. -->
   3.509 +        <!-- You can override this target in the ../build.xml file. -->
   3.510 +    </target>
   3.511 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
   3.512 +    <target name="-pre-compile-test-single">
   3.513 +        <!-- Empty placeholder for easier customization. -->
   3.514 +        <!-- You can override this target in the ../build.xml file. -->
   3.515 +    </target>
   3.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
   3.517 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   3.518 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
   3.519 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
   3.520 +        <copy todir="${build.test.classes.dir}">
   3.521 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   3.522 +        </copy>
   3.523 +    </target>
   3.524 +    <target name="-post-compile-test-single">
   3.525 +        <!-- Empty placeholder for easier customization. -->
   3.526 +        <!-- You can override this target in the ../build.xml file. -->
   3.527 +    </target>
   3.528 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
   3.529 +    <!--
   3.530 +                =======================
   3.531 +                JUNIT EXECUTION SECTION
   3.532 +                =======================
   3.533 +            -->
   3.534 +    <target depends="init" if="have.tests" name="-pre-test-run">
   3.535 +        <mkdir dir="${build.test.results.dir}"/>
   3.536 +    </target>
   3.537 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
   3.538 +        <j2seproject3:junit testincludes="**/*Test.java"/>
   3.539 +    </target>
   3.540 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
   3.541 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   3.542 +    </target>
   3.543 +    <target depends="init" if="have.tests" name="test-report"/>
   3.544 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
   3.545 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
   3.546 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
   3.547 +        <mkdir dir="${build.test.results.dir}"/>
   3.548 +    </target>
   3.549 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
   3.550 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
   3.551 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
   3.552 +    </target>
   3.553 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
   3.554 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   3.555 +    </target>
   3.556 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
   3.557 +    <!--
   3.558 +                =======================
   3.559 +                JUNIT DEBUGGING SECTION
   3.560 +                =======================
   3.561 +            -->
   3.562 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
   3.563 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
   3.564 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
   3.565 +        <delete file="${test.report.file}"/>
   3.566 +        <mkdir dir="${build.test.results.dir}"/>
   3.567 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
   3.568 +            <customize>
   3.569 +                <syspropertyset>
   3.570 +                    <propertyref prefix="test-sys-prop."/>
   3.571 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
   3.572 +                </syspropertyset>
   3.573 +                <arg value="${test.class}"/>
   3.574 +                <arg value="showoutput=true"/>
   3.575 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
   3.576 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
   3.577 +            </customize>
   3.578 +        </j2seproject3:debug>
   3.579 +    </target>
   3.580 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
   3.581 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
   3.582 +    </target>
   3.583 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
   3.584 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
   3.585 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
   3.586 +    </target>
   3.587 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
   3.588 +    <!--
   3.589 +                =========================
   3.590 +                APPLET EXECUTION SECTION
   3.591 +                =========================
   3.592 +            -->
   3.593 +    <target depends="init,compile-single" name="run-applet">
   3.594 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   3.595 +        <j2seproject1:java classname="sun.applet.AppletViewer">
   3.596 +            <customize>
   3.597 +                <arg value="${applet.url}"/>
   3.598 +            </customize>
   3.599 +        </j2seproject1:java>
   3.600 +    </target>
   3.601 +    <!--
   3.602 +                =========================
   3.603 +                APPLET DEBUGGING  SECTION
   3.604 +                =========================
   3.605 +            -->
   3.606 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
   3.607 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   3.608 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
   3.609 +            <customize>
   3.610 +                <arg value="${applet.url}"/>
   3.611 +            </customize>
   3.612 +        </j2seproject3:debug>
   3.613 +    </target>
   3.614 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
   3.615 +    <!--
   3.616 +                ===============
   3.617 +                CLEANUP SECTION
   3.618 +                ===============
   3.619 +            -->
   3.620 +    <target depends="init" name="deps-clean" unless="no.deps"/>
   3.621 +    <target depends="init" name="-do-clean">
   3.622 +        <delete dir="${build.dir}"/>
   3.623 +        <delete dir="${dist.dir}"/>
   3.624 +    </target>
   3.625 +    <target name="-post-clean">
   3.626 +        <!-- Empty placeholder for easier customization. -->
   3.627 +        <!-- You can override this target in the ../build.xml file. -->
   3.628 +    </target>
   3.629 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
   3.630 +</project>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/java/JFTable/nbproject/genfiles.properties	Sat Feb 28 16:51:54 2009 +0100
     4.3 @@ -0,0 +1,8 @@
     4.4 +build.xml.data.CRC32=18ffd276
     4.5 +build.xml.script.CRC32=1966b3ef
     4.6 +build.xml.stylesheet.CRC32=be360661
     4.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     4.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     4.9 +nbproject/build-impl.xml.data.CRC32=18ffd276
    4.10 +nbproject/build-impl.xml.script.CRC32=44ad41ff
    4.11 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/java/JFTable/nbproject/project.properties	Sat Feb 28 16:51:54 2009 +0100
     5.3 @@ -0,0 +1,59 @@
     5.4 +build.classes.dir=${build.dir}/classes
     5.5 +build.classes.excludes=**/*.java,**/*.form
     5.6 +# This directory is removed when the project is cleaned:
     5.7 +build.dir=build
     5.8 +build.generated.dir=${build.dir}/generated
     5.9 +# Only compile against the classpath explicitly listed here:
    5.10 +build.sysclasspath=ignore
    5.11 +build.test.classes.dir=${build.dir}/test/classes
    5.12 +build.test.results.dir=${build.dir}/test/results
    5.13 +debug.classpath=\
    5.14 +    ${run.classpath}
    5.15 +debug.test.classpath=\
    5.16 +    ${run.test.classpath}
    5.17 +# This directory is removed when the project is cleaned:
    5.18 +dist.dir=dist
    5.19 +dist.jar=${dist.dir}/JFTable.jar
    5.20 +dist.javadoc.dir=${dist.dir}/javadoc
    5.21 +excludes=
    5.22 +includes=**
    5.23 +jar.compress=false
    5.24 +javac.classpath=
    5.25 +# Space-separated list of extra javac options
    5.26 +javac.compilerargs=
    5.27 +javac.deprecation=false
    5.28 +javac.source=1.5
    5.29 +javac.target=1.5
    5.30 +javac.test.classpath=\
    5.31 +    ${javac.classpath}:\
    5.32 +    ${build.classes.dir}:\
    5.33 +    ${libs.junit.classpath}:\
    5.34 +    ${libs.junit_4.classpath}
    5.35 +javadoc.additionalparam=
    5.36 +javadoc.author=false
    5.37 +javadoc.encoding=${source.encoding}
    5.38 +javadoc.noindex=false
    5.39 +javadoc.nonavbar=false
    5.40 +javadoc.notree=false
    5.41 +javadoc.private=false
    5.42 +javadoc.splitindex=true
    5.43 +javadoc.use=true
    5.44 +javadoc.version=false
    5.45 +javadoc.windowtitle=
    5.46 +main.class=
    5.47 +manifest.file=manifest.mf
    5.48 +meta.inf.dir=${src.dir}/META-INF
    5.49 +platform.active=default_platform
    5.50 +run.classpath=\
    5.51 +    ${javac.classpath}:\
    5.52 +    ${build.classes.dir}
    5.53 +# Space-separated list of JVM arguments used when running the project
    5.54 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
    5.55 +# or test-sys-prop.name=value to set system properties for unit tests):
    5.56 +run.jvmargs=
    5.57 +run.test.classpath=\
    5.58 +    ${javac.test.classpath}:\
    5.59 +    ${build.test.classes.dir}
    5.60 +source.encoding=UTF-8
    5.61 +src.dir=src
    5.62 +test.src.dir=test
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/java/JFTable/nbproject/project.xml	Sat Feb 28 16:51:54 2009 +0100
     6.3 @@ -0,0 +1,16 @@
     6.4 +<?xml version="1.0" encoding="UTF-8"?>
     6.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     6.6 +    <type>org.netbeans.modules.java.j2seproject</type>
     6.7 +    <configuration>
     6.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
     6.9 +            <name>JFTable</name>
    6.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
    6.11 +            <source-roots>
    6.12 +                <root id="src.dir"/>
    6.13 +            </source-roots>
    6.14 +            <test-roots>
    6.15 +                <root id="test.src.dir"/>
    6.16 +            </test-roots>
    6.17 +        </data>
    6.18 +    </configuration>
    6.19 +</project>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/java/JFTable/src/cz/frantovo/gui/tabulky/JTable.java	Sat Feb 28 16:51:54 2009 +0100
     7.3 @@ -0,0 +1,115 @@
     7.4 +package cz.frantovo.gui.tabulky;
     7.5 +
     7.6 +
     7.7 +import java.awt.Point;
     7.8 +import java.awt.event.MouseEvent;
     7.9 +
    7.10 +import javax.swing.ImageIcon;
    7.11 +import javax.swing.table.TableModel;
    7.12 +
    7.13 +/**
    7.14 + * Tahle t��da umo��uje jednoduch�m zp�sobem p�idat va�im tabulk�m funkci
    7.15 + * �azen�. Sta�� ve va�� t��d� nahradit: <br>
    7.16 + * "import javax.swing.JTable;" <br>
    7.17 + * t�mto importem: " import cz.frantovo.gui.tabulky.JTable;<br>
    7.18 + * <br>
    7.19 + * Pomoc� kl�vesy ctrl jde �adit podle v�ce sloupc�" <br>
    7.20 + * <br>
    7.21 + * Tak� p�id�v� funkci zobrazov�n� tooltipu (zobrazuje obsah bu�ky)
    7.22 + * 
    7.23 + * Proto�e t��d�c� model a skute�n� model obsahuj� ��dky v jin�m po�ad�,<br>
    7.24 + * je pot�eba p�epo��tat index z�skan� metodou getSelectedRow() na index ve skute�n�m modelu<br>
    7.25 + * <br>
    7.26 + * k tomu slou�� tento postup:<br>
    7.27 + * int r = jTable1.getSelectedRow();<br>
    7.28 + * int rr = ((TableSorterModel)tabulka.getModel()).modelIndex(r);<br>
    7.29 + * <br> 
    7.30 + * rr je potom index ��dku ve skute�n�m modelu. * 
    7.31 + * 
    7.32 + * @author František Kučera
    7.33 + */
    7.34 +public class JTable extends javax.swing.JTable {
    7.35 +
    7.36 +        private static final long serialVersionUID = -5133441062459764995L;
    7.37 +
    7.38 +        private TableSorterModel tableSorterModel;
    7.39 +
    7.40 +        private TableModel realTableModel;
    7.41 +
    7.42 +        private boolean showTooltips = false;
    7.43 +
    7.44 +        public boolean isShowTooltips ()
    7.45 +        {
    7.46 +                return showTooltips;
    7.47 +        }
    7.48 +
    7.49 +        /** Nastavuje, zda se maj� zobrazovat tooltipy zobrazuj�c� obsah bu�ky */
    7.50 +        public void setShowTooltips (boolean showTooltips)
    7.51 +        {
    7.52 +                this.showTooltips = showTooltips;
    7.53 +        }
    7.54 +
    7.55 +        /**
    7.56 +         * Nastav� TableModel a zabal� ho do TableSorterModelu, tabulka t�m
    7.57 +         * z�sk� schopnost �azen� ��dk�
    7.58 +         */
    7.59 +    @Override
    7.60 +        public void setModel (TableModel dataModel)
    7.61 +        {
    7.62 +                realTableModel = dataModel;
    7.63 +                tableSorterModel = new TableSorterModel(dataModel);
    7.64 +
    7.65 +                tableSorterModel.setTableHeader(getTableHeader());
    7.66 +
    7.67 +                super.setModel(tableSorterModel);
    7.68 +        }
    7.69 +
    7.70 +        /**
    7.71 +         * @return TableModel, kter� obsahuje data. Nen� tedy zabalen do
    7.72 +         *         TableSorterModelu
    7.73 +         */
    7.74 +        public TableModel getRealTableModel ()
    7.75 +        {
    7.76 +                return realTableModel;
    7.77 +        }
    7.78 +
    7.79 +        /**
    7.80 +         * @return TableSorterModel, kter� obaluje skute�n� TableModel, kter�
    7.81 +         *         obsahuje data. TableSorterModel slou�� pouze k �azen� polo�ek
    7.82 +         */
    7.83 +    @Override
    7.84 +        public TableModel getModel ()
    7.85 +        {
    7.86 +                return super.getModel();
    7.87 +        }
    7.88 +
    7.89 +        /**
    7.90 +         * Pokud je nastaveno showTooltips, zobrazuje v tooltipu obsah bu�ky pod
    7.91 +         * my�� (hod� se, pokud je obsah bu�ky p��li� dlouh�). Pokud bu�ka
    7.92 +         * obsahuje ImageIcon, pak tooltip zobrazuje ImageIcon.getDescription()
    7.93 +         */
    7.94 +    @Override
    7.95 +        public String getToolTipText (MouseEvent event)
    7.96 +        {
    7.97 +                if (showTooltips) {
    7.98 +                        Point p = event.getPoint();
    7.99 +                        int col = columnAtPoint(p);
   7.100 +                        int rw = rowAtPoint(p);
   7.101 +                        if (col >= 0 && rw >= 0) {
   7.102 +                                Object o = getValueAt(rw,
   7.103 +                                                      col);
   7.104 +                                if (o != null) {
   7.105 +                                        if (o instanceof ImageIcon) {
   7.106 +                                                return ((ImageIcon) o).getDescription();
   7.107 +                                        } else {
   7.108 +                                                return o.toString();
   7.109 +                                        }
   7.110 +                                }
   7.111 +                        }
   7.112 +                        return super.getToolTipText();
   7.113 +                } else {
   7.114 +                        return super.getToolTipText();
   7.115 +                }
   7.116 +        }
   7.117 +
   7.118 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/java/JFTable/src/cz/frantovo/gui/tabulky/TableSorterModel.java	Sat Feb 28 16:51:54 2009 +0100
     8.3 @@ -0,0 +1,533 @@
     8.4 +package cz.frantovo.gui.tabulky;
     8.5 +
     8.6 +
     8.7 +import java.awt.Component;
     8.8 +import java.awt.event.MouseAdapter;
     8.9 +import java.awt.event.MouseEvent;
    8.10 +import java.awt.event.MouseListener;
    8.11 +import java.util.ArrayList;
    8.12 +import java.util.Arrays;
    8.13 +import java.util.Comparator;
    8.14 +import java.util.HashMap;
    8.15 +import java.util.Iterator;
    8.16 +import java.util.List;
    8.17 +import java.util.Map;
    8.18 +
    8.19 +import javax.swing.Icon;
    8.20 +import javax.swing.ImageIcon;
    8.21 +import javax.swing.JLabel;
    8.22 +import javax.swing.JTable;
    8.23 +import javax.swing.event.TableModelEvent;
    8.24 +import javax.swing.event.TableModelListener;
    8.25 +import javax.swing.table.AbstractTableModel;
    8.26 +import javax.swing.table.JTableHeader;
    8.27 +import javax.swing.table.TableCellRenderer;
    8.28 +import javax.swing.table.TableColumnModel;
    8.29 +import javax.swing.table.TableModel;
    8.30 +
    8.31 +/**
    8.32 + * Tato t��da p�id�v� tabulce funk�nost �azen� podle v�ce sloupc�. Skute�n�
    8.33 + * model obsahuj�c� data sta�� obalit touto t��dou + je pot�eba nastavit:
    8.34 + * tableSorterModel.setTableHeader(table.getTableHeader());<br>
    8.35 + * <br>
    8.36 + * Jednodu��� ale je pou��vat t��du cz.ebanka.util.table.JTable, kter� v�echno
    8.37 + * �e�� za v�s. <br>
    8.38 + * <br>
    8.39 + * Tento TableSorterModel je zalo�en na p�vodn�m TableSorter od autor�: Philip
    8.40 + * Milne, Brendon McLean, Dan van Enckevort a Parwinder Sekhon. <br>
    8.41 + * <br>
    8.42 + * J� jsem p�idal hez�� grafick� �ipky v z�hlav� tabulky
    8.43 + * 
    8.44 + * 
    8.45 + * @author František Kučera
    8.46 + */
    8.47 +
    8.48 +public class TableSorterModel extends AbstractTableModel {
    8.49 +
    8.50 +        private static final long serialVersionUID = 7902301859145867387L;
    8.51 +
    8.52 +        protected TableModel tableModel;
    8.53 +
    8.54 +        public static final int DESCENDING = -1;
    8.55 +
    8.56 +        public static final int NOT_SORTED = 0;
    8.57 +
    8.58 +        public static final int ASCENDING = 1;
    8.59 +
    8.60 +        private static Directive EMPTY_DIRECTIVE = new Directive( -1,
    8.61 +                                                                 NOT_SORTED);
    8.62 +
    8.63 +        public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() {
    8.64 +
    8.65 +                public int compare (Object o1,
    8.66 +                                    Object o2)
    8.67 +                {
    8.68 +                        return ((Comparable) o1).compareTo(o2);
    8.69 +                }
    8.70 +        };
    8.71 +
    8.72 +        public static final Comparator LEXICAL_COMPARATOR = new Comparator() {
    8.73 +
    8.74 +                public int compare (Object o1,
    8.75 +                                    Object o2)
    8.76 +                {
    8.77 +                        return o1.toString().compareTo(o2.toString());
    8.78 +                }
    8.79 +        };
    8.80 +
    8.81 +        private Row[] viewToModel;
    8.82 +
    8.83 +        private int[] modelToView;
    8.84 +
    8.85 +        private JTableHeader tableHeader;
    8.86 +
    8.87 +        private MouseListener mouseListener;
    8.88 +
    8.89 +        private TableModelListener tableModelListener;
    8.90 +
    8.91 +        private Map columnComparators = new HashMap();
    8.92 +
    8.93 +        private List sortingColumns = new ArrayList();
    8.94 +
    8.95 +        private ImageIcon headerIconDown = new ImageIcon(getClass().getResource("/cz/frantovo/gui/tabulky/dolu.png"));
    8.96 +
    8.97 +        private ImageIcon headerIconUp = new ImageIcon(getClass().getResource("/cz/frantovo/gui/tabulky/nahoru.png"));
    8.98 +
    8.99 +        public TableSorterModel ()
   8.100 +        {
   8.101 +                this.mouseListener = new MouseHandler();
   8.102 +                this.tableModelListener = new TableModelHandler();
   8.103 +        }
   8.104 +
   8.105 +        public TableSorterModel (TableModel tableModel)
   8.106 +        {
   8.107 +                this();
   8.108 +                setTableModel(tableModel);
   8.109 +        }
   8.110 +
   8.111 +        public TableSorterModel (TableModel tableModel,
   8.112 +                                 JTableHeader tableHeader)
   8.113 +        {
   8.114 +                this();
   8.115 +                setTableHeader(tableHeader);
   8.116 +                setTableModel(tableModel);
   8.117 +        }
   8.118 +
   8.119 +        private void clearSortingState ()
   8.120 +        {
   8.121 +                viewToModel = null;
   8.122 +                modelToView = null;
   8.123 +        }
   8.124 +
   8.125 +        public TableModel getTableModel ()
   8.126 +        {
   8.127 +                return tableModel;
   8.128 +        }
   8.129 +
   8.130 +        public void setTableModel (TableModel tableModel)
   8.131 +        {
   8.132 +                if (this.tableModel != null) {
   8.133 +                        this.tableModel.removeTableModelListener(tableModelListener);
   8.134 +                }
   8.135 +
   8.136 +                this.tableModel = tableModel;
   8.137 +                if (this.tableModel != null) {
   8.138 +                        this.tableModel.addTableModelListener(tableModelListener);
   8.139 +                }
   8.140 +
   8.141 +                clearSortingState();
   8.142 +                fireTableStructureChanged();
   8.143 +        }
   8.144 +
   8.145 +        public JTableHeader getTableHeader ()
   8.146 +        {
   8.147 +                return tableHeader;
   8.148 +        }
   8.149 +
   8.150 +        public void setTableHeader (JTableHeader tableHeader)
   8.151 +        {
   8.152 +                if (this.tableHeader != null) {
   8.153 +                        this.tableHeader.removeMouseListener(mouseListener);
   8.154 +                        TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();
   8.155 +                        if (defaultRenderer instanceof SortableHeaderRenderer) {
   8.156 +                                this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
   8.157 +                        }
   8.158 +                }
   8.159 +                this.tableHeader = tableHeader;
   8.160 +                if (this.tableHeader != null) {
   8.161 +                        this.tableHeader.addMouseListener(mouseListener);
   8.162 +                        this.tableHeader.setDefaultRenderer(new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer()));
   8.163 +                }
   8.164 +        }
   8.165 +
   8.166 +        public boolean isSorting ()
   8.167 +        {
   8.168 +                return sortingColumns.size() != 0;
   8.169 +        }
   8.170 +
   8.171 +        private Directive getDirective (int column)
   8.172 +        {
   8.173 +                for (int i = 0; i < sortingColumns.size(); i++) {
   8.174 +                        Directive directive = (Directive) sortingColumns.get(i);
   8.175 +                        if (directive.column == column) {
   8.176 +                                return directive;
   8.177 +                        }
   8.178 +                }
   8.179 +                return EMPTY_DIRECTIVE;
   8.180 +        }
   8.181 +
   8.182 +        public int getSortingStatus (int column)
   8.183 +        {
   8.184 +                return getDirective(column).direction;
   8.185 +        }
   8.186 +
   8.187 +        private void sortingStatusChanged ()
   8.188 +        {
   8.189 +                clearSortingState();
   8.190 +                fireTableDataChanged();
   8.191 +                if (tableHeader != null) {
   8.192 +                        tableHeader.repaint();
   8.193 +                }
   8.194 +        }
   8.195 +
   8.196 +        public void setSortingStatus (int column,
   8.197 +                                      int status)
   8.198 +        {
   8.199 +                Directive directive = getDirective(column);
   8.200 +                if (directive != EMPTY_DIRECTIVE) {
   8.201 +                        sortingColumns.remove(directive);
   8.202 +                }
   8.203 +                if (status != NOT_SORTED) {
   8.204 +                        sortingColumns.add(new Directive(column,
   8.205 +                                                         status));
   8.206 +                }
   8.207 +                sortingStatusChanged();
   8.208 +        }
   8.209 +
   8.210 +        protected Icon getHeaderRendererIcon (int column,
   8.211 +                                              int size)
   8.212 +        {
   8.213 +                Directive directive = getDirective(column);
   8.214 +                if (directive == EMPTY_DIRECTIVE) {
   8.215 +                        return null;
   8.216 +                }
   8.217 +
   8.218 +                if (directive.direction == DESCENDING) {
   8.219 +                        return headerIconDown;
   8.220 +                } else {
   8.221 +                        return headerIconUp;
   8.222 +                }
   8.223 +        }
   8.224 +
   8.225 +        private void cancelSorting ()
   8.226 +        {
   8.227 +                sortingColumns.clear();
   8.228 +                sortingStatusChanged();
   8.229 +        }
   8.230 +
   8.231 +        public void setColumnComparator (Class type,
   8.232 +                                         Comparator comparator)
   8.233 +        {
   8.234 +                if (comparator == null) {
   8.235 +                        columnComparators.remove(type);
   8.236 +                } else {
   8.237 +                        columnComparators.put(type,
   8.238 +                                              comparator);
   8.239 +                }
   8.240 +        }
   8.241 +
   8.242 +        protected Comparator getComparator (int column)
   8.243 +        {
   8.244 +                Class columnType = tableModel.getColumnClass(column);
   8.245 +                Comparator comparator = (Comparator) columnComparators.get(columnType);
   8.246 +                if (comparator != null) {
   8.247 +                        return comparator;
   8.248 +                }
   8.249 +                if (Comparable.class.isAssignableFrom(columnType)) {
   8.250 +                        return COMPARABLE_COMAPRATOR;
   8.251 +                }
   8.252 +                return LEXICAL_COMPARATOR;
   8.253 +        }
   8.254 +
   8.255 +        private Row[] getViewToModel ()
   8.256 +        {
   8.257 +                if (viewToModel == null) {
   8.258 +                        int tableModelRowCount = tableModel.getRowCount();
   8.259 +                        viewToModel = new Row[tableModelRowCount];
   8.260 +                        for (int row = 0; row < tableModelRowCount; row++) {
   8.261 +                                viewToModel[row] = new Row(row);
   8.262 +                        }
   8.263 +
   8.264 +                        if (isSorting()) {
   8.265 +                                Arrays.sort(viewToModel);
   8.266 +                        }
   8.267 +                }
   8.268 +                return viewToModel;
   8.269 +        }
   8.270 +
   8.271 +        public int modelIndex (int viewIndex)
   8.272 +        {
   8.273 +                if (viewIndex > -1 && viewIndex < getViewToModel().length) {
   8.274 +                        return getViewToModel()[viewIndex].modelIndex;
   8.275 +                } else {
   8.276 +                        return -1;
   8.277 +                }
   8.278 +        }
   8.279 +
   8.280 +        private int[] getModelToView ()
   8.281 +        {
   8.282 +                if (modelToView == null) {
   8.283 +                        int n = getViewToModel().length;
   8.284 +                        modelToView = new int[n];
   8.285 +                        for (int i = 0; i < n; i++) {
   8.286 +                                modelToView[modelIndex(i)] = i;
   8.287 +                        }
   8.288 +                }
   8.289 +                return modelToView;
   8.290 +        }
   8.291 +
   8.292 +        // Metody rozhran� TableModel
   8.293 +
   8.294 +        public int getRowCount ()
   8.295 +        {
   8.296 +                return (tableModel == null) ? 0 : tableModel.getRowCount();
   8.297 +        }
   8.298 +
   8.299 +        public int getColumnCount ()
   8.300 +        {
   8.301 +                return (tableModel == null) ? 0 : tableModel.getColumnCount();
   8.302 +        }
   8.303 +
   8.304 +        public String getColumnName (int column)
   8.305 +        {
   8.306 +                return tableModel.getColumnName(column);
   8.307 +        }
   8.308 +
   8.309 +        public Class getColumnClass (int column)
   8.310 +        {
   8.311 +                return tableModel.getColumnClass(column);
   8.312 +        }
   8.313 +
   8.314 +        public boolean isCellEditable (int row,
   8.315 +                                       int column)
   8.316 +        {
   8.317 +                return tableModel.isCellEditable(modelIndex(row),
   8.318 +                                                 column);
   8.319 +        }
   8.320 +
   8.321 +        public Object getValueAt (int row,
   8.322 +                                  int column)
   8.323 +        {
   8.324 +                return tableModel.getValueAt(modelIndex(row),
   8.325 +                                             column);
   8.326 +        }
   8.327 +
   8.328 +        public void setValueAt (Object aValue,
   8.329 +                                int row,
   8.330 +                                int column)
   8.331 +        {
   8.332 +                tableModel.setValueAt(aValue,
   8.333 +                                      modelIndex(row),
   8.334 +                                      column);
   8.335 +        }
   8.336 +
   8.337 +        // Pomocn� t��dy
   8.338 +
   8.339 +        private class Row implements Comparable {
   8.340 +
   8.341 +                private int modelIndex;
   8.342 +
   8.343 +                public Row (int index)
   8.344 +                {
   8.345 +                        this.modelIndex = index;
   8.346 +                }
   8.347 +
   8.348 +                public int compareTo (Object o)
   8.349 +                {
   8.350 +                        int row1 = modelIndex;
   8.351 +                        int row2 = ((Row) o).modelIndex;
   8.352 +
   8.353 +                        for (Iterator it = sortingColumns.iterator(); it.hasNext();) {
   8.354 +                                Directive directive = (Directive) it.next();
   8.355 +                                int column = directive.column;
   8.356 +                                Object o1 = tableModel.getValueAt(row1,
   8.357 +                                                                  column);
   8.358 +                                Object o2 = tableModel.getValueAt(row2,
   8.359 +                                                                  column);
   8.360 +
   8.361 +                                int comparison = 0;
   8.362 +                                // Define null less than everything, except
   8.363 +                                // null.
   8.364 +                                if (o1 == null && o2 == null) {
   8.365 +                                        comparison = 0;
   8.366 +                                } else if (o1 == null) {
   8.367 +                                        comparison = -1;
   8.368 +                                } else if (o2 == null) {
   8.369 +                                        comparison = 1;
   8.370 +                                } else {
   8.371 +                                        comparison = getComparator(column).compare(o1,
   8.372 +                                                                                   o2);
   8.373 +                                }
   8.374 +                                if (comparison != 0) {
   8.375 +                                        return directive.direction == DESCENDING ? -comparison : comparison;
   8.376 +                                }
   8.377 +                        }
   8.378 +                        return 0;
   8.379 +                }
   8.380 +        }
   8.381 +
   8.382 +        private class TableModelHandler implements TableModelListener {
   8.383 +
   8.384 +                public void tableChanged (TableModelEvent e)
   8.385 +                {
   8.386 +                        // If we're not sorting by anything, just pass the event
   8.387 +                        // along.
   8.388 +                        if ( !isSorting()) {
   8.389 +                                clearSortingState();
   8.390 +                                fireTableChanged(e);
   8.391 +                                return;
   8.392 +                        }
   8.393 +
   8.394 +                        // If the table structure has changed, cancel the
   8.395 +                        // sorting; the
   8.396 +                        // sorting columns may have been either moved or deleted
   8.397 +                        // from
   8.398 +                        // the model.
   8.399 +                        if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
   8.400 +                                cancelSorting();
   8.401 +                                fireTableChanged(e);
   8.402 +                                return;
   8.403 +                        }
   8.404 +
   8.405 +                        // We can map a cell event through to the view without
   8.406 +                        // widening
   8.407 +                        // when the following conditions apply:
   8.408 +                        // 
   8.409 +                        // a) all the changes are on one row (e.getFirstRow() ==
   8.410 +                        // e.getLastRow()) and,
   8.411 +                        // b) all the changes are in one column (column !=
   8.412 +                        // TableModelEvent.ALL_COLUMNS) and,
   8.413 +                        // c) we are not sorting on that column
   8.414 +                        // (getSortingStatus(column) == NOT_SORTED) and,
   8.415 +                        // d) a reverse lookup will not trigger a sort
   8.416 +                        // (modelToView != null)
   8.417 +                        //
   8.418 +                        // Note: INSERT and DELETE events fail this test as they
   8.419 +                        // have column == ALL_COLUMNS.
   8.420 +                        // 
   8.421 +                        // The last check, for (modelToView != null) is to see
   8.422 +                        // if modelToView
   8.423 +                        // is already allocated. If we don't do this check;
   8.424 +                        // sorting can become
   8.425 +                        // a performance bottleneck for applications where cells
   8.426 +                        // change rapidly in different parts of the table. If
   8.427 +                        // cells
   8.428 +                        // change alternately in the sorting column and then
   8.429 +                        // outside of
   8.430 +                        // it this class can end up re-sorting on alternate cell
   8.431 +                        // updates -
   8.432 +                        // which can be a performance problem for large tables.
   8.433 +                        // The last
   8.434 +                        // clause avoids this problem.
   8.435 +                        int column = e.getColumn();
   8.436 +                        if (e.getFirstRow() == e.getLastRow() && column != TableModelEvent.ALL_COLUMNS && getSortingStatus(column) == NOT_SORTED
   8.437 +                                && modelToView != null) {
   8.438 +                                int viewIndex = getModelToView()[e.getFirstRow()];
   8.439 +                                fireTableChanged(new TableModelEvent(TableSorterModel.this,
   8.440 +                                                                     viewIndex,
   8.441 +                                                                     viewIndex,
   8.442 +                                                                     column,
   8.443 +                                                                     e.getType()));
   8.444 +                                return;
   8.445 +                        }
   8.446 +
   8.447 +                        // Something has happened to the data that may have
   8.448 +                        // invalidated the row order.
   8.449 +                        clearSortingState();
   8.450 +                        fireTableDataChanged();
   8.451 +                        return;
   8.452 +                }
   8.453 +        }
   8.454 +
   8.455 +        private class MouseHandler extends MouseAdapter {
   8.456 +
   8.457 +                public void mouseClicked (MouseEvent e)
   8.458 +                {
   8.459 +                        JTableHeader h = (JTableHeader) e.getSource();
   8.460 +                        TableColumnModel columnModel = h.getColumnModel();
   8.461 +                        int viewColumn = columnModel.getColumnIndexAtX(e.getX());
   8.462 +                        int column = columnModel.getColumn(viewColumn).getModelIndex();
   8.463 +                        if (column != -1) {
   8.464 +                                int status = getSortingStatus(column);
   8.465 +                                if ( !e.isControlDown()) {
   8.466 +                                        cancelSorting();
   8.467 +                                }
   8.468 +                                // Cycle the sorting states through {NOT_SORTED,
   8.469 +                                // ASCENDING, DESCENDING} or
   8.470 +                                // {NOT_SORTED, DESCENDING, ASCENDING} depending
   8.471 +                                // on whether shift is pressed.
   8.472 +                                status = status + (e.isShiftDown() ? -1 : 1);
   8.473 +                                status = (status + 4) % 3 - 1; // signed mod,
   8.474 +                                // returning
   8.475 +                                // {-1, 0, 1}
   8.476 +                                setSortingStatus(column,
   8.477 +                                                 status);
   8.478 +                        }
   8.479 +                }
   8.480 +        }
   8.481 +
   8.482 +        private class SortableHeaderRenderer implements TableCellRenderer {
   8.483 +
   8.484 +                private TableCellRenderer tableCellRenderer;
   8.485 +
   8.486 +                public SortableHeaderRenderer (TableCellRenderer tableCellRenderer)
   8.487 +                {
   8.488 +                        this.tableCellRenderer = tableCellRenderer;
   8.489 +                }
   8.490 +
   8.491 +                public Component getTableCellRendererComponent (JTable table,
   8.492 +                                                                Object value,
   8.493 +                                                                boolean isSelected,
   8.494 +                                                                boolean hasFocus,
   8.495 +                                                                int row,
   8.496 +                                                                int column)
   8.497 +                {
   8.498 +                        Component c = tableCellRenderer.getTableCellRendererComponent(table,
   8.499 +                                                                                      value,
   8.500 +                                                                                      isSelected,
   8.501 +                                                                                      hasFocus,
   8.502 +                                                                                      row,
   8.503 +                                                                                      column);
   8.504 +                        if (c instanceof JLabel) {
   8.505 +                                JLabel l = (JLabel) c;
   8.506 +                                l.setHorizontalTextPosition(JLabel.LEFT);
   8.507 +                                int modelColumn = table.convertColumnIndexToModel(column);
   8.508 +                                l.setIcon(getHeaderRendererIcon(modelColumn,
   8.509 +                                                                l.getFont().getSize()));
   8.510 +                        }
   8.511 +                        return c;
   8.512 +                }
   8.513 +        }
   8.514 +
   8.515 +        private static class Directive {
   8.516 +
   8.517 +                private int column;
   8.518 +
   8.519 +                private int direction;
   8.520 +
   8.521 +                public Directive (int column,
   8.522 +                                  int direction)
   8.523 +                {
   8.524 +                        this.column = column;
   8.525 +                        this.direction = direction;
   8.526 +                }
   8.527 +        }
   8.528 +
   8.529 +        public void fireTableColumnUpdated (int index)
   8.530 +        {
   8.531 +                for (int i = 0; i < getRowCount(); i++) {
   8.532 +                        fireTableCellUpdated(i,
   8.533 +                                             index);
   8.534 +                }
   8.535 +        }
   8.536 +}
     9.1 Binary file java/JFTable/src/cz/frantovo/gui/tabulky/dolu.png has changed
    10.1 Binary file java/JFTable/src/cz/frantovo/gui/tabulky/nahoru.png has changed