/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package swing.panel;
import java.awt.AWTKeyStroke;
import java.awt.KeyboardFocusManager;
import java.awt.LayoutManager;
import java.util.HashSet;
import java.util.Set;
import java.util.Vector;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.event.DocumentListener;
import system.util.Login;
import system.util.ResourceUtil;
/**
*
* @author Dante
*/
public abstract class Panel extends JPanel {
// <editor-fold defaultstate="collapsed" desc="Konstruktor">
public Panel(Login login, LayoutManager layout) {
super(layout);
initialize(login);
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="inicializalas">
private void initialize(Login login) {
setLogin(login);
Set<AWTKeyStroke> set = new HashSet<AWTKeyStroke>(this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
set.add(KeyStroke.getKeyStroke("ENTER"));
this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set);
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Login">
private Login login;
/** Login be�ll�t�sa */
public void setLogin(Login login) {
this.login = login;
}
/** Login lek�rdez�se */
public Login getLogin() {
return login;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="fokusz order">
/** F�kusz sorrend be�ll�t�sa */
protected abstract Vector getFocusOrder();
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="kitolt">
/** Kepernyo kitoltese */
protected abstract void fill();
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="reszet">
/** Kepernyo torlese */
protected abstract void reset();
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="title">
private JLabel title;
public JLabel getTitle() {
if (title == null) {
title = new JLabel("");
}
return title;
}
public void setTitle(String title) {
if ((title != null) && (!title.equals(""))) {
getTitle().setText(title+" : ");
} else {
getTitle().setText(null);
}
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="enabled">
public abstract void setEnabled(boolean mire);
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="tkod">
// TODO: tkoddal kapcsolatos r�szek �tm�sol�sa
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="listener">
public abstract void addDocumentListener(DocumentListener l);
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Eroforras lekerdezes">
private ResourceUtil resourceUtil;
private ResourceUtil getResourceUtil() {
if (resourceUtil == null) {
resourceUtil = new ResourceUtil();
}
return resourceUtil;
}
public String getFormResource(String key) {
return getResourceUtil().getFormResource(key);
}
public String getMainResource(String key) {
return getResourceUtil().getMainResource(key);
}
/** Vissza adja az er�forr�s �rt�ket legyen b�rmelyikben is */
public String getResource(String key) {
String eroforras;
eroforras = getMainResource(key);
if (eroforras == null) {
return getFormResource(key);
}
return eroforras;
}
// </editor-fold>
}