//package lu.tudor.santec.gecamed.reporting.gui.designer;
//
//import java.awt.BorderLayout;
//import java.awt.Component;
//
//import javax.swing.JButton;
//import javax.swing.JLabel;
//import javax.swing.JList;
//import javax.swing.JScrollPane;
//import javax.swing.ListCellRenderer;
//import javax.swing.ListSelectionModel;
//
//import lu.tudor.santec.gecamed.core.gui.GECAMedColors;
//import lu.tudor.santec.gecamed.core.gui.MainFrame;
//import lu.tudor.santec.gecamed.core.gui.widgets.GECAMedBaseDialogImpl;
//import lu.tudor.santec.gecamed.core.utils.ManagerFactory;
//import lu.tudor.santec.gecamed.reporting.ejb.entity.beans.ParameterQuery;
//import lu.tudor.santec.gecamed.reporting.ejb.session.beans.ReportManagerBean;
//import lu.tudor.santec.gecamed.reporting.ejb.session.interfaces.ReportManagerInterface;
//import lu.tudor.santec.i18n.Translatrix;
//
//public class ParameterQueryManagerDialog extends GECAMedBaseDialogImpl implements ListCellRenderer
//{
//	/* ======================================== */
//	// 		CONSTANTS
//	/* ======================================== */
//	
//	private static final long	serialVersionUID	= 1L;
//	
//	
//	
//	/* ======================================== */
//	// 		MEMBERS
//	/* ======================================== */
//	
//	private ReportManagerInterface	manager;
//	
//	
//	private JList	queryList;
//	
//	private JButton	addQueryButton;
//	
//	private JButton	removeQueryButton;
//	
//	private JButton editQueryButton;
//	
//	
//	
//	/* ======================================== */
//	// 		CONSTRUCTORS
//	/* ======================================== */
//	
//	public ParameterQueryManagerDialog ()
//	{
//		super(MainFrame.getInstance(), 
//				Translatrix.getTranslationString("ReportModule.manageQueries"), 
//				OK_BUTTON_MODE);
//		
//		JLabel		label;
//		JScrollPane	scroller;
//		
//		mainPanel.setLayout(new BorderLayout());
//		
//		label				= new JLabel(Translatrix.getTranslationString(
//				"ReportModule.ParameterQueryManagerDialog.description"));
//		label.setOpaque(false);
//		mainPanel.add(label, BorderLayout.NORTH);
//		
//		queryList			= new JList();
//		queryList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
//		queryList.setOpaque(false);
//		queryList.setCellRenderer(this);
//		scroller			= new JScrollPane(queryList);
//		scroller.setOpaque(false);
//		scroller.getViewport().setOpaque(false);
//		mainPanel.add(scroller, BorderLayout.CENTER);
//		
//		
//		// TODO ...
//		addQueryButton		= new JButton();
//		super.addButton(addQueryButton);
//		
//		removeQueryButton	= new JButton();
//		super.addButton(removeQueryButton);
//		
//		editQueryButton		= new JButton();
//		super.addButton(editQueryButton);
//	}
//	
//	
//	
//	/* ======================================== */
//	// 		CLASS BODY
//	/* ======================================== */
//	
//	public void open ()
//	{
//		// TODO: reload the list
//		
//		this.pack();
//		this.setLocationRelativeTo(getOwner());
//		this.setVisible(true);
//	}
//	
//	
//	public Component getListCellRendererComponent(JList list, Object value, 
//			int index, boolean isSelected, boolean cellHasFocus)
//	{
//		ParameterQuery	query; 
//		JLabel			l	= new JLabel();
//		
//		
//		if (value instanceof ParameterQuery)
//		{
//			query	= (ParameterQuery) value;
//			l.setText(query.getName());
//			l.setToolTipText(query.getComment());
//			l.setText(query.getComment().matches("(\\w|\\W)*\\<(?i)html(?-i)[^\\>]*\\>(\\w|\\W)*")
//					? query.getComment().replaceFirst("(\\w|\\W)*\\<(?i)html(?-i)[^\\>]*\\>", "<html>")
//					: "<html>" + query.getComment().replaceAll("\n", "<br>"));
//		}
//		else
//			l.setText(String.valueOf(value));
//		
//		if (isSelected)
//			l.setBackground(list.getSelectionBackground());
//		else if (index % 2 == 0)
//			l.setBackground(GECAMedColors.c_EvenLineBackground);
//		else
//			l.setBackground(GECAMedColors.c_OddLineBackground);
//		
//		return l;
//	}
//	
//	
//	
//	/* ======================================== */
//	// 		HELP METHODS
//	/* ======================================== */
//	
//	private ReportManagerInterface getManager ()
//	{
//		if (manager == null)
//			manager = (ReportManagerInterface) ManagerFactory.getRemote(ReportManagerBean.class);
//		
//		return manager;
//	}
//}
