Exemplo n.º 1
0
 /**
  * Metodo para construir el grid. Subclaseses recomendable que ejecuten super.buildGrid antes de
  * iniciar una personalizacion de este metodo
  *
  * @return
  */
 protected JXTable buildGrid() {
   final EventTableModel<T> tm = new EventTableModel<T>(sortedSource, getTableFormat());
   selectionModel = new EventSelectionModel(sortedSource);
   selectionModel.setSelectionMode(getSelectionMode());
   final JXTable grid = ComponentUtils.getStandardTable();
   grid.setModel(tm);
   grid.setSelectionModel(selectionModel);
   final Action select =
       new AbstractAction() {
         public void actionPerformed(ActionEvent e) {
           doSelect();
         }
       };
   ComponentUtils.addEnterAction(grid, select);
   grid.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent e) {
           if (e.getClickCount() == 2) doSelect();
         }
       });
   // new TableComparatorChooser(grid,sortedSource,true);
   TableComparatorChooser.install(
       grid, sortedSource, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE);
   grid.packAll();
   return grid;
 }
Exemplo n.º 2
0
  private JComponent createDetailsPanel() {

    final TableFormat<Pago> tf = CXCTableFormats.getPagoConVentaTF();
    final EventList<Pago> pagos = model.getPagos();
    final SortedList<Pago> spagos = new SortedList<Pago>(pagos, null);
    final EventTableModel<Pago> tm = new EventTableModel<Pago>(spagos, tf);
    selectionModel = new EventSelectionModel<Pago>(spagos);
    grid = ComponentUtils.getStandardTable();
    grid.setModel(tm);
    grid.setSelectionModel(selectionModel);
    new TableComparatorChooser<Pago>(grid, spagos, true);
    ComponentUtils.decorateActions(grid);
    ComponentUtils.addInsertAction(grid, getInsertAction());
    ComponentUtils.addDeleteAction(grid, getDeleteAction());
    grid.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) view();
          }
        });
    grid.getColumn("Desc (%)").setCellRenderer(Renderers.getPorcentageRenderer());
    grid.getColumn("Cgo").setCellRenderer(Renderers.getPorcentageRenderer());
    grid.getColumn("Desc Aplic").setCellRenderer(Renderers.getCantidadNormalTableCellRenderer());
    final JScrollPane sp = new JScrollPane(grid);
    return sp;
  }
Exemplo n.º 3
0
  protected JComponent buildGridPanel() {
    grid = ComponentUtils.getStandardTable();
    grid.setColumnControlVisible(false);
    source = new BasicEventList();
    final EventList<MatcherEditor> editors = new BasicEventList<MatcherEditor>();
    editors.add(
        new TextComponentMatcherEditor(
            inputField,
            GlazedLists.textFilterator(
                new String[] {"documento", "sucursal.nombre", "clave", "nombre"})));
    final MatcherEditor editor = new CompositeMatcherEditor(editors);
    final FilterList filterList = new FilterList(source, new ThreadedMatcherEditor(editor));
    SortedList sorted = new SortedList(filterList, null);
    final EventTableModel tm = new EventTableModel(sorted, getTableFormat());
    selectionModel = new EventSelectionModel(sorted);

    grid.setModel(tm);
    TableComparatorChooser.install(grid, sorted, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE);
    grid.setSelectionModel(selectionModel);

    final Action select =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            doSelect();
          }
        };
    ComponentUtils.addEnterAction(grid, select);
    grid.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) doSelect();
          }
        });
    grid.packAll();

    JComponent c = ComponentUtils.createTablePanel(grid);
    c.setPreferredSize(new Dimension(750, 400));
    return c;
  }
