Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package de.ipk_gatersleben.bit.bi.edal.publication;
  
  import java.awt.Component;
  import java.awt.Container;
  import java.awt.Insets;
  import java.io.File;
  import java.nio.file.Path;

Utility class for some static functions for handling and converting java.lang.Strings and so on.

Author(s):
arendd
 
 public class Utils {
 
 	public static boolean checkIfStringIsEmpty(String string) {
 
 		String temp = string.replaceAll(" """);
 		temp = temp.replaceAll("\t""");
 		temp = temp.replaceAll("\n""");
 
 		return temp.isEmpty();
 	}
 
 	public static String cleanUpString(String string) {
 		String temp = string.replaceAll(" """);
 		temp = temp.replaceAll("\t""");
 		temp = temp.replaceAll("\n""");
 		return temp;
 	}
 
 	public static int numberOfFiles(Path srcDir) {
 
 		File directory = srcDir.toFile();
 
 		int count = 0;
 
 		if (directory.isDirectory()) {
 			File[] listFiles = directory.listFiles();
 			for (int i = 0; i < listFiles.lengthi++) {
 				if (listFiles[i].isDirectory()) {
 					count += numberOfFiles(listFiles[i].toPath());
 				} else if (listFiles[i].isFile()) {
 					count++;
 				}
 			}
 			if(count>0){
 			return count;
 			}
 		}
 		return 1;
 	}
 
 	public static void addComponent(Container contGridBagLayout gbl,
 			Component cint xint yint widthint heightdouble weightx,
 			double weightyint ipadxint ipadyInsets insets) {
 		gbc.ipadx = ipadx;
 		gbc.ipady = ipady;
 		gbc.gridx = x;
 		gbc.gridy = y;
 		gbc.gridwidth = width;
 		gbc.gridheight = height;
 		gbc.weightx = weightx;
 		gbc.weighty = weighty;
 		gbc.insets = insets;
 		gbl.setConstraints(cgbc);
 		cont.add(c);
 	}
 
 	public static void add(Container containerGridBagLayout gridBagLayout,
 			Component cint gridxint gridy) {
 		gbc.gridx = gridx;
 		gbc.gridy = gridy;
 		gbc.insets = new Insets(2, 5, 2, 5);
 		gridBagLayout.setConstraints(cgbc);
 		container.add(c);
 	}

Add GridBagLayout Component for AttributeTablePanels

Parameters:
cont
gbl
c
x
y
width
height
weightx
weighty
ipadx
ipady
	public static void addComponent(Container contGridBagLayout gbl,
			Component cint xint yint widthint heightdouble weightx,
			double weightyint ipadxint ipady) {
		gbc.ipadx = ipadx;
		gbc.ipady = ipady;
		gbc.gridx = x;
		gbc.gridy = y;
		gbc.gridwidth = width;
		gbc.gridheight = height;
		gbc.weightx = weightx;
		gbc.weighty = weighty;
		gbc.insets = new Insets(0, 0, 0, 10);
		gbl.setConstraints(cgbc);
		cont.add(c);
	}
New to GrepCode? Check out our FAQ X