Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views35 pages

Connectors Pres

The document outlines the initialization and management of connectors in a programming context, including methods for connecting and updating connector positions. It defines various connection types and rules for connecting components, such as symmetric and asymmetric connections. Additionally, it includes methods for checking the validity of snap and attach actions for connectors.

Uploaded by

rohithram5468
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views35 pages

Connectors Pres

The document outlines the initialization and management of connectors in a programming context, including methods for connecting and updating connector positions. It defines various connection types and rules for connecting components, such as symmetric and asymmetric connections. Additionally, it includes methods for checking the validity of snap and attach actions for connectors.

Uploaded by

rohithram5468
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35










• •



• •



• •

• •



• •

• •



/**
• * 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; }










You might also like