Exemplo n.º 4
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;
  }
  @SuppressWarnings("unchecked")
  private void initComponents() {
    org.jdesktop.application.ResourceMap resourceMap =
        org.jdesktop.application.Application.getInstance(
                insalmo_instream_gui.InsalmoInstreamApp.class)
            .getContext()
            .getResourceMap(ShowErrorsWarnings.class);

    // CLOSE
    closeButton.setName("closeButton");
    closeButton.setText(resourceMap.getString("closeButton.text"));
    closeButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            closeButtonActionPerfomed(evt);
          }
        });

    showErrorWarningsPanel = new javax.swing.JPanel();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setName("showErrorsWarnings");

    // ERROR/WARNING TABLE
    errorTable = this.createXTable();
    errorTable.setName("errorTable");
    errorTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    DefaultTableModel dataModel =
        new DefaultTableModel() {
          Class[] types =
              new Class[] {
                java.lang.String.class,
                java.lang.String.class,
                java.lang.String.class,
                java.lang.String.class,
                java.lang.String.class,
                Parameter.class
              };
          boolean[] canEdit = new boolean[] {false, false, false, false, false, false};

          public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
          }

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
          }
        };
    dataModel.setColumnIdentifiers(
        new String[] {"", "Parameter", "Value", "Location", "Message", "Parameter Object"});
    for (Parameter p : this.openProject.getErrors()) {
      String filename;
      if (p.getSource().getClass().equals(SetupParameters.class)) {
        filename = ((SetupParameters) p.getSource()).getFileName();
      } else {
        filename = "Experiment.Setup";
      }
      dataModel.addRow(
          new Object[] {
            "Error",
            p.getParameterName(),
            p.getParameterValue(),
            filename,
            p.getValidationMessage(),
            p
          });
    }
    for (Parameter p : this.openProject.getWarnings()) {
      String filename;
      if (p.getSource().getClass().equals(SetupParameters.class)) {
        filename = ((SetupParameters) p.getSource()).getFileName();
      } else {
        filename = "Experiment.Setup";
      }
      dataModel.addRow(
          new Object[] {
            "Warning",
            p.getParameterName(),
            p.getParameterValue(),
            filename,
            p.getValidationMessage(),
            p
          });
    }
    errorTable.setModel(dataModel);
    errorTable.getColumnExt("Parameter Object").setVisible(false);
    errorTable.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent e) {
            forwardEventToButton(e);
          }

          public void mouseEntered(MouseEvent e) {}

          public void mouseExited(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {}

          public void mouseReleased(MouseEvent e) {}
        });
    tableScrollPane.setViewportView(errorTable);

    // LABEL
    errorLabel.setText(resourceMap.getString("errorLabel.text"));

    javax.swing.GroupLayout showErrorWarningsTypeLayout =
        new javax.swing.GroupLayout(showErrorWarningsPanel);
    showErrorWarningsPanel.setLayout(showErrorWarningsTypeLayout);
    showErrorWarningsTypeLayout.setHorizontalGroup(
        showErrorWarningsTypeLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                showErrorWarningsTypeLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        showErrorWarningsTypeLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(errorLabel)
                            .addComponent(tableScrollPane)
                            .addComponent(closeButton))
                    .addContainerGap()));
    showErrorWarningsTypeLayout.setVerticalGroup(
        showErrorWarningsTypeLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                showErrorWarningsTypeLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(errorLabel)
                    .addComponent(tableScrollPane)
                    .addComponent(closeButton)
                    .addContainerGap()));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        showErrorWarningsPanel,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        showErrorWarningsPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pack();
  }
  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");
  }
Exemplo n.º 7
0
  public JLoadTestAssertionsTable(WsdlLoadTest wsdlLoadTest) {
    super(new BorderLayout());
    this.loadTest = wsdlLoadTest;

    loadTest.addLoadTestListener(internalLoadTestListener);

    tableModel = new LoadTestAssertionsTableModel();
    table = new JXTable(tableModel);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(0).setMaxWidth(16);
    columnModel.getColumn(0).setCellRenderer(new IconTableCellRenderer());
    columnModel.getColumn(1).setPreferredWidth(100);
    columnModel.getColumn(2).setPreferredWidth(100);
    columnModel.getColumn(3).setPreferredWidth(200);

    JScrollPane scrollPane = new JScrollPane(table);
    add(scrollPane, BorderLayout.CENTER);

    table.addMouseListener(
        new MouseAdapter() {

          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() < 2) return;

            int ix = table.getSelectedRow();
            if (ix == -1) return;
            ix = table.convertRowIndexToModel(ix);

            Object obj = loadTest.getAssertionAt(ix);
            if (obj instanceof Configurable) {
              ((Configurable) obj).configure();
            } else Toolkit.getDefaultToolkit().beep();
          }
        });

    add(buildToolbar(), BorderLayout.NORTH);

    table
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              public void valueChanged(ListSelectionEvent e) {
                int ix = table.getSelectedRow();

                configureAssertionAction.setEnabled(ix >= 0);
                removeAssertionAction.setEnabled(ix >= 0);

                if (ix == -1) return;

                ix = table.convertRowIndexToModel(ix);
                configureAssertionAction.setEnabled(
                    loadTest.getAssertionAt(ix) instanceof Configurable);
              }
            });

    assertionPopup = new JPopupMenu();
    assertionPopup.add(configureAssertionAction);
    assertionPopup.addSeparator();
    assertionPopup.add(addLoadTestAssertionAction);
    assertionPopup.add(removeAssertionAction);

    setComponentPopupMenu(assertionPopup);

    scrollPane.setInheritsPopupMenu(true);
    table.setComponentPopupMenu(assertionPopup);
  }
