[Schmitzm-commits] r1724 - in trunk/schmitzm-core/src/main/java/de/schmitzm: io lang swing/input

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Sep 10 20:44:17 CEST 2011


Author: mojays
Date: 2011-09-10 20:44:14 +0200 (Sat, 10 Sep 2011)
New Revision: 1724

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/input/BooleanInputOption.java
Log:
IOUtil: new method to count the lines of an ascii file
BooleanInputOption: BugFix for hiding the label


Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java	2011-09-09 10:43:07 UTC (rev 1723)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java	2011-09-10 18:44:14 UTC (rev 1724)
@@ -1156,6 +1156,19 @@
 	}
 
 	/**
+	 * Returns the number of lines of the given (ASCII) file. 
+	 * @throws IOException 
+	 */
+	public static int getLineCount(File file) throws IOException {
+	  BufferedReader r = new BufferedReader( new InputStreamReader(new FileInputStream(file)) );
+      int count = 0;
+      while ( r.readLine() != null )
+        count++;
+      r.close();
+      return count;
+	}
+	
+	/**
 	 * Copy file/folder to file/folder but doesn't throw an Exception
 	 * 
 	 * @param source

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2011-09-09 10:43:07 UTC (rev 1723)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2011-09-10 18:44:14 UTC (rev 1724)
@@ -116,6 +116,9 @@
 	public static String getSimpleClassName(Object object) {
 		if (object == null)
 			return "null";
+		if (object instanceof Class)
+		  return ((Class)object).getSimpleName();
+		
 		return object.getClass().getSimpleName();
 	}
 

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/input/BooleanInputOption.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/input/BooleanInputOption.java	2011-09-09 10:43:07 UTC (rev 1723)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/input/BooleanInputOption.java	2011-09-10 18:44:14 UTC (rev 1724)
@@ -57,7 +57,7 @@
 		// des Eingabefeldes zu stehen, sondern mit der Checkbox in
 		// einer Zeile
 		// -> JLabel entfernen und statt dessen den Text der Checkbox setzen
-		this.remove(this.descLabel);
+		this.remove(this.descLabelContainer);
 		((JCheckBox) inpComp).setText(label);
 		// Standardwert setzen
 		if (defValue != null)



More information about the Schmitzm-commits mailing list