return treeNode;
}
public static TreeNode getQAStructure(final ExplorerViewCenterPanel centerPanel) {
final TreeNode treeNode = new TreeNode();
treeNode.setText( constants.QA() );
final TreeNode scenarios = new TreeNode();
scenarios.setText( constants.TestScenariosInPackages() );
scenarios.setIcon( "images/test_manager.gif" ); //NON-NLS
final EditItemEvent edit = new EditItemEvent() {
public void open(String key) {
centerPanel.openAsset( key );
}
public void open(MultiViewRow[] rows) {
for ( MultiViewRow row : rows ) {
centerPanel.openAsset( row.uuid );
}
}
};
scenarios.appendChild( new TreeNode( constants.PleaseWaitDotDotDot() ) );
treeNode.appendChild( scenarios );
final TreeNode analysis = new TreeNode();
analysis.setText( constants.Analysis() );
analysis.setIcon( "images/analyze.gif" ); //NON-NLS
analysis.setExpanded( false );
analysis.appendChild( new TreeNode( constants.PleaseWaitDotDotDot() ) );
if ( Preferences.getBooleanPref( "verifier" ) ) {
treeNode.appendChild( analysis );
}
scenarios.addListener( new TreeNodeListenerAdapter() {
public void onExpand(Node node) {
RepositoryServiceFactory.getService().listPackages( new GenericCallback<PackageConfigData[]>() {
public void onSuccess(PackageConfigData[] conf) {
for ( int i = 0; i < conf.length; i++ ) {
final PackageConfigData c = conf[i];
TreeNode pkg = new TreeNode();
pkg.setText( c.name );
pkg.setIcon( "images/package.gif" ); //NON-NLS
scenarios.appendChild( pkg );
pkg.addListener( new TreeNodeListenerAdapter() {
public void onClick(Node node,
EventObject e) {
if ( !centerPanel.showIfOpen( "scenarios" + c.uuid ) ) { //NON-NLS
String m = Format.format( constants.ScenariosForPackage(),
c.name );
centerPanel.addTab( m,
true,
new ScenarioPackageView( c.uuid,
c.name,
edit,
centerPanel ),
"scenarios" + c.uuid ); //NON-NLS
}
}
} );
}
scenarios.removeChild( scenarios.getFirstChild() );
}
} );
}
public void onCollapse(Node node) {
Node[] cs = node.getChildNodes();
for ( int i = 0; i < cs.length; i++ ) {
node.removeChild( cs[i] );
}
node.appendChild( new TreeNode( constants.PleaseWaitDotDotDot() ) );
}
} );
analysis.addListener( new TreeNodeListenerAdapter() {
public void onExpand(Node node) {
RepositoryServiceFactory.getService().listPackages( new GenericCallback<PackageConfigData[]>() {
public void onSuccess(PackageConfigData[] conf) {
for ( int i = 0; i < conf.length; i++ ) {
final PackageConfigData c = conf[i];
TreeNode pkg = new TreeNode();
pkg.setText( c.name );
pkg.setIcon( "images/package.gif" ); //NON-NLS
analysis.appendChild( pkg );
pkg.addListener( new TreeNodeListenerAdapter() {
public void onClick(Node node,
EventObject e) {
if ( !centerPanel.showIfOpen( "analysis" + c.uuid ) ) { //NON-NLS
final EditItemEvent edit = new EditItemEvent() {
public void open(String key) {
centerPanel.openAsset( key );
}
public void open(MultiViewRow[] rows) {
for ( MultiViewRow row : rows ) {
centerPanel.openAsset( row.uuid );
}
}
};
String m = Format.format( constants.AnalysisForPackage(),
c.name );
centerPanel.addTab( m,
true,
new AnalysisView( c.uuid,
c.name,
edit ),
"analysis" + c.uuid ); //NON-NLS
}
}
} );
}
analysis.removeChild( analysis.getFirstChild() );
}
} );
}
public void onCollapse(Node node) {
Node[] cs = node.getChildNodes();
for ( int i = 0; i < cs.length; i++ ) {
node.removeChild( cs[i] );
}
node.appendChild( new TreeNode( constants.PleaseWaitDotDotDot() ) );
}
} );
return treeNode;
}