Package guicomponents

Source Code of guicomponents.ComputeReportAndReportOptionsPanel

package guicomponents;


import java.awt.Component;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;


import javax.swing.JPanel;


import guicomponents.CompRepRadioButtonsPanel;
import guicomponents.TableOptionsPanel;

public class ComputeReportAndReportOptionsPanel extends JPanel {

 
    /**
   *
   */
  private static final long serialVersionUID = 1L;

  private CompRepRadioButtonsPanel compRepPanel;
  private TableOptionsPanel tabOptPanel;
   
    private GridBagLayout gbl;


   
  public ComputeReportAndReportOptionsPanel(String baseLabel) {
   
      
    compRepPanel = new CompRepRadioButtonsPanel();
    tabOptPanel = new TableOptionsPanel(baseLabel,false);
       
        gbl = new GridBagLayout();
        this.setLayout(gbl);
       
                          // Z  Z  Z  Z  F
                          // e  e  e  e  ü
                          // l  l  l  l  l
                          // l  l  l  l  l
                          // s  z  w  h  v
                          // p  e  e  o  e
                          // a  i  i  e  r
                          // l  l  t  h  h
                          // t  e  e  e  a
                          // e           l
                          // t
                          // e
                          // n
                                                                                                                                          
                          // g  g  g  g  f                  i  i  a                w  w 
                          // r  r  r  r  i                  p  p  n                e  e
                          // i  i  i  i  l                  a  a  c                i  i
                          // d  d  d  d  l                  d  d  h                g  g
                          // x  y  w  h                       x  y  o                h  h
                          //       i  e                                 r                t  t
                          //       d  i                                            x  y
                          //       t  g
                          //       h  h
                          //          t                     
        addComponent(this, gbl, compRepPanel,   0, 0, 4, 1, GridBagConstraints.NONE,     0, 0, GridBagConstraints.LINE_START,0, 0)
        addComponent(this, gbl, tabOptPanel,    0, 1, 4, 5, GridBagConstraints.NONE,     0, 0, GridBagConstraints.LINE_START,0, 0)

   
        compRepPanel.jrb_compute.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                           
              tabOptPanel.chkCaption.setSelected(false);
                tabOptPanel.chkCaption.setEnabled(false);
                tabOptPanel.txfCaption.setEnabled(false);
               
              tabOptPanel.chkDigits.setSelected(false);
                tabOptPanel.chkDigits.setEnabled(false);
                tabOptPanel.sprDigits.setEnabled(false);
            }
        });

       
        compRepPanel.jrb_report.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
             
              if ( tabOptPanel.chkTable.isSelected() ){
                    tabOptPanel.chkCaption.setEnabled(true);
//                  tabOptPanel.txfCaption.setEnabled(true);
                   
                    tabOptPanel.chkDigits.setEnabled(true);
//                  tabOptPanel.sprDigits.setEnabled(true);
              }             
            }
        });

        compRepPanel.jrb_compAndRep.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
             
              if ( tabOptPanel.chkTable.isSelected() ){
                    tabOptPanel.chkCaption.setEnabled(true);
//                  tabOptPanel.txfCaption.setEnabled(true);
                   
                    tabOptPanel.chkDigits.setEnabled(true);
//                  tabOptPanel.sprDigits.setEnabled(true);
              }             
            }
        });

        tabOptPanel.chkTable.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
             
                if (e.getStateChange() == ItemEvent.SELECTED) {
                  tabOptPanel.lblLabel.setEnabled(true);
                  tabOptPanel.txfLabel.setEnabled(true);

                  if (compRepPanel.jrb_compAndRep.isSelected() || compRepPanel.jrb_report.isSelected()){
                    tabOptPanel.chkCaption.setEnabled(true);
                    tabOptPanel.chkDigits.setEnabled(true);
                  }                 
                }
                if (e.getStateChange() == ItemEvent.DESELECTED) {
                  tabOptPanel.lblLabel.setEnabled(false);
                  tabOptPanel.txfLabel.setEnabled(false);
                 
                 
                  tabOptPanel.chkCaption.setSelected(false);
                  tabOptPanel.chkCaption.setEnabled(false);
                  tabOptPanel.txfCaption.setEnabled(false);
                 
                  tabOptPanel.chkDigits.setSelected(false);
                  tabOptPanel.chkDigits.setEnabled(false);
                  tabOptPanel.sprDigits.setEnabled(false);
                 
                }
            }
        });

       
        /*   
    
    
    
    
    
    
    
    
    
    
    
    
    
    
     * tabOptPanel.chkCaption.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                  tabOptPanel.txfCaption.setEnabled(true);
                }
                if (e.getStateChange() == ItemEvent.DESELECTED) {
                  tabOptPanel.txfCaption.setText("");
                  tabOptPanel.txfCaption.setText("type caption here");
                  tabOptPanel.txfCaption.setEnabled(false);
                }
            }
        });

        tabOptPanel.txfCaption.addFocusListener(new FocusListener() {
            public void focusGained(FocusEvent fEvent) {
              if (compRepPanel.jrb_compAndRep.isSelected() || compRepPanel.jrb_report.isSelected()){
                  if (tabOptPanel.txfCaption.getText().equals("type caption here")) {
                    tabOptPanel.txfCaption.setText("");
                  }
              }
            }

            public void focusLost(FocusEvent fEvent) {
                ;
            }
        });
       
       
        tabOptPanel.txfLabel.addFocusListener(new FocusListener() {
            public void focusGained(FocusEvent fEvent) {
              if (compRepPanel.jrb_compAndRep.isSelected() || compRepPanel.jrb_report.isSelected()){
                  if (tabOptPanel.txfLabel.getText().equals("type label here")) {
                    tabOptPanel.txfLabel.setText("");
                  }  public TableOptionsPanel getTablePanel() {
    // TODO Auto-generated method stub
    return tabOptPanel;
  }

              }
            }

            public void focusLost(FocusEvent fEvent) {
                ;
            }
        });
       
        tabOptPanel.txfLabel.addMouseListener(new MouseListener() {
            public void mousePressed(MouseEvent mEvent) {
                ;
            }

            public void mouseEntered(MouseEvent mEvent) {
                ;
            }

            public void mouseExited(MouseEvent mEvent) {
                ;     
            }

            public void mouseClicked(MouseEvent mEvent) {
              if (compRepPanel.jrb_report.isSelected() || compRepPanel.jrb_compAndRep.isSelected()){
                tabOptPanel.lblLabel.setEnabled(true);
           //     tabOptPanel.lblLabel.setSelected(true);
                tabOptPanel.txfLabel.setEnabled(true);
                 
                 
              }
     
            }

            public void mouseReleased(MouseEvent mEvent) {
                ;
            }
        });
       
        tabOptPanel.txfCaption.addMouseListener(new MouseListener() {
            public void mousePressed(MouseEvent mEvent) {
                ;
            }

            public void mouseEntered(MouseEvent mEvent) {
                ;
            }

            public void mouseExited(MouseEvent mEvent) {
                ;
            }

            public void mouseClicked(MouseEvent mEvent) {
             
              if (compRepPanel.jrb_report.isSelected() || compRepPanel.jrb_compAndRep.isSelected()){
                tabOptPanel.chkCaption.setEnabled(true);
                tabOptPanel.chkCaption.setSelected(true);
                tabOptPanel.txfCaption.setEnabled(true);         
              }
            }

            public void mouseReleased(MouseEvent mEvent) {
                ;
            }
        });
       
        tabOptPanel.sprDigits.addMouseListener(new MouseListener(){
         public void mousePressed(MouseEvent mEvent){
         ;
         }
         public void mouseEntered(MouseEvent mEvent){
         ;
         }
         public void mouseExited(MouseEvent mEvent){
         ;
         }
         public void mouseClicked(MouseEvent mEvent){
           tabOptPanel.chkDigits.setEnabled(true);
           tabOptPanel.chkDigits.setSelected(true);
           tabOptPanel.sprDigits.setEnabled(true);         
         }
         public void mouseReleased(MouseEvent mEvent){
         ;
         }
         }); 
       
        compRepPanel.jrb_report.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              tabOptPanel.chkCaption.setEnabled(true);
              tabOptPanel.chkDigits.setEnabled(true);
              tabOptPanel.lblLabel.setEnabled(true);
            }
        });

        compRepPanel.jrb_compAndRep.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              tabOptPanel.chkCaption.setEnabled(true);
              tabOptPanel.chkDigits.setEnabled(true);
              tabOptPanel.lblLabel.setEnabled(true);
            }
        });
       
        compRepPanel.jrb_compute.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              tabOptPanel.chkCaption.setEnabled(false);
              tabOptPanel.chkCaption.setSelected(false);
              tabOptPanel.chkDigits.setEnabled(false);
              tabOptPanel.chkDigits.setSelected(false);
              tabOptPanel.lblLabel.setEnabled(false);
//             tabOptPanel.lblLabel.setSelected(false);
            }
        });
       
       
        tabOptPanel.chkDigits.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                  tabOptPanel.sprDigits.setValue(3);
                  tabOptPanel.sprDigits.setEnabled(true);
                }
                if (e.getStateChange() == ItemEvent.DESELECTED) {
                  tabOptPanel.sprDigits.setValue(3);
                  tabOptPanel.sprDigits.setEnabled(false);
                }
            }
        });

    */
   
    // TODO Auto-generated constructor stub
  }

  public ComputeReportAndReportOptionsPanel(LayoutManager arg0) {
    super(arg0);
    // TODO Auto-generated constructor stub
  }

  public ComputeReportAndReportOptionsPanel(boolean arg0) {
    super(arg0);
    // TODO Auto-generated constructor stub
  }

  public ComputeReportAndReportOptionsPanel(LayoutManager arg0, boolean arg1) {
    super(arg0, arg1);
    // TODO Auto-generated constructor stub
  }

    private void addComponent(Container cont,
            GridBagLayout gbl,
            Component c,
            int gridx, int gridy,
            int gridwidth, int gridheight,
            int fill,
            int ipadx, int ipady,

            /* Insets insets, */
            int anchor,
            double weightx, double weighty) {
        GridBagConstraints gbc = new GridBagConstraints()

        gbc.gridx = gridx;
        gbc.gridy = gridy; // Spalte/Reihe mit ganz links = 0 und ganz oben = 0
        gbc.gridwidth = gridwidth;
        gbc.gridheight = gridheight; // Anzahl Spalten/Reihen, die Komponente nutzt - DEFAULT = 1;
        gbc.fill = fill; // entscheidet howto resize the component, wenn sie vergrößert wird = NONE , HORIZONTAL, VERTICAL, BOTH
        gbc.ipadx = ipadx;
        gbc.ipady = ipady; // interne Füllung (howmuch to add to the minimum weight/height of the component
        // gbc.insets = insets;                  // externe Füllung (howmuch is the minimum space between component and the edges of its display area)
        gbc.anchor = anchor; // used if component kleiner als seine display area (verschiedene Konstanten)
        gbc.weightx = weightx;
        gbc.weighty = weighty; // determines howto distribute space among columns and rows
        gbl.setConstraints(c, gbc);
        cont.add(c);
    }  
   
  public TableOptionsPanel getTablePanel() {
    // TODO Auto-generated method stub
    return tabOptPanel;
  }

/*  public String getReturnValuesPanel(){
    return compRepPanel.getR;
  } */
 
  public boolean isEvaled() {
    // TODO Auto-generated method stub
    return compRepPanel.isEvaled();
  }  

  public boolean isInReport() {
    // TODO Auto-generated method stub
    return compRepPanel.isInReport();
  }
 
}
TOP

Related Classes of guicomponents.ComputeReportAndReportOptionsPanel

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.