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; }
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; }
/** Initialize the GUI */ private void init() { setLayout(new BorderLayout(0, 0)); JPanel panelMain = new JPanel(); add(panelMain, BorderLayout.CENTER); panelMain.setLayout(new MigLayout("", "[grow]", "[grow]")); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); panelMain.add(scrollPane, "cell 0 0,grow"); table = new JXTable() { private static final long serialVersionUID = 1L; public void changeSelection( final int row, final int column, boolean toggle, boolean extend) { super.changeSelection(row, column, toggle, extend); if (table.isCellEditable(row, column)) { editCellAt(row, column); } } }; table.setHorizontalScrollEnabled(true); table.setColumnControlVisible(true); model = new SeriesIdentityTableModel(containerFrame); SeriesIdentityTableCellRenderer renderer = new SeriesIdentityTableCellRenderer(); table.setModel(model); table.getColumn(3).setCellRenderer(renderer); table.getColumn(4).setCellRenderer(renderer); table.getColumn(5).setCellRenderer(renderer); table.getColumn(6).setCellRenderer(renderer); table.getColumn(7).setCellRenderer(renderer); table.getColumn(8).setCellRenderer(renderer); table.getColumnExt(4).setIdentifier("SubObjectColumn"); table.getColumnExt("SubObjectColumn").setVisible(false); table .getColumnModel() .addColumnModelListener( new TableColumnModelListener() { @Override public void columnAdded(TableColumnModelEvent arg0) { chkIncludeSubobjects.setSelected(table.getColumnExt("SubObjectColumn").isVisible()); } @Override public void columnMarginChanged(ChangeEvent arg0) { // TODO Auto-generated method stub } @Override public void columnMoved(TableColumnModelEvent arg0) { // TODO Auto-generated method stub } @Override public void columnRemoved(TableColumnModelEvent arg0) { chkIncludeSubobjects.setSelected(table.getColumnExt("SubObjectColumn").isVisible()); } @Override public void columnSelectionChanged(ListSelectionEvent arg0) { // TODO Auto-generated method stub } }); scrollPane.setViewportView(table); JPanel panelButton = new JPanel(); add(panelButton, BorderLayout.SOUTH); panelButton.setLayout(new MigLayout("", "[grow][][]", "[grow][grow][][][]")); model.addTableModelListener(this); JPanel panel = new JPanel(); panelButton.add(panel, "cell 0 1 1 2,grow"); panel.setLayout(new MigLayout("", "[31px][162px]", "[16px][][]")); JLabel lblKey = new JLabel("Key:"); panel.add(lblKey, "cell 0 0,alignx left,aligny top"); JLabel lblPresentIn = new JLabel("= Present in database"); lblPresentIn.setFont(new Font("Dialog", Font.PLAIN, 12)); lblPresentIn.setIcon(Builder.getIcon("found.png", 16)); panel.add(lblPresentIn, "flowy,cell 1 0,alignx left,aligny top"); JLabel lblAbsentFrom = new JLabel("= Absent from database"); lblAbsentFrom.setFont(new Font("Dialog", Font.PLAIN, 12)); lblAbsentFrom.setIcon(Builder.getIcon("missing.png", 16)); panel.add(lblAbsentFrom, "cell 1 1,alignx left,aligny top"); JLabel lblNotYet = new JLabel("= Not yet searched"); lblNotYet.setFont(new Font("Dialog", Font.PLAIN, 12)); lblNotYet.setIcon(Builder.getIcon("wait.png", 16)); panel.add(lblNotYet, "cell 1 2,alignx left,aligny top"); JPanel panel_1 = new JPanel(); panelButton.add(panel_1, "cell 1 1 2 2,alignx right,growy"); panel_1.setLayout(new MigLayout("", "[116px,fill]", "[22px][][][]")); JButton btnSearchDB = new JButton("Search Database"); btnSearchDB.setFont(new Font("Dialog", Font.BOLD, 9)); panel_1.add(btnSearchDB, "cell 0 0,alignx left,aligny top"); btnSearchDB.setActionCommand("SearchDB"); JButton btnDefineByPattern = new JButton("Define names by pattern"); btnDefineByPattern.setFont(new Font("Dialog", Font.BOLD, 9)); panel_1.add(btnDefineByPattern, "cell 0 1,alignx left,aligny top"); btnDefineByPattern.setActionCommand("DefineByPattern"); JButton btnGenerateMissing = new JButton("Generate missing entities"); btnGenerateMissing.setActionCommand("GenerateMissing"); btnGenerateMissing.addActionListener(this); JButton btnSetDefaults = new JButton("Set default parameters"); btnSetDefaults.setActionCommand("SetDefaults"); btnSetDefaults.addActionListener(this); btnSetDefaults.setFont(new Font("Dialog", Font.BOLD, 9)); panel_1.add(btnSetDefaults, "cell 0 2"); btnGenerateMissing.setFont(new Font("Dialog", Font.BOLD, 9)); panel_1.add(btnGenerateMissing, "flowy,cell 0 3"); btnDefineByPattern.addActionListener(this); btnSearchDB.addActionListener(this); chkIncludeSubobjects = new JCheckBox("Include sub-objects in import"); chkIncludeSubobjects.addActionListener(this); chkIncludeSubobjects.setActionCommand("IncludeExcludeSubObjects"); panelButton.add(chkIncludeSubobjects, "cell 0 3"); chckbxOpenSeriesIn = new JCheckBox("Open series in editor when finished"); chckbxOpenSeriesIn.setSelected(true); panelButton.add(chckbxOpenSeriesIn, "cell 0 4"); }
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 JPanel getForm() { try { // 1 2 3 4 5 1 2 3 4 5 FormLayout lay = new FormLayout("0dlu,10dlu,fill:0:grow(1.0),10dlu,0dlu", "10dlu,100dlu,5dlu,p,5dlu"); PanelBuilder pb = new PanelBuilder(lay); pb.getPanel().setOpaque(false); CellConstraints cc = new CellConstraints(); atblm = new MyArztTableModel(); atblm.setColumnIdentifiers( new String[] {"Drucken", "Name", "Vorname", "Strasse", "Ort", "LANR", "BSNR", ""}); arzttbl = new JXTable(atblm); arzttbl.getColumn(0).setMaxWidth(30); arzttbl.getColumn(7).setMinWidth(0); arzttbl.getColumn(7).setMaxWidth(0); arzttbl.validate(); JScrollPane jscr = JCompTools.getTransparentScrollPane(arzttbl); jscr.validate(); pb.add(jscr, cc.xy(3, 2, CellConstraints.FILL, CellConstraints.DEFAULT)); FormLayout lay2 = new FormLayout( "fill:0:grow(0.33),150dlu,fill:0:grow(0.33),150dlu,fill:0:grow(0.33)", "5dlu,p,5dlu"); PanelBuilder pb2 = new PanelBuilder(lay2); pb2.getPanel().setOpaque(false); CellConstraints cc2 = new CellConstraints(); buts[0] = new JButton("Auswahl übernehmen"); buts[0].setActionCommand("uebernehmen"); buts[0].addActionListener(this); pb2.add(buts[0], cc2.xy(2, 2)); buts[1] = new JButton("neuen Arzt aufnehmen"); buts[1].setActionCommand("zusatz"); buts[1].addActionListener(this); pb2.add(buts[1], cc2.xy(4, 2)); pb2.getPanel().validate(); pb.add(pb2.getPanel(), cc.xy(3, 4)); pb.getPanel().validate(); new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { try { ladeTabelle(); Reha.thisClass.progressStarten(false); } catch (Exception ex) { ex.printStackTrace(); } return null; } }.execute(); return pb.getPanel(); } catch (Exception ex) { ex.printStackTrace(); } return null; }
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); }