Package de.netsysit.view

Source Code of de.netsysit.view.ListView

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package de.netsysit.view;

import de.netsysit.controller.ActionFactory;
import de.netsysit.controller.ActionFactory.ActionKey;
import de.netsysit.controller.ListController;
import de.netsysit.model.DefaultMutableListModel;
import de.netsysit.policymanager.PolicyUtilities;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.util.ResourceBundle;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;

/**
*
* @author Ducksoul
*/
public class ListView extends JPanel {
    private static ResourceBundle rb = PolicyUtilities.getResourceBundle();
   
    private JList listReceiverListsLst = new JList();
    private JScrollPane listListsScroll = new JScrollPane(listReceiverListsLst);
    private JPanel listDetailsPnl = new JPanel();
   
    private JLabel listNameLbl = new JLabel(rb.getString("name"));
    private JLabel listReceiversLbl = new JLabel(rb.getString("receiver"));
   
    private JTextField listNameTxt = new JTextField();
    private JListMutable listReceiversLst = new JListMutable(new DefaultMutableListModel());
    private JScrollPane listReceiversScroll = new JScrollPane(listReceiversLst);
   
    private JButton listEditBtn = new JButton(ActionFactory.get(ActionKey.LIST_RECEIVEREDIT));
    private JButton listNewBtn = new JButton(ActionFactory.get(ActionKey.LIST_ADDRECEIVER));
    private JButton listDeleteBtn = new JButton(ActionFactory.get(ActionKey.LIST_RECEIVERDELETE));
   
    public ListView() {
        ListController lc = new ListController(this);
        init();   
    }
   
    public JTextField getListNameTxt() {
        return listNameTxt;
    }

    public JList getListReceiverListsLst() {
        return listReceiverListsLst;
    }

    public JListMutable getListReceiversLst() {
        return listReceiversLst;
    }

    public JLabel getListNameLbl() {
        return listNameLbl;
    }

    public JLabel getListReceiversLbl() {
        return listReceiversLbl;
    }
       
    private void init() {
       
            //eigentliche GUI erzeugen
        GridBagLayout gbl = new GridBagLayout();
        //GridBagConstraints gbc = new GridBagConstraints();
        listDetailsPnl.setLayout(gbl);
       
       
        listListsScroll.setMinimumSize(new Dimension(175, 1));
        listListsScroll.setPreferredSize(new Dimension(175, 1));
        listNameTxt.setMinimumSize(new Dimension(175, 21));
        listNameTxt.setPreferredSize(new Dimension(175, 21));
        listReceiversScroll.setMinimumSize(new Dimension(175, 1));
        listReceiversScroll.setPreferredSize(new Dimension(175, 1));
        listNewBtn.setMinimumSize(new Dimension(125, 23));
        listNewBtn.setPreferredSize(new Dimension(125, 23));
        listEditBtn.setMinimumSize(new Dimension(125, 23));
        listEditBtn.setPreferredSize(new Dimension(125, 23));
        listDeleteBtn.setMinimumSize(new Dimension(125, 23));
        listDeleteBtn.setPreferredSize(new Dimension(125, 23));
       
        listNameTxt.setEnabled(false);    
       
        PolicyUtilities.createLine(listDetailsPnl, gbl, listNameLbl, listNameTxt, 0, 15, 2);
        PolicyUtilities.createLine(listDetailsPnl, gbl, listReceiversLbl, listReceiversScroll, 1);
        PolicyUtilities.addSwingCompWest(listDetailsPnl, gbl, listEditBtn, 1, 2, false);
        PolicyUtilities.addSwingCompWest(listDetailsPnl, gbl, listNewBtn, 2, 2, false);
        PolicyUtilities.addSwingCompWest(listDetailsPnl, gbl, listDeleteBtn, 3, 2, true);
       
        ActionFactory.get(ActionKey.LIST_ADDRECEIVER).setEnabled(false);
        ActionFactory.get(ActionKey.LIST_RECEIVEREDIT).setEnabled(false);
        ActionFactory.get(ActionKey.LIST_RECEIVERDELETE).setEnabled(false);
       
        setLayout(new BorderLayout());
        add(listListsScroll, BorderLayout.WEST);
        add(listDetailsPnl, BorderLayout.CENTER);   
    }
   
}
TOP

Related Classes of de.netsysit.view.ListView

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.