private void createTable() {
   model = new ParametersTableModel();
   table = new JXTable(model);
   table.setSortable(false);
   // table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   table.setRolloverEnabled(true);
   table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED));
 }
  /**
   * Lager tabell for avregningimport
   *
   * @return tabell
   */
  public JXTable getTableImport() {
    table = new JXTable();

    table.setModel(new DeductImportTableModel(deductImportSelectionList));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setSelectionModel(
        new SingleListSelectionAdapter(deductImportSelectionList.getSelectionIndexHolder()));
    table.setColumnControlVisible(true);
    deductImportSelectionList.clearSelection();

    table.packAll();
    table.setSortable(true);
    return table;
  }
Beispiel #3
0
  private JXPanel getGutachtenTbl() {
    JXPanel dummypan = new JXPanel(new BorderLayout());
    dummypan.setOpaque(false);
    dummypan.setBorder(null);
    dtblm = new MyGutachtenTableModel();
    String[] column = {
      "ID", "Titel", "Verfasser", "erstellt", "Empfänger", "letzte Änderung", "", ""
    };
    dtblm.setColumnIdentifiers(column);
    tabbericht = new JXTable(dtblm);
    // tabbericht.setEditable(true);
    tabbericht.setSortable(false);
    tabbericht.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent arg0) {
            // TODO Auto-generated method stub
            if (arg0.getClickCount() == 2) {
              if (!Rechte.hatRecht(Rechte.Gutachten_editvoll, true)) {
                return;
              }
              // hier prüfen welcher Berichtstyp und dementsprechend das Berichtsfenster �ffnen
              /// neuanlageRezept(false,"");
              int wahl = tabbericht.getSelectedRow();
              if (wahl < 0) {
                return;
              }
              String verfas = (String) dtblm.getValueAt(wahl, 2);
              if (verfas.toUpperCase().contains("REHAARZT")
                  || verfas.toUpperCase().contains("REHA-ARZT")) {
                new SwingWorker<Void, Void>() {
                  @Override
                  protected Void doInBackground() throws Exception {
                    try {
                      doBerichtEdit();
                    } catch (Exception ex) {
                      ex.printStackTrace();
                    }
                    return null;
                  }
                }.execute();
              }
            }
          }
        });
    /*
    		0		"berichtid," +
    		1		"bertitel," +
    		2		"verfasser," +
    		3		"DATE_FORMAT(erstelldat,'%d.%m.%Y') AS derstelldat," +
    		4		"empfaenger," +
    		5		"DATE_FORMAT(editdat,'%d.%m.%Y') AS deditdat,
    		6		"empfid",
    */
    tabbericht.getColumn(0).setMinWidth(50);
    tabbericht.getColumn(0).setMaxWidth(50);
    tabbericht.getColumn(1).setMinWidth(140);
    tabbericht.getColumn(3).setMaxWidth(80);
    tabbericht.getColumn(5).setMaxWidth(80);
    tabbericht.getColumn(6).setMinWidth(0);
    tabbericht.getColumn(6).setMaxWidth(0);
    tabbericht.getColumn(7).setMinWidth(0);
    tabbericht.getColumn(7).setMaxWidth(0);
    tabbericht.validate();

    JScrollPane jscr = JCompTools.getTransparentScrollPane(tabbericht);
    jscr.validate();
    dummypan.add(jscr, BorderLayout.CENTER);
    return dummypan;
  }
  public void setEntity(ITridas entity) {
    theentity = entity;
    lookupUsersAndGroups();

    userTableModel = new UsersWithPermissionsTableModel(permsList);
    groupTableModel = new GroupsWithPermissionsTableModel(permsList);
    groupTableModel.addTableModelListener(
        new TableModelListener() {

          @Override
          public void tableChanged(TableModelEvent e) {
            updateUsersTable();
          }
        });
    setLayout(new MigLayout("", "[][grow]", "[86px][28.00][328px,grow]"));

    lblPermissionsInfoFor = new JLabel("Permissions info for:");
    add(lblPermissionsInfoFor, "cell 0 1,alignx trailing");

    // TODO : make this code pretty...
    txtLabCode = new JTextField();
    txtLabCode.setText(entity.getTitle());
    txtLabCode.setFocusable(false);

    txtLabCode.setEditable(false);
    add(txtLabCode, "cell 1 1,growx");
    txtLabCode.setColumns(10);

    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    add(tabbedPane, "cell 0 2 2 1,grow");

    panelGroups = new JPanel();
    tabbedPane.addTab(
        "Group permissions", Builder.getIcon("edit_group.png", 22), panelGroups, null);
    panelGroups.setLayout(new MigLayout("", "[648px,grow]", "[381px,grow][]"));

    JScrollPane scrollGroup = new JScrollPane();
    panelGroups.add(scrollGroup, "cell 0 0,grow");

    tblGroupPerms = new JXTable(groupTableModel);
    tblGroupPerms.setSortable(true);

    searchableGroup = new TableSearchable(tblGroupPerms);
    tblGroupPerms.setSearchable(searchableGroup);

    scrollGroup.setViewportView(tblGroupPerms);

    btnEditGroup = new JButton("View / Edit Group");
    btnEditGroup.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            editSelectedGroup();
          }
        });
    panelGroups.add(btnEditGroup, "flowx,cell 0 1");

    btnRevertToDefault = new JButton("Revert to database defaults");
    btnRevertToDefault.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            resetPermissionsForCurrentGroup();
          }
        });
    panelGroups.add(btnRevertToDefault, "cell 0 1");

    btnGroupRefresh = new JButton("Refresh");
    btnGroupRefresh.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            updateGroupsTable();
          }
        });
    panelGroups.add(btnGroupRefresh, "cell 0 1");

    tblGroupPerms.getColumnModel().getColumn(0).setPreferredWidth(15);
    tblGroupPerms.getColumnModel().getColumn(1).setPreferredWidth(100);
    tblGroupPerms.getColumnModel().getColumn(2).setPreferredWidth(45);
    tblGroupPerms.getColumnModel().getColumn(3).setPreferredWidth(45);
    tblGroupPerms.getColumnModel().getColumn(4).setPreferredWidth(45);
    tblGroupPerms.getColumnModel().getColumn(5).setPreferredWidth(45);
    tblGroupPerms.getColumnModel().getColumn(6).setPreferredWidth(45);
    tblGroupPerms.getColumnModel().getColumn(7).setPreferredWidth(300);

    panelUsers = new JPanel();
    tabbedPane.addTab("Users with access", Builder.getIcon("edit_user.png", 22), panelUsers, null);
    panelUsers.setLayout(new MigLayout("", "[648px,grow]", "[381px,grow][]"));

    JScrollPane scrollUser = new JScrollPane();
    panelUsers.add(scrollUser, "cell 0 0,grow");

    tblUserPerms = new JXTable(userTableModel);

    searchableUser = new TableSearchable(tblUserPerms);
    tblUserPerms.setSearchable(searchableUser);

    tblUserPerms.setSortable(true);
    scrollUser.setViewportView(tblUserPerms);

    btnEditUser = new JButton("View / Edit User");
    btnEditUser.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            editSelectedUser();
          }
        });
    panelUsers.add(btnEditUser, "flowx,cell 0 1");

    btnUserRefresh = new JButton("Refresh");
    btnUserRefresh.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {

            updateUsersTable();
          }
        });
    panelUsers.add(btnUserRefresh, "cell 0 1");

    tblUserPerms.getColumnModel().getColumn(0).setPreferredWidth(15);
    tblUserPerms.getColumnModel().getColumn(1).setPreferredWidth(100);
    tblUserPerms.getColumnModel().getColumn(2).setPreferredWidth(45);
    tblUserPerms.getColumnModel().getColumn(3).setPreferredWidth(45);
    tblUserPerms.getColumnModel().getColumn(4).setPreferredWidth(45);
    tblUserPerms.getColumnModel().getColumn(5).setPreferredWidth(45);
    tblUserPerms.getColumnModel().getColumn(6).setPreferredWidth(45);
    tblUserPerms.getColumnModel().getColumn(7).setPreferredWidth(300);

    tblGroupPerms.addMouseListener(this);
    tblUserPerms.addMouseListener(this);

    panelTitle = new JPanel();
    add(panelTitle, "cell 0 0 2 1,growx,aligny top");
    panelTitle.setBackground(Color.WHITE);
    panelTitle.setLayout(new MigLayout("", "[411.00,grow][]", "[][grow]"));

    lblGroupPermissions = new JLabel("Access Permissions");
    lblGroupPermissions.setFont(new Font("Dialog", Font.BOLD, 14));
    panelTitle.add(lblGroupPermissions, "flowy,cell 0 0");

    panelIcon = new JPanel();
    panelIcon.setBackground(Color.WHITE);
    panelTitle.add(panelIcon, "cell 1 0 1 2,grow");

    lblIcon = new JLabel();
    lblIcon.setIcon(Builder.getIcon("trafficlight.png", 64));
    panelIcon.add(lblIcon);

    txtDescription = new JTextArea();
    txtDescription.setBorder(null);
    txtDescription.setEditable(false);
    txtDescription.setFocusable(false);
    txtDescription.setFont(new Font("Dialog", Font.PLAIN, 10));
    txtDescription.setLineWrap(true);
    txtDescription.setWrapStyleWord(true);
    txtDescription.setText(
        "Permissions are set on groups, not users.  You can set: create; read; "
            + "update; and delete permissions separately.  Permissions are inherited from the default "
            + "database permissions given to the group (editable in the main group dialog). If you "
            + "change permissions here you will override the access for the current entity and any "
            + "child entities in the database. "
            + "The users tab shows the current list of users who have permission to access this "
            + "entity in some way.");
    panelTitle.add(txtDescription, "cell 0 1,grow,wmin 10");
  }