表头颜色处理类
package nc.ui.srmsm.supplierbaschgpf.maintain.util;
import nc.ui.bill.tools.ColorConstants;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillItem;
import nc.ui.srmpub.util.HeadUIPanelUtil;
import nc.vo.bd.supplier.SupplierVO;
import nc.vo.bd.supplierext.entity.SupplierExtHVO;
import nc.vo.bd.supplierext.entity.SupplierExtVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFConst;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFVO;
public class HeadColorUtil {
private final static int COLOR_UPDATEITEM = ColorConstants.COLOR_RED;
public void colorAction(BillCardPanel panel, String pk_supplier,
SupplierVO supvo, SupplierExtVO extvo) {
this.paintSupplierBasInfo(pk_supplier, supvo, panel);
this.paintSupplierExtInfo(pk_supplier, extvo, panel);
}
public void paintSupplierBasInfo(String pk_supplier, SupplierVO supvo,
BillCardPanel panel) {
if (null != supvo) {
HeadUIPanelUtil.resetColorHeadItems(panel, supvo,
HeadColorUtil.COLOR_UPDATEITEM, SupplierBasChgPFConst.BASETABLECODE);
}
else {
SupplierVO[] suppliervos =
CommonHelper.querySupplierByPkSupplier(pk_supplier);
if (null == suppliervos) {
return;
}
SupplierBasChgPFVO[] basChgVos =
VOTransfer.chgSupplierVOToSupplierBasChgPFVO(suppliervos);
HeadUIPanelUtil.resetColorHeadItems(panel, basChgVos[0],
HeadColorUtil.COLOR_UPDATEITEM, SupplierBasChgPFConst.BASETABLECODE);
}
BillItem supplierItem = panel.getHeadItem(SupplierBasChgPFVO.PK_SUPPLIER);
supplierItem.setForeground(ColorConstants.COLOR_DEFAULT);
}
public void paintSupplierExtInfo(String pk_supplier, SupplierExtVO extvo,
BillCardPanel panel) {
this.resetColorSupplierExt(panel);
SupplierExtHVO exthvo = null;
if (null != extvo) {
exthvo = extvo.getParentVO();
}
else {
SupplierExtVO queryvo =
CommonHelper.querySupplierExtByByPkSupplier(pk_supplier, null, null);
exthvo = queryvo == null ? null : queryvo.getParentVO();
}
if (null == exthvo) {
exthvo = new SupplierExtHVO();
}
HeadUIPanelUtil.resetColorHeadItems(panel, exthvo,
HeadColorUtil.COLOR_UPDATEITEM, SupplierBasChgPFConst.EXTTABLECODE);
}
public void resetColorAction(BillCardPanel panel) {
HeadUIPanelUtil.resetColorHeadItems(panel, ColorConstants.COLOR_DEFAULT);
}
private void resetColorSupplierExt(BillCardPanel panel) {
String[] extableCodes =
new String[] {
"supplierext", "supplierorder", "supplierdescribe", "suppliersale",
"supplierbas", "supplierservice"
};
this.resetColorSupplierExt(panel, extableCodes);
}
private void resetColorSupplierExt(BillCardPanel panel, String[] tableCodes) {
for (String tablecode : tableCodes) {
BillItem[] items = panel.getHeadShowItems(tablecode);
if (items != null) {
for (BillItem item : items) {
item.setForeground(ColorConstants.COLOR_DEFAULT);
}
}
}
}
}
表体颜色处理类
package nc.ui.srmsm.supplierbaschgpf.maintain.util;
import java.awt.Color;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillItem;
import nc.ui.pub.bill.BillScrollPane;
import nc.ui.srmpub.util.BodyUIPanelUtil;
import nc.vo.bd.bankaccount.BankAccbasVO;
import nc.vo.bd.supplierext.entity.SupplierExtAVO;
import nc.vo.bd.supplierext.entity.SupplierExtIVO;
import nc.vo.bd.supplierext.entity.SupplierExtPVO;
import nc.vo.bd.supplierext.entity.SupplierExtQVO;
import nc.vo.bd.supplierext.entity.SupplierExtVO;
import nc.vo.srmpub.util.SRMBaseUtil;
import nc.vo.srmsm.supplierbaschgpf.entity.AggSupplierBasChgPFVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFAVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFBVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFIVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFPVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFQVO;
public class BodyColorUtil {
private final static Color COLOR_DEFAULT = Color.BLACK;
private final static Color COLOR_INSERT = Color.ORANGE;
private final static Color COLOR_UPDATE = Color.RED;
public void clearBodyUIPanel(BillCardPanel panel) {
BodyUIPanelUtil.clearBodyUIPanel(panel,
SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P);
BodyUIPanelUtil.clearBodyUIPanel(panel,
SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q);
BodyUIPanelUtil.clearBodyUIPanel(panel,
SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I);
BodyUIPanelUtil.clearBodyUIPanel(panel,
SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B);
BodyUIPanelUtil.clearBodyUIPanel(panel,
SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A);
}
public void colorAction(BillCardPanel panel, AggSupplierBasChgPFVO aggvo) {
String pk_supplier = aggvo.getParentVO().getPk_supplier();
BankAccbasVO[] bankvos =
CommonHelper.queryBankAccbasVOByPkSupplier(pk_supplier);
if (SRMBaseUtil.isArrayElementsNull(bankvos)) {
SupplierBasChgPFBVO[] basChgBvos = aggvo.getSupplierBasChgPFBVO();
this.changeToSupplierBasB(panel, basChgBvos);
}
else {
SupplierBasChgPFBVO[] basChgBvos =
VOTransfer.chgBankAccbacVOToSupplierBasChgPFBVO(bankvos);
this.changeToSupplierBasB(panel, basChgBvos);
}
SupplierExtVO extVO =
CommonHelper.querySupplierExtByByPkSupplier(pk_supplier, null, null);
if (SRMBaseUtil.isObjectNullValue(extVO)) {
this.changeToSupplierExtP(panel, null);
this.changeToSupplierExtQ(panel, null);
this.changeToSupplierExtI(panel, null);
this.changeToSupplierExtA(panel, null);
return;
}
SupplierExtPVO[] extPVOs = extVO.getSupplierExtPVO();
SupplierBasChgPFPVO[] oldBasChgPvos =
VOTransfer.chgSupplierExtPVOToSupplierBasChgPFPVO(extPVOs);
this.changeToSupplierExtP(panel, oldBasChgPvos);
SupplierExtQVO[] extQVOs = extVO.getSupplierExtQVO();
SupplierBasChgPFQVO[] oldBasChgQvos =
VOTransfer.chgSupplierExtQVOToSupplierBasChgPFQVO(extQVOs);
this.changeToSupplierExtQ(panel, oldBasChgQvos);
SupplierExtIVO[] extIVOs = extVO.getSupplierExtIVO();
SupplierBasChgPFIVO[] oldBasChgIvos =
VOTransfer.chgSupplierExtIVOToSupplierBasChgPFIVO(extIVOs);
this.changeToSupplierExtI(panel, oldBasChgIvos);
SupplierExtAVO[] extAVOs = extVO.getSupplierExtAVO();
SupplierBasChgPFAVO[] oldBasChgAvos =
VOTransfer.chgSupplierExtAVOToSupplierBasChgPFAVO(extAVOs);
this.changeToSupplierExtA(panel, oldBasChgAvos);
}
public void colorAction(BillCardPanel panel, BankAccbasVO[] bankvos,
SupplierExtVO extVO) {
SupplierBasChgPFBVO[] basChgBvos =
VOTransfer.chgBankAccbacVOToSupplierBasChgPFBVO(bankvos);
this.changeToSupplierBasB(panel, basChgBvos);
SupplierExtPVO[] extPVOs = extVO.getSupplierExtPVO();
SupplierBasChgPFPVO[] basChgPvos =
VOTransfer.chgSupplierExtPVOToSupplierBasChgPFPVO(extPVOs);
this.changeToSupplierExtP(panel, basChgPvos);
SupplierExtQVO[] extQVOs = extVO.getSupplierExtQVO();
SupplierBasChgPFQVO[] basChgQvos =
VOTransfer.chgSupplierExtQVOToSupplierBasChgPFQVO(extQVOs);
this.changeToSupplierExtQ(panel, basChgQvos);
SupplierExtIVO[] extIVOs = extVO.getSupplierExtIVO();
SupplierBasChgPFIVO[] basChgIvos =
VOTransfer.chgSupplierExtIVOToSupplierBasChgPFIVO(extIVOs);
this.changeToSupplierExtI(panel, basChgIvos);
SupplierExtAVO[] extAVOs = extVO.getSupplierExtAVO();
SupplierBasChgPFAVO[] basChgAvos =
VOTransfer.chgSupplierExtAVOToSupplierBasChgPFAVO(extAVOs);
this.changeToSupplierExtA(panel, basChgAvos);
}
public void resetColorAction(BillCardPanel panel) {
BodyUIPanelUtil.resetColorAction(panel,
SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P, BodyColorUtil.COLOR_DEFAULT);
BodyUIPanelUtil.resetColorAction(panel,
SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q, BodyColorUtil.COLOR_DEFAULT);
BodyUIPanelUtil.resetColorAction(panel,
SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I, BodyColorUtil.COLOR_DEFAULT);
BodyUIPanelUtil.resetColorAction(panel,
SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B, BodyColorUtil.COLOR_DEFAULT);
BodyUIPanelUtil.resetColorAction(panel,
SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A, BodyColorUtil.COLOR_DEFAULT);
}
private void changeToSupplierBasB(BillCardPanel panel,
SupplierBasChgPFBVO[] basChgBvos) {
BillScrollPane pane =
panel.getBodyPanel(SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B);
BillItem[] showItems =
panel.getBillData().getBodyShowItems(
SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B);
int rowcount = pane.getTable().getRowCount();
if (SRMBaseUtil.isArrayElementsNull(basChgBvos)) {
for (int i = 0; i < rowcount; i++) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
return;
}
for (int i = 0; i < rowcount; i++) {
Object pk_supplierbankacc =
pane.getTableModel().getValueAt(i,
SupplierBasChgPFBVO.PK_SUPPLIERBANKACC);
if (null == pk_supplierbankacc) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
else {
for (SupplierBasChgPFBVO bvo : basChgBvos) {
if (bvo.getPk_supplierbankacc().equals(pk_supplierbankacc)) {
BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B, bvo,
BodyColorUtil.COLOR_UPDATE);
break;
}
}
}
}
}
private void changeToSupplierExtA(BillCardPanel panel,
SupplierBasChgPFAVO[] basChgAvos) {
BillScrollPane pane =
panel.getBodyPanel(SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A);
BillItem[] showItems =
panel.getBillData().getBodyShowItems(
SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A);
int rowcount = pane.getTable().getRowCount();
if (SRMBaseUtil.isArrayElementsNull(basChgAvos)) {
for (int i = 0; i < rowcount; i++) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
return;
}
for (int i = 0; i < rowcount; i++) {
Object pk_supplierext_a =
pane.getTableModel().getValueAt(i,
SupplierBasChgPFAVO.PK_SUPPLIEREXT_A);
if (null == pk_supplierext_a) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
else {
for (SupplierBasChgPFAVO avo : basChgAvos) {
if (avo.getPk_supplierext_a().equals(pk_supplierext_a)) {
BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A, avo,
BodyColorUtil.COLOR_UPDATE);
break;
}
}
}
}
}
private void changeToSupplierExtI(BillCardPanel panel,
SupplierBasChgPFIVO[] basChgIvos) {
BillScrollPane pane =
panel.getBodyPanel(SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I);
BillItem[] showItems =
panel.getBillData().getBodyShowItems(
SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I);
int rowcount = pane.getTable().getRowCount();
if (SRMBaseUtil.isArrayElementsNull(basChgIvos)) {
for (int i = 0; i < rowcount; i++) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
return;
}
for (int i = 0; i < rowcount; i++) {
Object pk_supplierext_i =
pane.getTableModel().getValueAt(i,
SupplierBasChgPFIVO.PK_SUPPLIEREXT_I);
if (null == pk_supplierext_i) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
else {
for (SupplierBasChgPFIVO ivo : basChgIvos) {
if (ivo.getPk_supplierext_i().equals(pk_supplierext_i)) {
BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I, ivo,
BodyColorUtil.COLOR_UPDATE);
break;
}
}
}
}
}
private void changeToSupplierExtP(BillCardPanel panel,
SupplierBasChgPFPVO[] basChgPvos) {
BillScrollPane pane =
panel.getBodyPanel(SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P);
BillItem[] showItems =
panel.getBillData().getBodyShowItems(
SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P);
int rowcount = pane.getTable().getRowCount();
if (SRMBaseUtil.isArrayElementsNull(basChgPvos)) {
for (int i = 0; i < rowcount; i++) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
return;
}
for (int i = 0; i < rowcount; i++) {
Object pk_supplierext_p =
pane.getTableModel().getValueAt(i,
SupplierBasChgPFPVO.PK_SUPPLIEREXT_P);
if (null == pk_supplierext_p) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
else {
for (SupplierBasChgPFPVO pvo : basChgPvos) {
if (pvo.getPk_supplierext_p().equals(pk_supplierext_p)) {
BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P, pvo,
BodyColorUtil.COLOR_UPDATE);
break;
}
}
}
}
}
private void changeToSupplierExtQ(BillCardPanel panel,
SupplierBasChgPFQVO[] basChgQvos) {
BillScrollPane pane =
panel.getBodyPanel(SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q);
BillItem[] showItems =
panel.getBillData().getBodyShowItems(
SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q);
int rowcount = pane.getTable().getRowCount();
if (SRMBaseUtil.isArrayElementsNull(basChgQvos)) {
for (int i = 0; i < rowcount; i++) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
return;
}
for (int i = 0; i < rowcount; i++) {
Object pk_supplierext_q =
pane.getTableModel().getValueAt(i,
SupplierBasChgPFQVO.PK_SUPPLIEREXT_Q);
if (null == pk_supplierext_q) {
for (BillItem item : showItems) {
pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
}
}
else {
for (SupplierBasChgPFQVO qvo : basChgQvos) {
if (qvo.getPk_supplierext_q().equals(pk_supplierext_q)) {
BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q, qvo,
BodyColorUtil.COLOR_UPDATE);
break;
}
}
}
}
}
}