Package rex.graphics.layoutmanagers

Examples of rex.graphics.layoutmanagers.GridBagLayoutRex


      JPanel jp;
      JLabel item;
      if (tuples != null && getTupleCount() > 0){
         jp = new JPanel();
         jp.setBackground(AppColors.HIERARCHY_PANE_BACKGROUND);
         GridBagLayoutRex gb = new GridBagLayoutRex();
         GridBagConstraints c = new GridBagConstraints();
//         c.anchor=GridBagConstraints.WEST; //Jules
         jp.setLayout(gb);
         //c.fill = GridBagConstraints.HORIZONTAL;
         c.fill = GridBagConstraints.BOTH;

         c.weightx = 1// resizable in both ways
         c.weighty = 1;
         Dimension prefSize = new Dimension(itemWidth, itemHeight);

         tupleCount = getTupleCount();
         memberCount = ((Tuple)tuples.elementAt(0)).getMemberCount();
         int[] memberSpan = new int[memberCount];
         int[] currMemberX = new int[memberCount];
         for(k=0; k < memberCount; k++) memberSpan[k] = 0;
         for(k=0; k < memberCount; k++) currMemberX[k] = tupleCount;

         for (i = tupleCount - 1; i >= 0; i--) {
            for(j=0; j<memberCount; j++){
               if (memberSpan[j] == 0){
                  memberSpan[j] = getTupleAt(i).getMemberAt(j).getMemberSpan();
                  currMemberX[j] -= getTupleAt(i).getMemberAt(j).getMemberSpan();
//                  S.out("x=" + currMemberX[j]
//                        +  "\ty=" + j
//                        + "\twidth=" + getTupleAt(i).getMemberAt(j).getMemberSpan()
//                        + "\tmember="  + getTupleAt(i).getMemberAt(j));
//
                  item = new ColumnTupleMemberLabel("" + getTupleAt(i).getMemberAt(j)
                                       , query
                                       , getTupleAt(i)
                                       , j
                                       , i);
                  if (getTupleAt(i).getMemberAt(j).isMeasure()){
                     item.setIcon(getTupleAt(i).getMemberAt(j).getIcon());
                  }
                  item.setToolTipText(getTupleAt(i).getMemberAt(j).getToolTip());
//                  setHierarchyLabelProperties(item);

                  item.setPreferredSize(prefSize);
                  item.setMinimumSize(prefSize);
                  item.setMaximumSize(prefSize);
                  // add listener
                  c.gridx = currMemberX[j];
                  c.gridy = j;
                  c.gridwidth = getTupleAt(i).getMemberAt(j).getMemberSpan();
                  c.gridheight = 1;
//                  S.out("c.gridx=" + c.gridx
//                        + " c.gridy=" + c.gridy
//                        + " c.gridheight= "+ c.gridheight
//                        + " c.gridwidth=" + c.gridwidth
//                        + " item = " + item.getText()
//                        + " attrs=" + item);
                  gb.setConstraints(item, c);
                  jp.add(item);
               }
               memberSpan[j]--;
            }
         }
         if (showRowTotalsOn){
            //JLabel totalsLabel = new JLabel("<html><b>SUM:</b></html>", JLabel.CENTER);
             JLabel totalsLabel = lblSum; //new JLabel("<html><b>SUM:</b></html>", JLabel.CENTER);
            totalsLabel.setBackground(AppColors.CELL_TOTAL_SUM_BACKGROUND_COLOR);
            totalsLabel.setBorder(AppColors.CELL_TOTAL_SUM_BORDER);
            totalsLabel.setOpaque(true);
            totalsLabel.setPreferredSize(prefSize);
            totalsLabel.setMinimumSize(prefSize);
            totalsLabel.setMaximumSize(prefSize);
            c.gridx = tupleCount;
            c.gridy = 0;
            c.gridwidth = 1;
            c.gridheight = memberCount;
            gb.setConstraints(totalsLabel, c);
            jp.add(totalsLabel);

            totalsLabel =lblAverage;// new JLabel("<html><b>AVERAGE:</b></html>", JLabel.CENTER);
            totalsLabel.setBackground(AppColors.CELL_TOTAL_AVERAGE_BACKGROUND_COLOR);
            totalsLabel.setBorder(AppColors.CELL_TOTAL_AVERAGE_BORDER);
            totalsLabel.setOpaque(true);
            totalsLabel.setPreferredSize(prefSize);
            totalsLabel.setMinimumSize(prefSize);
            totalsLabel.setMaximumSize(prefSize);
            c.gridx = tupleCount + 1;
            c.gridy = 0;
            c.gridwidth = 1;
            c.gridheight = memberCount;
            gb.setConstraints(totalsLabel, c);
            jp.add(totalsLabel);

         }

         //jp.setBorder(BorderFactory.createLineBorder(Color.RED));
View Full Code Here


//      if (tuples != null ){
      if (tuples != null && getTupleCount() > 0 ){
         jp = new JPanel();
         jp.setBackground(AppColors.HIERARCHY_PANE_BACKGROUND);
//         jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
         GridBagLayoutRex gb = new GridBagLayoutRex();
         jp.setLayout(gb);

         tupleCount = getTupleCount();
         memberCount = ((Tuple)tuples.elementAt(0)).getMemberCount();

//         int panelPartCount = tupleCount/512;;
//         JPanel[] panelPart = new JPanel[panelPartCount];



//         for(i=0; i<panelPartCount; i++){
//            gb[i] = new GridBagLayout();
//            panelPart[i].setLayout(gb[i]);
//            jp.add(panelPart[i]);
//         }

         GridBagConstraints c = new GridBagConstraints();

         //Jules
         Dimension dim = new Dimension(itemWidth, itemHeight);

         //c.fill = GridBagConstraints.HORIZONTAL;
         c.fill = GridBagConstraints.BOTH;

         c.weightx = 1// resizable in both ways
         c.weighty = 1;


         int[] memberSpan = new int[memberCount];
         int[] currMemberX = new int[memberCount];
         for(k=0; k < memberCount; k++) memberSpan[k] = 0;
         for(k=0; k < memberCount; k++) currMemberX[k] = tupleCount;

         for (i = tupleCount - 1; i >= 0; i--) {
            for(j=0; j<memberCount; j++){
               //S.out("i=" + i + " j=" + j + " memberSpan[j]=" + getTupleAt(i).getMemberAt(j).getMemberSpan() + " item=" + getTupleAt(i).getMemberAt(j));
               if (memberSpan[j] == 0){
                  memberSpan[j] =  getTupleAt(i).getMemberAt(j).getMemberSpan();
                  currMemberX[j] -= getTupleAt(i).getMemberAt(j).getMemberSpan();

//                  S.out("x=" + currMemberX[j]
//                        +  "\ty=" + j
//                        + "\twidthy=" + getTupleAt(i).getMemberAt(j).getMemberSpan()
//                        + "\tmember="  + getTupleAt(i).getMemberAt(j));

                  item = new RowTupleMemberLabel("" + getTupleAt(i).getMemberAt(j)
                                              , query
                                              , getTupleAt(i)
                                              , j
                                              , i);
//                  setHierarchyLabelProperties(item);
                  item.setToolTipText(getTupleAt(i).getMemberAt(j).getToolTip());
                  //Jules
//                  item.setPreferredSize(new Dimension(itemWidth, itemHeight));
//                  item.setMinimumSize(new Dimension(itemWidth, itemHeight));
//                  item.setMaximumSize(new Dimension(itemWidth, itemHeight));
                  item.setPreferredSize(dim);
                  item.setMinimumSize(dim);
                  item.setMaximumSize(dim);
                  // add listener
                  c.gridx = j;
                  c.gridy = currMemberX[j];
                  c.gridwidth = 1;
                  c.gridheight = getTupleAt(i).getMemberAt(j).getMemberSpan();
//                  S.out("c.gridx=" + c.gridx
//                        + " c.gridy=" + c.gridy
//                        + " c.gridheight= "+ c.gridheight
//                        + " c.gridwidth=" + c.gridwidth
//                        + " item = " + item.getText()
//                        + " attrs=" + item);
                  gb.setConstraints(item, c);
                  jp.add(item);
               }
               memberSpan[j]--;
            }
         }
         if (showColumnTotalsOn){
             /**
              * Copyright (C) 2006 CINCOM SYSTEMS, INC.
              * All Rights Reserved
              * Copyright (C) 2006 Igor Mekterovic
              * All Rights Reserved
              */
            /* implementing localization */
            JLabel totalsLabel = lblSum; // new JLabel("<html><b>SUM:</b></html>", JLabel.RIGHT);
              /* end of modification for I18n */

            totalsLabel.setBackground(AppColors.CELL_TOTAL_SUM_BACKGROUND_COLOR);
            totalsLabel.setBorder(AppColors.CELL_TOTAL_SUM_BORDER);
            totalsLabel.setOpaque(true);
            c.gridx = 0;
            c.gridy = tupleCount;
            c.gridwidth = memberCount;
            c.gridheight = 1;
            gb.setConstraints(totalsLabel, c);
            jp.add(totalsLabel);

            totalsLabel = lblAverage;//new JLabel("<html><b>AVERAGE:</b></html>", JLabel.RIGHT);
            totalsLabel.setBackground(AppColors.CELL_TOTAL_AVERAGE_BACKGROUND_COLOR);
            totalsLabel.setBorder(AppColors.CELL_TOTAL_AVERAGE_BORDER);
            totalsLabel.setOpaque(true);
            c.gridx = 0;
            c.gridy = tupleCount + 1;
            c.gridwidth = memberCount;
            c.gridheight = 1;
            gb.setConstraints(totalsLabel, c);
            jp.add(totalsLabel);

         }
//         for(int comp = 0; comp<jp.getComponentCount(); comp++){
//            S.out("comp[" + comp + "]=" + jp.getComponent(comp));
View Full Code Here

TOP

Related Classes of rex.graphics.layoutmanagers.GridBagLayoutRex

Copyright © 2018 www.massapicom. 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.