public void setData() { /* if(model.getAllViews() == null) { return; } */ for (int i = JTable1.getRowCount() - 1; i >= 0; i--) { ViewTableModel.removeRow(i); } Vector views = model.getAllViews(); for (int j = 0; j < views.size(); j++) { AuthViewWithOperations view = (AuthViewWithOperations) views.elementAt(j); String viewNa = view.getAuthorizedViewName(); ViewTableModel.addRow(new Object[] {viewNa}); } }
public void setUpProperties() { // <Begin_setUpProperties> // <UserCode_Begin_Bean_Top> // this.setModal(true); setResizable(false); // <UserCode_End_Bean_Top> try { JTable1.setRowHeight(22); JTable1.setModel(ViewTableModel); JTable1.setGridColor(new Color(-1)); } catch (Exception ex) { showStatus( resourceBundle.getString("Exception while setting properties for bean ") + JTable1, ex); } // <UserCode_Begin_Bean_JTable1> // <UserCode_End_Bean_JTable1> try { JPanel3.setBorder(new javax.swing.border.TitledBorder(resourceBundle.getString(""))); } catch (Exception ex) { showStatus( resourceBundle.getString("Exception while setting properties for bean ") + JPanel3, ex); } // <UserCode_Begin_Bean_JPanel3> // <UserCode_End_Bean_JPanel3> try { JButton1.setFont(new Font("Dialog", 0, 12)); JButton1.setText(resourceBundle.getString("Add")); } catch (Exception ex) { showStatus( resourceBundle.getString("Exception while setting properties for bean ") + JButton1, ex); } // <UserCode_Begin_Bean_JButton1> JButton1.setMnemonic('A'); // <UserCode_End_Bean_JButton1> try { JButton2.setFont(new Font("Dialog", 0, 13)); JButton2.setText(resourceBundle.getString("Edit")); } catch (Exception ex) { showStatus( resourceBundle.getString("Exception while setting properties for bean ") + JButton2, ex); } // <UserCode_Begin_Bean_JButton2> JButton2.setMnemonic('E'); // <UserCode_End_Bean_JButton2> try { JButton3.setFont(new Font("Dialog", 0, 13)); JButton3.setText(resourceBundle.getString("Delete")); } catch (Exception ex) { showStatus( resourceBundle.getString("Exception while setting properties for bean ") + JButton3, ex); } // <UserCode_Begin_Bean_JButton3> JButton3.setMnemonic('D'); // <UserCode_End_Bean_JButton3> try { closeButton.setFont(new Font("Dialog", 0, 13)); closeButton.setText(resourceBundle.getString("Close")); } catch (Exception ex) { showStatus( resourceBundle.getString("Exception while setting properties for bean ") + closeButton, ex); } // <UserCode_Begin_Bean_closeButton> // <UserCode_End_Bean_closeButton> // <UserCode_Begin_Bean_JPanel5> // JPanel5.setVisible(false); // <UserCode_End_Bean_JPanel5> try { JLabel1.setFont(new Font("Dialog", 0, 12)); JLabel1.setForeground(new Color(-16764109)); JLabel1.setText( resourceBundle.getString( "Use the following list to add , edit a View , its Properties and authorized Operations")); } catch (Exception ex) { showStatus( resourceBundle.getString("Exception while setting properties for bean ") + JLabel1, ex); } // <UserCode_Begin_Bean_JLabel1> // <UserCode_End_Bean_JLabel1> // <UserCode_Begin_Bean_ViewTableModel> ViewTableModel.setDataVector( new Object[0][0], new String[] {resourceBundle.getString("Views List")}); // <UserCode_End_Bean_ViewTableModel> JPanel5.setPreferredSize( new Dimension( JPanel5.getPreferredSize().width + 22, JPanel5.getPreferredSize().height + 38)); closeButton.setPreferredSize( new Dimension( closeButton.getPreferredSize().width + 8, closeButton.getPreferredSize().height + 0)); JButton3.setPreferredSize( new Dimension( JButton3.getPreferredSize().width + 32, JButton3.getPreferredSize().height + 0)); JButton2.setPreferredSize( new Dimension( JButton2.getPreferredSize().width + 45, JButton2.getPreferredSize().height + 0)); JButton1.setPreferredSize( new Dimension( JButton1.getPreferredSize().width + 47, JButton1.getPreferredSize().height + 2)); JPanel2.setPreferredSize( new Dimension( JPanel2.getPreferredSize().width + 10, JPanel2.getPreferredSize().height + 26)); JLabel2.setPreferredSize( new Dimension( JLabel2.getPreferredSize().width + 124, JLabel2.getPreferredSize().height + 72)); JPanel6.setPreferredSize( new Dimension( JPanel6.getPreferredSize().width + 10, JPanel6.getPreferredSize().height + 114)); JPanel1.setPreferredSize( new Dimension( JPanel1.getPreferredSize().width + 39, JPanel1.getPreferredSize().height + 38)); // <End_setUpProperties> JPanel1.setBorder( new javax.swing.border.TitledBorder(resourceBundle.getString("View Settings"))); JPanel5.setBorder( new javax.swing.border.TitledBorder( resourceBundle.getString("Views Properties and Operations"))); }
public void init() { // <Begin_init> if (getParameter("RESOURCE_PROPERTIES") != null) { localePropertiesFileName = getParameter("RESOURCE_PROPERTIES"); } resourceBundle = com.adventnet.apiutils.Utility.getBundle( localePropertiesFileName, getParameter("RESOURCE_LOCALE"), applet); if (initialized) return; this.setSize(getPreferredSize().width + 495, getPreferredSize().height + 480); setTitle(resourceBundle.getString("ViewConfig")); Container container = getContentPane(); container.setLayout(new BorderLayout()); try { initVariables(); setUpGUI(container); setUpProperties(); setUpConnections(); } catch (Exception ex) { showStatus(resourceBundle.getString("Error in init method"), ex); } // let us set the initialized variable to true so // we dont initialize again even if init is called initialized = true; // <End_init> setTitle(resourceBundle.getString("View Configuration")); setIconImage(AuthMain.getBuilderUiIfInstance().getFrameIcon()); JLabel1.setIcon(AuthMain.getBuilderUiIfInstance().getImage("viewconfig.png")); com.adventnet.security.ui.ViewListCellRenderer ViewListCellRenderer1 = new com.adventnet.security.ui.ViewListCellRenderer(); JTable1.setDefaultRenderer(JTable1.getColumnClass(0), ViewListCellRenderer1); JLabel2.setIcon(AuthMain.getBuilderUiIfInstance().getImage("addview1.png")); JTable1.getCellEditor(0, 0) .getTableCellEditorComponent(JTable1, null, true, 0, 0) .setEnabled(false); DefaultCellEditor te = (DefaultCellEditor) JTable1.getCellEditor(0, 0); te.setClickCountToStart(10); JTable1.setCellEditor(te); JViewport vp = new JViewport(); JLabel lab = new JLabel(resourceBundle.getString("List of available views")); lab.setHorizontalAlignment((int) JLabel.CENTER_ALIGNMENT); lab.setForeground(Color.black); vp.setView(lab); AuthMain.getBuilderUiIfInstance().centerWindow(this); setData(); viewc = this; addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { close(); } }); /* TableColumn col2 = JTable1.getColumnModel().getColumn(1); DefaultTableCellRenderer ren = new DefaultTableCellRenderer(); ren.setIcon(AuthMain.getBuilderUiIfInstance().getImage("task1.png")); col2.setCellRenderer(ren); col2.setMaxWidth(30); */ DefaultListSelectionModel selModel = new DefaultListSelectionModel(); selModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JTable1.setSelectionModel(selModel); }