/*
* BudgetRelationship.java
*
* Created on 2006��10��19��, ����1:27
*
* RealCix2.0
*/
package realcix20.guis.relationships;
import java.util.Vector;
import javax.swing.JComponent;
import realcix20.classes.basic.Column;
/**
*
* @author JerryChen
*/
public class BudgetRelationship extends BaseRelationship {
private int clsId;
private Vector componentExts;
public BudgetRelationship(int clsId, Vector componentExts) {
super(clsId, componentExts);
this.clsId = clsId;
this.componentExts = componentExts;
initialRelationship();
}
public BudgetRelationship(int clsId, Vector headComponentExts, Vector itemComponentExts) {
super(clsId, headComponentExts, itemComponentExts);
this.clsId = clsId;
Vector tempComponentExts = (Vector)headComponentExts.clone();
tempComponentExts.addAll(itemComponentExts);
this.componentExts = tempComponentExts;
initialItemRelationship();
}
private void initialRelationship() {
//initial BUD.PAMOUNT & BUD.PLCURR relationship
JComponent component = super.findComponent("BUD", "PLCURR", componentExts);
JComponent childComponent = super.findComponent("BUD", "PAMOUNT", componentExts);
super.contactRelationship1_11(component, childComponent);
//initial BUD.CREATEDBY & BUD.LASTCHANGEDBY relationship
JComponent component1 = super.findComponent("BUD", "CREATEDBY", componentExts);
Column column1 = super.findColumn("BUD", "CREATEDBY", componentExts);
JComponent component2 = super.findComponent("BUD", "LASTCHANGEDBY", componentExts);
Column column2 = super.findColumn("BUD", "LASTCHANGEDBY", componentExts);
super.initialComponent7Value(component1, column1.getColumnName(), column1.getInputPar(), null);
super.initialComponent7Value(component2, column2.getColumnName(), column2.getInputPar(), null);
super.contactRelationship7_7(component1, component2);
super.contactRelationship7_7(component2, component1);
}
private void initialItemRelationship() {
//initial BUDM.LCURR & BUD.PLCURR relationship
JComponent component = super.findComponent("BUD", "PLCURR", componentExts);
JComponent childComponent = super.findComponent("BUDM", "LCURR", componentExts);
Column column = super.findColumn("BUDM", "LCURR", componentExts);
String sql = column.getInputPar();
String str = "[BUD.PLCURR]";
if (sql.indexOf(str) != -1) {
StringBuffer sb = new StringBuffer(sql);
sb.replace(sql.indexOf(str), sql.indexOf(str) + str.length(), "?");
sql = sb.toString();
}
Vector components = new Vector();
components.add(component);
super.contactRelationship1_1(components, childComponent, sql);
//initial BUDM.LAMOUNT & BUDM.LCURR relationship
JComponent component1 = super.findComponent("BUDM", "LCURR", componentExts);
JComponent component2 = super.findComponent("BUDM", "LAMOUNT", componentExts);
super.contactRelationship1_11(component1, component2);
}
}