@Override public void setEnabled(final boolean b) { txtErfassungsdatum.setEditable(b); txtBemerkung.setEditable(b); chkSperre.setEnabled(b); txtSearch.setEnabled(!b); btnSearch.setEnabled(!b); if (b) { txtBemerkung.setBackground(java.awt.Color.white); } else { txtBemerkung.setBackground(this.getBackground()); } }
/** * former synchronized method. * * @param kz DOCUMENT ME! * @param historyEnabled DOCUMENT ME! */ public void gotoKassenzeichen(final String kz, final boolean historyEnabled) { boolean refreshFlag = false; final String[] test = kz.split(":"); final String kassenzeichenNummer; final String flaechenBez; if (test.length > 1) { kassenzeichenNummer = test[0]; flaechenBez = test[1]; } else { kassenzeichenNummer = kz; flaechenBez = ""; } if (kassenzeichenNummer.trim().equals(txtKassenzeichen.getText().trim())) { refreshFlag = true; } if ((mainApp.changesPending() == false) || (refreshFlag == true)) { mainApp.disableKassenzeichenCmds(); txtSearch.setEnabled(false); btnSearch.setEnabled(false); setKZSearchField(kz); new SwingWorker<CidsBean, Void>() { @Override protected CidsBean doInBackground() throws Exception { return CidsAppBackend.getInstance() .loadKassenzeichenByNummer(Integer.parseInt(kassenzeichenNummer)); } @Override protected void done() { try { final CidsBean cidsBean = get(); if (cidsBean != null) { CidsAppBackend.getInstance().setCidsBean(cidsBean); selectFlaecheByBez(flaechenBez); flashSearchField(Color.GREEN); if (historyEnabled) { historyModel.addToHistory(kz); } } else { flashSearchField(Color.RED); } } catch (Exception e) { LOG.error("Exception in Background Thread", e); flashSearchField(Color.RED); mainApp.enableEditing(false); } txtSearch.setEnabled(true); btnSearch.setEnabled(true); mainApp.refreshLeftTitleBarColor(); mainApp.refreshKassenzeichenButtons(); mainApp.refreshClipboardButtons(); mainApp.refreshItemButtons(); } }.execute(); } else { JOptionPane.showMessageDialog( mainApp, "Das Kassenzeichen kann nur gewechselt werden wenn alle \u00C4nderungen gespeichert oder verworfen worden sind.", "Wechseln nicht m\u00F6glich", JOptionPane.WARNING_MESSAGE); } }
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); btgMode = new javax.swing.ButtonGroup(); lblLastModification = new javax.swing.JLabel(); panSearch = new javax.swing.JPanel(); txtSearch = new javax.swing.JTextField(); lblSuche = new javax.swing.JLabel(); btnSearch = new javax.swing.JButton(); panKZValues = new javax.swing.JPanel(); lblKassenzeichen = new javax.swing.JLabel(); lblErfassungsdatum = new javax.swing.JLabel(); lblBemerkung = new javax.swing.JLabel(); lblSperre = new javax.swing.JLabel(); txtErfassungsdatum = new javax.swing.JTextField(); chkSperre = new javax.swing.JCheckBox(); scpBemerkung = new javax.swing.JScrollPane(); txtBemerkung = new javax.swing.JTextArea(); txtKassenzeichen = new javax.swing.JTextField(); txtSperreBemerkung = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); togRegenMode = new javax.swing.JToggleButton(); togWDSRMode = new javax.swing.JToggleButton(); togInfoMode = new javax.swing.JToggleButton(); sepTitle1 = new javax.swing.JSeparator(); sepTitle2 = new javax.swing.JSeparator(); lblLastModification.setIcon( new javax.swing.ImageIcon( getClass().getResource("/de/cismet/verdis/res/images/titlebars/goto.png"))); // NOI18N org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${cidsBean.letzte_aenderung_von}"), lblLastModification, org.jdesktop.beansbinding.BeanProperty.create("toolTipText")); bindingGroup.addBinding(binding); setLayout(new java.awt.GridBagLayout()); panSearch.setLayout(new java.awt.GridBagLayout()); txtSearch.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { txtSearchActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); panSearch.add(txtSearch, gridBagConstraints); lblSuche.setText("Kassenzeichen"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); panSearch.add(lblSuche, gridBagConstraints); btnSearch.setMnemonic('s'); btnSearch.setText("suchen"); btnSearch.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { btnSearchActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); panSearch.add(btnSearch, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(7, 7, 7, 7); add(panSearch, gridBagConstraints); panKZValues.setLayout(new java.awt.GridBagLayout()); lblKassenzeichen.setText("Kassenzeichen"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; panKZValues.add(lblKassenzeichen, gridBagConstraints); lblErfassungsdatum.setText("Datum der Erfassung"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; panKZValues.add(lblErfassungsdatum, gridBagConstraints); lblBemerkung.setText("Bemerkung"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; panKZValues.add(lblBemerkung, gridBagConstraints); lblSperre.setText("Veranlagung gesperrt"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; panKZValues.add(lblSperre, gridBagConstraints); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${cidsBean.datum_erfassung}"), txtErfassungsdatum, org.jdesktop.beansbinding.BeanProperty.create("text"), KassenzeichenPropertyConstants.PROP__DATUM_ERFASSUNG); binding.setConverter(new SqlDateToStringConverter()); bindingGroup.addBinding(binding); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0); panKZValues.add(txtErfassungsdatum, gridBagConstraints); chkSperre.setForeground(java.awt.Color.red); chkSperre.setEnabled(false); chkSperre.setFocusPainted(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${cidsBean.sperre}"), chkSperre, org.jdesktop.beansbinding.BeanProperty.create("selected")); bindingGroup.addBinding(binding); chkSperre.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { chkSperreActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0); panKZValues.add(chkSperre, gridBagConstraints); scpBemerkung.setHorizontalScrollBarPolicy( javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scpBemerkung.setVerticalScrollBarPolicy( javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); scpBemerkung.setMinimumSize(new java.awt.Dimension(6, 36)); txtBemerkung.setColumns(3); txtBemerkung.setLineWrap(true); txtBemerkung.setRows(3); txtBemerkung.setMinimumSize(new java.awt.Dimension(0, 36)); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${cidsBean.bemerkung}"), txtBemerkung, org.jdesktop.beansbinding.BeanProperty.create("text"), KassenzeichenPropertyConstants.PROP__BEMERKUNG); bindingGroup.addBinding(binding); scpBemerkung.setViewportView(txtBemerkung); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0); panKZValues.add(scpBemerkung, gridBagConstraints); txtKassenzeichen.setEditable(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${cidsBean.kassenzeichennummer8}"), txtKassenzeichen, org.jdesktop.beansbinding.BeanProperty.create("text"), KassenzeichenPropertyConstants.PROP__KASSENZEICHENNUMMER); bindingGroup.addBinding(binding); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 3, 0); panKZValues.add(txtKassenzeichen, gridBagConstraints); txtSperreBemerkung.setBackground(getBackground()); txtSperreBemerkung.setEditable(false); txtSperreBemerkung.setForeground(java.awt.Color.red); txtSperreBemerkung.setBorder(null); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${cidsBean.bemerkung_sperre}"), txtSperreBemerkung, org.jdesktop.beansbinding.BeanProperty.create("text"), KassenzeichenPropertyConstants.PROP__BEMERKUNG_SPERRE); bindingGroup.addBinding(binding); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0); panKZValues.add(txtSperreBemerkung, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(7, 7, 7, 7); add(panKZValues, gridBagConstraints); jPanel2.setLayout(new java.awt.GridBagLayout()); jLabel2.setText("Modus"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; jPanel2.add(jLabel2, gridBagConstraints); btgMode.add(togRegenMode); togRegenMode.setIcon( new javax.swing.ImageIcon( getClass().getResource("/de/cismet/verdis/res/regen_gr.png"))); // NOI18N togRegenMode.setToolTipText("Versiegelte Flächen"); togRegenMode.setFocusable(false); togRegenMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); togRegenMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); togRegenMode.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { togRegenModeActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; jPanel2.add(togRegenMode, gridBagConstraints); btgMode.add(togWDSRMode); togWDSRMode.setIcon( new javax.swing.ImageIcon( getClass().getResource("/de/cismet/verdis/res/esw_gr.png"))); // NOI18N togWDSRMode.setToolTipText("ESW"); togWDSRMode.setFocusable(false); togWDSRMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); togWDSRMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); togWDSRMode.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { togWDSRModeActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); jPanel2.add(togWDSRMode, gridBagConstraints); btgMode.add(togInfoMode); togInfoMode.setIcon( new javax.swing.ImageIcon( getClass().getResource("/de/cismet/verdis/res/info_gr.png"))); // NOI18N togInfoMode.setSelected(true); togInfoMode.setToolTipText("Info"); togInfoMode.setFocusable(false); togInfoMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); togInfoMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); togInfoMode.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { togInfoModeActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; jPanel2.add(togInfoMode, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 7, 3, 7); add(jPanel2, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 1.0; add(sepTitle1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 1.0; add(sepTitle2, gridBagConstraints); bindingGroup.bind(); } // </editor-fold>//GEN-END:initComponents