Exemplo n.º 8
0
  private JXPanel getContent() {
    JLabel lab =
        null; //   1                 2     3    4     5     6     7     8     9    10      11  12
              //   13
    FormLayout lay =
        new FormLayout(
            "fill:0:grow(0.5),5dlu,20dlu,60dlu,20dlu,20dlu,60dlu,25dlu,60dlu,25dlu,60dlu,5dlu,5dlu,fill:0:grow(0.5),",
            // 1   2   3    4       5    6  7   8  9   10 11 12 13  14 15  16  17  18 19  20  21
            "15dlu,p,15dlu,80dlu:g,10dlu,p,2dlu,p,2dlu,p,2dlu,p,2dlu,p,2dlu,p,2dlu,p,5dlu,p,15dlu,p,15dlu");
    CellConstraints cc = new CellConstraints();
    this.content = new JXPanel();
    this.content.setOpaque(false);
    this.content.setLayout(lay);

    lab = new JLabel("von..");
    this.content.add(lab, cc.xy(3, 2));
    this.tfs[0] = new JRtaTextField("DATUM", false);
    this.tfs[0].setText(DatFunk.sHeute());
    this.content.add(this.tfs[0], cc.xy(4, 2));

    lab = new JLabel("bis..");
    this.content.add(lab, cc.xy(6, 2));
    this.tfs[1] = new JRtaTextField("DATUM", false);
    this.tfs[1].setText(DatFunk.sHeute());
    this.content.add(this.tfs[1], cc.xy(7, 2));

    this.content.add(
        (this.buts[0] = ButtonTools.macheButton("ermitteln", "ermitteln", al)), cc.xyw(11, 2, 2));

    anmeldemod = new MyAnmeldeTableModel();
    String[] cols = {"angelegt am", "RezeptNr.", "Behandl.Beginn", "angelegt von", "", ""};
    anmeldemod.setColumnIdentifiers(cols);
    anmeldetbl = new JXTable(anmeldemod);
    anmeldetbl.getColumn(4).setMinWidth(0);
    anmeldetbl.getColumn(4).setMaxWidth(0);
    anmeldetbl.getColumn(5).setMinWidth(0);
    anmeldetbl.getColumn(5).setMaxWidth(0);
    anmeldetbl.getColumn(5).setMaxWidth(0);

    anmeldetbl.setEditable(false);
    anmeldetbl.addMouseListener(tblmouse);

    JScrollPane jscr = JCompTools.getTransparentScrollPane(anmeldetbl);
    jscr.validate();
    this.content.add(jscr, cc.xyw(3, 4, 10, CellConstraints.FILL, CellConstraints.DEFAULT));

    lab = new JLabel("Anzahl");
    lab.setForeground(Color.BLUE);
    this.content.add(lab, cc.xy(4, 6, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    lab = new JLabel("Beh.Einheiten");
    lab.setForeground(Color.BLUE);
    this.content.add(lab, cc.xy(7, 6, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    lab = new JLabel("Umsätze");
    lab.setForeground(Color.BLUE);
    this.content.add(lab, cc.xyw(9, 6, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    lab = new JLabel("Minuten");
    lab.setForeground(Color.RED);
    this.content.add(lab, cc.xyw(11, 6, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    this.content.add(
        (kglab[0] = new JLabel("Physio")),
        cc.xyw(3, 8, 2, CellConstraints.LEFT, CellConstraints.DEFAULT));
    this.content.add(
        (kglab[1] = new JLabel("0")), cc.xy(4, 8, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (kglab[2] = new JLabel("0")), cc.xy(7, 8, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (kglab[3] = new JLabel("0,00")),
        cc.xyw(9, 8, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (kglab[4] = new JLabel("0")),
        cc.xyw(11, 8, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    this.content.add(
        (malab[0] = new JLabel("Massage")),
        cc.xyw(3, 10, 2, CellConstraints.LEFT, CellConstraints.DEFAULT));
    this.content.add(
        (malab[1] = new JLabel("0")), cc.xy(4, 10, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (malab[2] = new JLabel("0")), cc.xy(7, 10, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (malab[3] = new JLabel("0,00")),
        cc.xyw(9, 10, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (malab[4] = new JLabel("0")),
        cc.xyw(11, 10, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    this.content.add(
        (erlab[0] = new JLabel("Ergo")),
        cc.xyw(3, 12, 2, CellConstraints.LEFT, CellConstraints.DEFAULT));
    this.content.add(
        (erlab[1] = new JLabel("0")), cc.xy(4, 12, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (erlab[2] = new JLabel("0")), cc.xy(7, 12, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (erlab[3] = new JLabel("0,00")),
        cc.xyw(9, 12, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (erlab[4] = new JLabel("0")),
        cc.xyw(11, 12, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    this.content.add(
        (lolab[0] = new JLabel("Logo")),
        cc.xyw(3, 14, 2, CellConstraints.LEFT, CellConstraints.DEFAULT));
    this.content.add(
        (lolab[1] = new JLabel("0")), cc.xy(4, 14, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (lolab[2] = new JLabel("0")), cc.xy(7, 14, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (lolab[3] = new JLabel("0,00")),
        cc.xyw(9, 14, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (lolab[4] = new JLabel("0")),
        cc.xyw(11, 14, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    this.content.add(
        (rhlab[0] = new JLabel("Reha")),
        cc.xyw(3, 16, 2, CellConstraints.LEFT, CellConstraints.DEFAULT));
    this.content.add(
        (rhlab[1] = new JLabel("0")), cc.xy(4, 16, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (rhlab[2] = new JLabel("0")), cc.xy(7, 16, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (rhlab[3] = new JLabel("0,00")),
        cc.xyw(9, 16, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (rhlab[4] = new JLabel("0")),
        cc.xyw(11, 16, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    this.content.add(
        (polab[0] = new JLabel("Podo")),
        cc.xyw(3, 18, 2, CellConstraints.LEFT, CellConstraints.DEFAULT));
    this.content.add(
        (polab[1] = new JLabel("0")), cc.xy(4, 18, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (polab[2] = new JLabel("0")), cc.xy(7, 18, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (polab[3] = new JLabel("0,00")),
        cc.xyw(9, 18, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        (polab[4] = new JLabel("0")),
        cc.xyw(11, 18, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    summenlab[0] = new JLabel("Summen");
    summenlab[0].setForeground(Color.RED);
    summenlab[1] = new JLabel("0");
    summenlab[1].setForeground(Color.RED);
    summenlab[2] = new JLabel("0");
    summenlab[2].setForeground(Color.RED);
    summenlab[3] = new JLabel("0,00");
    summenlab[3].setForeground(Color.RED);
    summenlab[4] = new JLabel("0");
    summenlab[4].setForeground(Color.RED);

    this.content.add(summenlab[0], cc.xyw(3, 20, 2, CellConstraints.LEFT, CellConstraints.DEFAULT));
    this.content.add(summenlab[1], cc.xy(4, 20, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(summenlab[2], cc.xy(7, 20, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        summenlab[3], cc.xyw(9, 20, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    this.content.add(
        summenlab[4], cc.xyw(11, 20, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    this.content.add(
        (this.buts[1] =
            ButtonTools.macheButton("komplette Rezeptdaten in OO-Calc übertragen", "calc", al)),
        cc.xyw(3, 22, 10, CellConstraints.FILL, CellConstraints.DEFAULT));

    return this.content;
  }
  private void initUI() {
    setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders
    toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    toolBar.setBorderPainted(false);

    toolBar.add(
        new AbstractAction() {

          public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("add");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
              return I18NSupport.getString("parameter.add");
            }

            return super.getValue(key);
          }

          public void actionPerformed(ActionEvent e) {
            add();
          }
        });

    toolBar.add(
        new AbstractAction() {

          public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("add_par");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
              return I18NSupport.getString("parameter.add.from.report");
            }

            return super.getValue(key);
          }

          public void actionPerformed(ActionEvent e) {
            addFromReport();
          }
        });

    toolBar.add(
        new AbstractAction() {

          public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("parameter_clone");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
              return I18NSupport.getString("parameter.add.clone");
            }

            return super.getValue(key);
          }

          public void actionPerformed(ActionEvent e) {
            cloneParameter();
          }
        });

    toolBar.add(
        new AbstractAction() {

          public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("edit");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
              return I18NSupport.getString("parameter.edit");
            }

            return super.getValue(key);
          }

          public void actionPerformed(ActionEvent e) {
            modify();
          }
        });

    toolBar.add(
        new AbstractAction() {

          public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("delete");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
              return I18NSupport.getString("parameter.delete");
            }

            return super.getValue(key);
          }

          public void actionPerformed(ActionEvent e) {
            delete();
          }
        });

    toolBar.add(
        new AbstractAction() {

          public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("parameter_up");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
              return I18NSupport.getString("parameter.up");
            }

            return super.getValue(key);
          }

          public void actionPerformed(ActionEvent e) {
            up();
          }
        });

    toolBar.add(
        new AbstractAction() {

          public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("parameter_down");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
              return I18NSupport.getString("parameter.down");
            }

            return super.getValue(key);
          }

          public void actionPerformed(ActionEvent e) {
            down();
          }
        });

    //        SwingUtil.registerButtonsForFocus(buttonsPanel);

    add(toolBar, BorderLayout.NORTH);

    createTable();
    table
        .getColumnModel()
        .getColumn(1)
        .setCellRenderer(
            new DefaultTableCellRenderer() {

              @Override
              public Component getTableCellRendererComponent(
                  JTable table,
                  Object value,
                  boolean isSelected,
                  boolean hasFocus,
                  int row,
                  int column) {
                super.getTableCellRendererComponent(
                    table, value, isSelected, hasFocus, row, column);
                String tmp = (String) value;
                tmp = tmp.substring(tmp.lastIndexOf('.') + 1);
                /*
                if ("Object".equals(tmp)) {
                	tmp = "Any";
                }
                */
                setText(tmp);

                return this;
              }
            });
    table.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseClicked(MouseEvent event) {
            if (event.getClickCount() == 2) {
              modify();
            }
          }
        });
    table.addKeyListener(
        new KeyAdapter() {

          @Override
          public void keyPressed(KeyEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == KeyEvent.VK_ENTER) {
              modify();
              // don't let anyone else handle the event
              event.consume();
            } else if (keyCode == KeyEvent.VK_INSERT) {
              add();
              // don't let anyone else handle the event
              event.consume();
            } else if (keyCode == KeyEvent.VK_DELETE) {
              delete();
              // don't let anyone else handle the event
              event.consume();
            }
          }
        });
    add(new JScrollPane(table), BorderLayout.CENTER);
    table.setPreferredScrollableViewportSize(new Dimension(250, 200));
  }
Exemplo n.º 10
0
  public DownloadsMDIWindow(final UISubsystem ui) throws Exception {
    super(ui.getMainWindow().getMDIManager(), "downloads", ui);

    table = new JXTable();
    table.setModel(model = new DownloadsTableModel());
    table.setAutoCreateColumnsFromModel(false);
    table.getColumnModel().getColumn(1).setCellRenderer(new ProgressBarCellRenderer());
    table.getColumnModel().getColumn(0).setPreferredWidth(300);
    table.getColumnModel().getColumn(1).setPreferredWidth(80);

    status = (JLabel) xui.getComponent("status");
    downloadingFromText = (JLabel) xui.getComponent("downloadingfromtext");
    uploadingToText = (JLabel) xui.getComponent("uploadingtotext");

    setFixedColumnSize(table.getColumnModel().getColumn(2), 60);
    setFixedColumnSize(table.getColumnModel().getColumn(3), 60);
    setFixedColumnSize(table.getColumnModel().getColumn(4), 60);
    setFixedColumnSize(table.getColumnModel().getColumn(5), 10);

    table.setColumnControlVisible(true);

    downloadGrid = (JDownloadGrid) xui.getComponent("downloadgrid");
    table
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(ListSelectionEvent e) {
                if (e.getFirstIndex() < 0 || e.getFirstIndex() >= rows.size()) {
                  downloadGrid.setDownload(null);
                  updateDownloadingFromAndUploadingToText();
                  return;
                }
                selectDownloadToShowOnDownloadGrid();
                updateDownloadingFromAndUploadingToText();
              }
            });

    table.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseReleased(MouseEvent e) {
            maybeShowPopup(e);
          }

          @Override
          public void mousePressed(MouseEvent e) {
            maybeShowPopup(e);
          }

          @Override
          public void mouseClicked(MouseEvent e) {}

          private void maybeShowPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
              int row = table.rowAtPoint(e.getPoint());
              boolean b = false;
              for (int r : table.getSelectedRows()) {
                if (r == row) {
                  b = true;
                  break;
                }
              }
              if (!b) {
                table.getSelectionModel().setSelectionInterval(row, row);
              }
              popup.show(e.getComponent(), e.getX(), e.getY());
            }
          }
        });

    //        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setColumnSelectionAllowed(false);

    ((JScrollPane) xui.getComponent("scroll")).setViewportView(table);

    popup = (JPopupMenu) xui.getComponent("popup");

    update();

    setTitle("Downloads");
    listenExternalLinks();
    postInit();
  }
Exemplo n.º 11
0
  public AttachmentsView(@Service ApplicationContext context, @Uses AttachmentsModel model) {
    setLayout(new BorderLayout());

    final ActionMap am = context.getActionMap(this);

    this.attachmentsModel = model;
    TableFormat tableFormat = new AttachmentsTableFormatter();
    tableModel = new EventJXTableModel<AttachmentDTO>(attachmentsModel.getEventList(), tableFormat);

    attachments = new JXTable(tableModel);

    attachments.setFocusTraversalKeys(
        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
        KeyboardFocusManager.getCurrentKeyboardFocusManager()
            .getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
    attachments.setFocusTraversalKeys(
        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
        KeyboardFocusManager.getCurrentKeyboardFocusManager()
            .getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));

    attachments.getColumn(0).setPreferredWidth(20);
    attachments.getColumn(0).setMaxWidth(20);
    attachments.getColumn(0).setResizable(false);
    attachments.getColumn(2).setPreferredWidth(100);
    attachments.getColumn(2).setMaxWidth(100);
    attachments.getColumn(3).setPreferredWidth(100);
    attachments.getColumn(3).setMaxWidth(100);

    attachments.setAutoCreateColumnsFromModel(false);

    attachments.addHighlighter(HighlighterFactory.createAlternateStriping());

    attachments.setModel(tableModel);
    attachments.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JPanel toolbar = new JPanel();
    StreamflowButton addButton = new StreamflowButton(am.get("add"));
    toolbar.add(addButton);
    StreamflowButton removeButton = new StreamflowButton(am.get("remove"));
    toolbar.add(removeButton);
    final StreamflowButton openButton = new StreamflowButton(am.get("open"));
    toolbar.add(openButton);
    attachments
        .getSelectionModel()
        .addListSelectionListener(new SelectionActionEnabler(am.get("open")));
    attachments
        .getSelectionModel()
        .addListSelectionListener(
            new SelectionActionEnabler(am.get("remove")) {

              @Override
              public boolean isSelectedValueValid(javax.swing.Action action) {
                return !attachments
                    .getValueAt(attachments.convertRowIndexToModel(attachments.getSelectedRow()), 0)
                    .equals(Icons.formSubmitted);
              }
            });

    attachmentsModel.addObserver(
        new RefreshComponents().visibleOn("createattachment", addButton, removeButton));

    attachments.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "open");
    attachments.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "remove");
    attachments.setActionMap(am);

    attachments.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent me) {
            int obj = attachments.getSelectedRow();
            if (obj == -1) return;
            if (me.getClickCount() == 2) {
              am.get("open")
                  .actionPerformed(
                      new ActionEvent(openButton, ActionEvent.ACTION_PERFORMED, "open"));
              me.consume();
            }
          }
        });

    attachments
        .getColumn(0)
        .setCellRenderer(
            new DefaultTableCellRenderer() {
              @Override
              public Component getTableCellRendererComponent(
                  JTable table,
                  Object value,
                  boolean isSelected,
                  boolean hasFocus,
                  int row,
                  int column) {

                JLabel iconLabel = new JLabel(" ");
                switch ((Icons) value) {
                  case attachments:
                    iconLabel = new JLabel(i18n.icon((Icons) value, 11));
                    break;

                  case conversations:
                    iconLabel = new JLabel(i18n.icon((Icons) value, 11));
                    break;

                  case formSubmitted:
                    iconLabel = new JLabel(i18n.icon((Icons) value, 11));
                    break;
                }

                iconLabel.setOpaque(true);

                if (isSelected) iconLabel.setBackground(attachments.getSelectionBackground());
                return iconLabel;
              }
            });

    JScrollPane attachmentsScrollPane = new JScrollPane(attachments);

    add(attachmentsScrollPane, BorderLayout.CENTER);
    add(toolbar, BorderLayout.SOUTH);

    new RefreshWhenShowing(this, attachmentsModel);
  }