public void actionOk() { boolean passwordSet = false; String passwordOld = new String(jpfPasswordOld.getPassword()); String passwordNew = new String(jpfPasswordNew.getPassword()); String passwordConfirm = new String(jpfPasswordConfirm.getPassword()); if (passwordOld.length() == 0) { miClient.showMsgBoxWarning( DGuiConsts.ERR_MSG_FIELD_REQ + "'" + DGuiUtils.getLabelName(jlPasswordOld.getText()) + "'."); jpfPasswordOld.requestFocus(); } else if (passwordNew.length() == 0) { miClient.showMsgBoxWarning( DGuiConsts.ERR_MSG_FIELD_REQ + "'" + DGuiUtils.getLabelName(jlPasswordNew.getText()) + "'."); jpfPasswordNew.requestFocus(); } else if (passwordConfirm.length() == 0) { miClient.showMsgBoxWarning( DGuiConsts.ERR_MSG_FIELD_REQ + "'" + DGuiUtils.getLabelName(jlPasswordConfirm.getText()) + "'."); jpfPasswordConfirm.requestFocus(); } else if (passwordNew.compareTo(passwordConfirm) != 0) { miClient.showMsgBoxWarning( DGuiConsts.ERR_MSG_FIELD_REQ_EQUAL + "'" + DGuiUtils.getLabelName(jlPasswordNew.getText()) + "', '" + DGuiUtils.getLabelName(jlPasswordConfirm.getText()) + "'."); jpfPasswordOld.requestFocus(); resetPasswords(); } else { try { passwordSet = DUtilUtils.processNewPassword(miClient, passwordOld, passwordNew); } catch (SQLException e) { DLibUtils.showException(this, e); } catch (Exception e) { DLibUtils.showException(this, e); } finally { if (!passwordSet) { resetPasswords(); jpfPasswordOld.requestFocus(); } } } if (passwordSet) { mnFormResult = DGuiConsts.FORM_RESULT_OK; dispose(); } }
@Override public void compute(final DGuiSession session) { readRegMembers(session, true); readXtaMembers(session); mdMass_r = DLibUtils.round( mdMassUnit * mdQuantity, DLibUtils.getDecimalFormatQuantity().getMaximumFractionDigits()); mdMassSolid_r = DLibUtils.round( mdMass_r * (mdBrix / DCfgConsts.BRIX_MAX), DLibUtils.getDecimalFormatQuantity().getMaximumFractionDigits()); }
@Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { String labelValue = "?"; if (value != null) { for (DGridCellKeyValue keyValue : mvKeyValues) { if (DLibUtils.compareKeys((int[]) value, keyValue.Key)) { labelValue = keyValue.Value; break; } } } moLabel.setText(labelValue); if (isSelected) { if (table.isCellEditable(row, col)) { moLabel.setForeground(DGridConsts.COLOR_FG_EDIT); moLabel.setBackground( hasFocus ? DGridConsts.COLOR_BG_SELECT_EDIT_FOCUS : DGridConsts.COLOR_BG_SELECT_EDIT); } else { moLabel.setForeground(DGridConsts.COLOR_FG_READ); moLabel.setBackground( hasFocus ? DGridConsts.COLOR_BG_SELECT_READ_FOCUS : DGridConsts.COLOR_BG_SELECT_READ); } } else { if (table.isCellEditable(row, col)) { moLabel.setForeground(DGridConsts.COLOR_FG_EDIT); moLabel.setBackground(DGridConsts.COLOR_BG_PLAIN_EDIT); } else { moLabel.setForeground(DGridConsts.COLOR_FG_READ); moLabel.setBackground(DGridConsts.COLOR_BG_PLAIN_READ); } } return moLabel; }