•
•
•
•
•
•
•
•
•
•
•
•
• •
•
•
• •
•
•
•
• •
•
• •
•
•
• •
•
• •
•
•
•
•
/**
• * Initialize connectors.
*/
public void initConnectors() {
super();
• surfaceLine = ConnectLine(this, (width, 0, 0),
(width, depth, 0));
surfaceLine.setRule(dtDemoTableAccessoryRule);
}
•
•
/**
* Connectors.
• */
public void connectors(ConnectorCollection connectors) {
super(..);
connectors <<? surfaceLine;
}
•
•
/**
* Update connectors.
*/
• public void updateConnectors() {
super();
surfaceSnap.setPos((width/2, depth, 0));
}
•
•
•
•
• initConnectors()
•
• connectors()
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
/**
* Connect types.
*/
public class DtDemoTableEdgeCType extends ConnectType { }
public class DtDemoTableAccessoryCType extends ConnectType { }
public class DtDemoTableMonitorStandCType extends ConnectType { }
•
•
/**
* Connect rules.
*/
public ConnectRule dtDemoTableRule;
public ConnectRule dtDemoTableAccessoryRule;
public ConnectRule dtDemoMonitorStandRule;
•
•
• makeConnectRule()
•
/**
* Init rules.
*/
init {
// Example 1: Symmetric
dtDemoMonitorStandRule = makeConnectRule("dtDemoMonitorStandRule", DtDemoTableMonitorStandCType);
// Example 2: 1:1 Asymmetric
dtDemoTableAccessoryRule = makeConnectRule("dtDemoTableAccessoryRule", DtDemoTableAccessoryCType, null);
// Example 3: Many:Many Asymmetric
dtDemoTableRule = makeConnectRule("dtDemoTableRule", {ConnectTypeClass: DtDemoTableEdgeCType},
{ConnectTypeClass: DtDemoTableEdgeCType, DtDemoTableAccessoryCType});
}
•
•
•
• DtDemoTableMonitorStandCType
• DtDemoTableMonitorStandCType
// Example 1: Symmetric
dtDemoMonitorStandRule = makeConnectRule("dtDemoMonitorStandRule", DtDemoTableMonitorStandCType);
• ConnectType
•
• null
•
• DtDemoTableAccessoryCType
•
// Example 2: 1:1 Asymmetric
dtDemoTableAccessoryRule = makeConnectRule("dtDemoTableAccessoryRule", DtDemoTableAccessoryCType, null);
•
ConnectType
•
•
• DtDemoTableEdgeCType
• DtDemoTableEdgeCType
DtDemoTableAccessoryCType
// Example 3: Many:Many Asymmetric
dtDemoTableRule = makeConnectRule("dtDemoTableRule", {ConnectTypeClass: DtDemoTableEdgeCType},
{ConnectTypeClass: DtDemoTableEdgeCType, DtDemoTableAccessoryCType});
•
•
ConnectType
•
•
•
•
extend public bool animationTrySnap(Connector mySnap, Connector targetAttach, line mouseLine,
bool connect=true, bool undoable=false, ModifyEnv env=null) {
•
•
•
•
•
•
•
extend public bool allowTrySnap(Connector s, Connector a) { return allowSnap(s, a); }
extend public bool allowSnap(Connector s, Connector a) { return true; }
•
•
•
extend public bool allowTryAttach(Connector a, Connector s) { return allowAttach(a, s); }
extend public bool allowAttach(Connector a, Connector s) { return true; }
•
•
•
•
•
•
•
•
•
•
•
•
•