<commit_before>package gov.nih.nci.cagrid.common.portal;

import java.awt.Dimension;
import java.awt.Window;

import gov.nih.nci.cagrid.common.Utils;

import javax.swing.JComponent;
import javax.swing.JOptionPane;

import org.projectmobius.portal.PortalResourceManager;

/**
 * @author <A href="mailto:<EMAIL>"><NAME> </A>
 * @author <A href="mailto:<EMAIL>"><NAME> </A>
 * @author <A href="mailto:<EMAIL>"><NAME> </A>
 * @version $Id: ArgumentManagerTable.java,v 1.2 2004/10/15 16:35:16 langella
 *          Exp $
 */

public class PortalUtils {

	public static void showErrorMessage(String msg) {
		showErrorMessage("Portal Error", msg);
	}

	public static void showErrorMessage(Exception e) {
		showErrorMessage("Portal Error", e);
	}

	public static void showConfigurationErrorMessage(String msg) {
		showErrorMessage("Portal Configuration Error", msg);
	}

	public static void showMessage(String msg) {
		showMessage("Information", msg);
	}

	public static void showMessage(String title, String msg) {
		JOptionPane.showMessageDialog(PortalResourceManager.getInstance()
				.getGridPortal(), msg, title, JOptionPane.INFORMATION_MESSAGE);
	}

	public static void showErrorMessage(String title, Exception e) {
		String mess = Utils.getExceptionMessage(e);
		JOptionPane.showMessageDialog(PortalResourceManager.getInstance()
				.getGridPortal(), mess, title, JOptionPane.ERROR_MESSAGE);
	}

	public static void showErrorMessage(String title, String msg) {
		JOptionPane.showMessageDialog(PortalResourceManager.getInstance()
				.getGridPortal(), msg, title, JOptionPane.ERROR_MESSAGE);
	}

	public final static void centerComponent(JComponent comp) {
		// Determine the new location of the window
		int w = PortalResourceManager.getInstance().getGridPortal().getSize().width;
		int h = PortalResourceManager.getInstance().getGridPortal().getSize().height;
		int x = PortalResourceManager.getInstance().getGridPortal().getLocationOnScreen().x;
		int y = PortalResourceManager.getInstance().getGridPortal().getLocationOnScreen().y;
		Dimension dim = comp.getSize();
		comp.setLocation(w / 2 + x - dim.width / 2, h / 2 + y - dim.height / 2);
	}

	public final static void centerWindow(Window comp) {
		// Determine the new location of the window
		int w = PortalResourceManager.getInstance().getGridPortal().getSize().width;
		int h = PortalResourceManager.getInstance().getGridPortal().getSize().height;
		int x = PortalResourceManager.getInstance().getGridPortal().getLocationOnScreen().x;
		int y = PortalResourceManager.getInstance().getGridPortal().getLocationOnScreen().y;
		Dimension dim = comp.getSize();
		comp.setLocation(w / 2 + x - dim.width / 2, h / 2 + y - dim.height / 2);
	}
}<commit_msg>*** empty log message ***<commit_after>package gov.nih.nci.cagrid.common.portal;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Window;

import gov.nih.nci.cagrid.common.Utils;

import javax.swing.JComponent;
import javax.swing.JOptionPane;

import org.projectmobius.portal.PortalResourceManager;

/**
 * @author <A href="mailto:<EMAIL>"><NAME> </A>
 * @author <A href="mailto:<EMAIL>"><NAME> </A>
 * @author <A href="mailto:<EMAIL>"><NAME> </A>
 * @version $Id: ArgumentManagerTable.java,v 1.2 2004/10/15 16:35:16 langella
 *          Exp $
 */

public class PortalUtils {

	public static void showErrorMessage(String msg) {
		showErrorMessage("Portal Error", msg);
	}

	public static void showErrorMessage(Exception e) {
		showErrorMessage("Portal Error", e);
	}

	public static void showConfigurationErrorMessage(String msg) {
		showErrorMessage("Portal Configuration Error", msg);
	}

	public static void showMessage(String msg) {
		showMessage("Information", msg);
	}

	public static void showMessage(String title, String msg) {
		JOptionPane.showMessageDialog(PortalResourceManager.getInstance()
				.getGridPortal(), msg, title, JOptionPane.INFORMATION_MESSAGE);
	}

	public static void showErrorMessage(String title, Exception e) {
		String mess = Utils.getExceptionMessage(e);
		JOptionPane.showMessageDialog(PortalResourceManager.getInstance()
				.getGridPortal(), mess, title, JOptionPane.ERROR_MESSAGE);
	}

	public static void showErrorMessage(String title, String msg) {
		JOptionPane.showMessageDialog(PortalResourceManager.getInstance()
				.getGridPortal(), msg, title, JOptionPane.ERROR_MESSAGE);
	}

	public final static void centerComponent(JComponent comp) {
		// Determine the new location of the window
		int w = PortalResourceManager.getInstance().getGridPortal().getSize().width;
		int h = PortalResourceManager.getInstance().getGridPortal().getSize().height;
		int x = PortalResourceManager.getInstance().getGridPortal().getLocationOnScreen().x;
		int y = PortalResourceManager.getInstance().getGridPortal().getLocationOnScreen().y;
		Dimension dim = comp.getSize();
		comp.setLocation(w / 2 + x - dim.width / 2, h / 2 + y - dim.height / 2);
	}

	public final static void centerWindow(Window comp) {
		// Determine the new location of the window
		int w = PortalResourceManager.getInstance().getGridPortal().getSize().width;
		int h = PortalResourceManager.getInstance().getGridPortal().getSize().height;
		int x = PortalResourceManager.getInstance().getGridPortal().getLocationOnScreen().x;
		int y = PortalResourceManager.getInstance().getGridPortal().getLocationOnScreen().y;
		Dimension dim = comp.getSize();
		comp.setLocation(w / 2 + x - dim.width / 2, h / 2 + y - dim.height / 2);
	}
	
	
	public static void setContainerEnabled(Container con, boolean enable) {
		for (int i = 0; i < con.getComponentCount(); i++) {
			Component comp = con.getComponent(i);
			comp.setEnabled(enable);
			if (comp instanceof Container) {
				setContainerEnabled((Container) comp, enable);
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.12835614065477222, 'fraction_numerical': 0.0084877879785207, 'mean_word_length': 5.002079002079002, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5221790', 'n_tokens_mistral': 1872, 'n_tokens_neox': 1739, 'n_words': 401}