/** * Determines whether the specified <code>Component</code> is an acceptable choice as the new * focus owner. This method performs the following sequence of operations: * * <ol> * <li>Checks whether <code>aComponent</code> is visible, displayable, enabled, and focusable. * If any of these properties is <code>false</code>, this method returns <code>false</code>. * <li>If <code>aComponent</code> is an instance of <code>JTable</code>, returns <code>true * </code>. * <li>If <code>aComponent</code> is an instance of <code>JComboBox</code>, then returns the * value of <code>aComponent.getUI().isFocusTraversable(aComponent)</code>. * <li>If <code>aComponent</code> is a <code>JComponent</code> with a <code> * JComponent.WHEN_FOCUSED</code> <code>InputMap</code> that is neither <code>null</code> * nor empty, returns <code>true</code>. * <li>Returns the value of <code>DefaultFocusTraversalPolicy.accept(aComponent)</code>. * </ol> * * @param aComponent the <code>Component</code> whose fitness as a focus owner is to be tested * @see java.awt.Component#isVisible * @see java.awt.Component#isDisplayable * @see java.awt.Component#isEnabled * @see java.awt.Component#isFocusable * @see javax.swing.plaf.ComboBoxUI#isFocusTraversable * @see javax.swing.JComponent#getInputMap() * @see java.awt.DefaultFocusTraversalPolicy#accept * @return <code>true</code> if <code>aComponent</code> is a valid choice for a focus owner; * otherwise <code>false</code> */ protected boolean accept(Component aComponent) { if (!super.accept(aComponent)) return false; // TabbedPane if (aComponent instanceof JTabbedPane) return false; // R/O Editors if (aComponent instanceof CEditor) { CEditor ed = (CEditor) aComponent; if (!ed.isReadWrite()) return false; if (m_default // get Default Focus && ("AD_Client_ID".equals(aComponent.getName()) || "AD_Org_ID".equals(aComponent.getName()))) return false; } // Toolbar Buttons if (aComponent.getParent() instanceof JToolBar) return false; // return true; } // accept
/** Update which fields status (read-only/read-write) based on New ASI/Edit ASI checkbox. */ private final void cmd_newEdit() { final boolean rw = cbNewEdit.isSelected(); log.config("R/W=" + rw + " " + asiTemplate); // Lot final boolean isNewLot = asiTemplate == null || asiTemplate.getM_Lot_ID() <= 0; fieldLotString.setEditable(rw && isNewLot); if (fieldLot != null) { fieldLot.setReadWrite(rw); } bLot.setReadWrite(rw); // Serial No fieldSerNo.setReadWrite(rw); bSerNo.setReadWrite(rw); // Guarantee Date fieldGuaranteeDate.setReadWrite(rw); // Attribute Editors for (final CEditor editor : attributeId2editor.values()) { editor.setReadWrite(rw); } } // cmd_newEdit