//
// Displays the values from memory in the GUI.
//
void CPageDisk::ShowData()
{
	Manager	*manager;
	Worker	*worker;

	// Only enable the display if a disk worker or a manager with disk 
	// interfaces is selected.
	manager = theApp.pView->m_pWorkerView->GetSelectedManager();
	worker = theApp.pView->m_pWorkerView->GetSelectedWorker();
	if (( theApp.pView->m_pWorkerView->GetSelectedType() == ALL_MANAGERS) ||
		( manager && !manager->InterfaceCount( GenericDiskType ) ) ||
		( worker && !IsType( worker->Type(), GenericDiskType ) ) )
	{
		Reset();
		return;
	}

	// This is a new view of the target assignment.  
	// It has not been modified.
	selected = NULL;
	highlighted = NULL;
	// Show the target list.
	ShowTargets();
	// Set the target selection check boxes.
	ShowTargetSelection();
	// Bold the last selected item.
	ShowFocus();
	// Show the connection rate settings.
	ShowConnectionRate();
	// Show the disk specific settings.
	ShowSettings();
	// Enable the apropriate windows and redraw the page.
	EnableWindow();
}
//
// Displays the connection rate settings for the current selection in the
// worker view.  If the selection is a manager or all managers, displays
// a value if all the children's values are the same.
//
void CPageNetwork::ShowConnectionRate()
{
	Manager *manager;
	Worker	*worker;
	int		trans_per_conn;
	int		test_connection_rate;

	switch ( theApp.pView->m_pWorkerView->GetSelectedType() )
	{
	case WORKER:
		worker = theApp.pView->m_pWorkerView->GetSelectedWorker();
		// update controls with worker's data
		if ( IsType( worker->Type(), GenericNetType ) )
		{
			trans_per_conn = worker->GetTransPerConn( GenericNetType );
			test_connection_rate = worker->GetConnectionRate( GenericNetType );
		}
		break;
	case MANAGER:
		manager = theApp.pView->m_pWorkerView->GetSelectedManager();
		trans_per_conn = manager->GetTransPerConn( GenericServerType );
		test_connection_rate = manager->GetConnectionRate( GenericServerType );
		break;
	default:
		trans_per_conn = 
			theApp.manager_list.GetTransPerConn( GenericServerType );
		test_connection_rate = 
			theApp.manager_list.GetConnectionRate( GenericServerType );
		break;
	}
	// If the test connection rate settings are different between a manager's
	// workers, set the state of the check box to AUTO3STATE and disable the
	// edit box and spin control.
	SetDlgItemInt( EConnectionRate, trans_per_conn );
	if ( test_connection_rate == AMBIGUOUS_VALUE )
	{
		m_CConnectionRate.SetButtonStyle( BS_AUTO3STATE );
		m_EConnectionRate.SetPasswordChar( 32 );
		m_EConnectionRate.Invalidate( TRUE );

		// Set check box to undetermined state.
		CheckDlgButton( CConnectionRate, 2 );
	}
	else
	{
		m_CConnectionRate.SetButtonStyle( BS_AUTOCHECKBOX );
		CheckDlgButton( CConnectionRate, test_connection_rate );

		if ( test_connection_rate == ENABLED_VALUE && trans_per_conn != 
			AMBIGUOUS_VALUE )
		{
			m_EConnectionRate.SetPasswordChar( 0 );
		}
		else
		{
			m_EConnectionRate.SetPasswordChar( 32 );
			m_EConnectionRate.Invalidate();
		}
	}
}
Exemple #3
0
//
// Displays the fixed seed value for the current selection in the
// worker view.  If the selection is a manager or all managers, displays
// a value if all the children's values are the same.
//
void CPageDisk::ShowFixedSeedValue()
{
	Manager *manager;
	Worker *worker;
	DWORDLONG fixed_seed_value = 0;
	BOOL use_fixed_seed = 0;

	switch (theApp.pView->m_pWorkerView->GetSelectedType()) {
	case WORKER:
		// update controls with worker's data
		worker = theApp.pView->m_pWorkerView->GetSelectedWorker();
		if (IsType(worker->Type(), GenericDiskType)) {
			fixed_seed_value = worker->GetFixedSeedValue(GenericDiskType);
			use_fixed_seed = worker->GetUseFixedSeed(GenericDiskType);
		}
		break;
	case MANAGER:
		manager = theApp.pView->m_pWorkerView->GetSelectedManager();
		fixed_seed_value = manager->GetFixedSeedValue(GenericDiskType);
		use_fixed_seed = manager->GetUseFixedSeed(GenericDiskType);
		break;
	default:
		fixed_seed_value = theApp.manager_list.GetFixedSeedValue(GenericDiskType);
		use_fixed_seed = theApp.manager_list.GetUseFixedSeed(GenericDiskType);
		break;
	}
	// If the fixed seed values are different between a manager's
	// workers, set the state of the check box to AUTO3STATE and disable the
	// edit box and spin control.
	SetDlgItemInt64(EFixedSeed, fixed_seed_value, false);
	if (use_fixed_seed == AMBIGUOUS_VALUE) {
		m_CUseFixedSeed.SetButtonStyle(BS_AUTO3STATE);
		m_EFixedSeed.SetPasswordChar(32);
		m_EFixedSeed.Invalidate(TRUE);

		// Set check box to undetermined state.
		CheckDlgButton(CUseFixedSeed, 2);
	} else {
		m_CUseFixedSeed.SetButtonStyle(BS_AUTOCHECKBOX);
		CheckDlgButton(CUseFixedSeed, use_fixed_seed);

		if (use_fixed_seed == ENABLED_VALUE && fixed_seed_value != (DWORDLONG)AMBIGUOUS_VALUE) {
			m_EFixedSeed.SetPasswordChar(0);
		} else {
			m_EFixedSeed.SetPasswordChar(32);
			m_EFixedSeed.Invalidate();
		}
	}
}
//
// Enables the assigned list and add button based on the input variable.
// Verifies that enabling is allowed before enabling.
//
void CPageAccess::SetAssignedAccess( BOOL enable )
{
	Manager	*mgr;
	Worker	*wkr;
	BOOL	enabling_worker;

	// Get the currently selected manager and worker.
	switch ( theApp.pView->m_pWorkerView->GetSelectedType() )
	{
	case ALL_MANAGERS:
		// Allow enabling if there are any workers,
		enabling_worker = theApp.manager_list.WorkerCount();
		break;

	case MANAGER:
		mgr = theApp.pView->m_pWorkerView->GetSelectedManager();

		// Allow enabling if there are non-client workers.
		enabling_worker = ( mgr->WorkerCount() > 
			mgr->WorkerCount( GenericClientType ) );
		break;

	case WORKER:
		wkr = theApp.pView->m_pWorkerView->GetSelectedWorker();

		// Allow enabling if it's not a client.
		enabling_worker = !IsType( wkr->Type(), GenericClientType ); 
		break;
	}


	m_LAssignedAccess.EnableWindow( enable && enabling_worker &&
									theApp.test_state == TestIdle );

	m_BAdd.EnableWindow( enable && enabling_worker && theApp.test_state == TestIdle &&
		( m_LGlobalAccess.GetNextItem( FIND_FIRST, LVNI_SELECTED ) != -1 ) );

	m_LAssignedAccess.RedrawWindow();
	m_BAdd.RedrawWindow();
}
Exemple #5
0
void CPageDisk::ShowDataPattern()
{
	Manager *manager;
	Worker *worker;
	int data_pattern = 1;

	switch (theApp.pView->m_pWorkerView->GetSelectedType()) {
	case WORKER:
		// update controls with worker's data
		worker = theApp.pView->m_pWorkerView->GetSelectedWorker();
		if (IsType(worker->Type(), GenericDiskType)) {
			data_pattern = worker->GetDataPattern(GenericDiskType);
		}
		break;
	case MANAGER:
		manager = theApp.pView->m_pWorkerView->GetSelectedManager();
		data_pattern = manager->GetDataPattern(GenericDiskType);
		break;
	default:
		data_pattern = theApp.manager_list.GetDataPattern(GenericDiskType);
		break;
	}
	m_CDataPattern.SetCurSel(data_pattern);
}
//
// Enabling controls on the form for user access.
//
void CPageDisk::EnableWindow( BOOL enable )
{
	Manager	*manager;
	Worker	*worker;
	CWnd	*last_focused;

	// Only enable things if a test is not running.
	if ( theApp.test_state != TestIdle )
		return;

	// Get the current worker and manager selections.
	manager = theApp.pView->m_pWorkerView->GetSelectedManager();
	worker = theApp.pView->m_pWorkerView->GetSelectedWorker();

	switch ( theApp.pView->m_pWorkerView->GetSelectedType() )
	{
	case WORKER:
		// Enable the target list only if the selected worker is a disk worker.
		enable = enable && IsType( worker->Type(), GenericDiskType );
		m_TTargets.EnableWindow( enable );

		// If the selected worker is not a disk worker, switch to the network
		// target page.
		if ( !IsType( worker->Type(), GenericDiskType ) && 
			theApp.pView->m_pPropSheet->GetActiveIndex() == DISK_PAGE )
		{
			last_focused = GetFocus();
			theApp.pView->m_pPropSheet->SetActivePage( NETWORK_PAGE );
			if ( last_focused )
				last_focused->SetFocus();
		}
		break;
	case MANAGER:
		// Enable the target list only if the selected manager has a 
		// disk worker.
		enable = enable && manager->WorkerCount( GenericDiskType );
		m_TTargets.EnableWindow( enable );

		// If the selected manager has no disk workers but has network server
		// workers, switch to the network target page.
		if ( !manager->WorkerCount( GenericDiskType ) && 
			manager->WorkerCount( GenericServerType ) && 
			theApp.pView->m_pPropSheet->GetActiveIndex() == DISK_PAGE )
		{
			enable = FALSE;
			last_focused = GetFocus();
			theApp.pView->m_pPropSheet->SetActivePage( NETWORK_PAGE );
			if ( last_focused )
				last_focused->SetFocus();
		}
		break;
	case ALL_MANAGERS:
		// Only enable the connection rate controls if there exists a
		// GenericDiskType worker.
		enable = enable && theApp.manager_list.WorkerCount( GenericDiskType );
		
		// The target list is disabled for all managers.
		m_TTargets.EnableWindow( FALSE );
	}

	// Enable the connection rate check box.
	m_CConnectionRate.EnableWindow( enable );

	// Enable the connection rate edit box and spin control if the connection 
	// rate check box is checked.
	m_EConnectionRate.EnableWindow( enable &&
		m_CConnectionRate.GetCheck() == 1 );
	m_SConnectionRate.EnableWindow( enable &&
		m_CConnectionRate.GetCheck() == 1 );

	// Enable the disk parameter controls.
	m_EDiskStart.EnableWindow( enable );
	m_EDiskSize.EnableWindow( enable );
	m_EQueueDepth.EnableWindow( enable );
		
	// The spin button sometimes needs to be redrawn even if it didn't change
	// when the edit box was partially redrawn.
	m_SConnectionRate.Invalidate( TRUE );

	// Redraw the page.  Note that all the child windows will be redrawn too.
	// Also note that only windows that have already been invalidated will get
	// redrawn, avoiding much flicker.
	RedrawWindow( NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE );
}
//
// Enable or disable the tab's windows, if apropriate.
//
void CPageNetwork::EnableWindow(BOOL enable)
{
	Manager *manager;
	Worker *worker;
	int selected_type;
	CWnd *last_focused;
	BOOL enable_max_sends = false;

	// Only enable thingies if a test is not running.
	if (theApp.test_state != TestIdle)
		return;

	selected_type = theApp.pView->m_pWorkerView->GetSelectedType();
	switch (selected_type) {
	case WORKER:
		// Get the current worker selection.
		worker = theApp.pView->m_pWorkerView->GetSelectedWorker();

		enable = enable && IsType(worker->Type(), GenericServerType);
		enable_max_sends = enable && IsType(worker->Type(), VIServerType);

		// If the selected worker is a disk worker,
		// switch to the disk targets page.
		if (IsType(worker->Type(), GenericDiskType) &&
		    theApp.pView->m_pPropSheet->GetActiveIndex() == NETWORK_PAGE) {
			last_focused = GetFocus();
			theApp.pView->m_pPropSheet->SetActivePage(DISK_PAGE);
			if (last_focused)
				last_focused->SetFocus();
		}
		break;
	case MANAGER:
		// Get the current manager selection.
		manager = theApp.pView->m_pWorkerView->GetSelectedManager();

		enable = enable && manager->WorkerCount(GenericServerType);
		enable_max_sends = enable && manager->WorkerCount(VIServerType);

		// If the selected manager has no network servers but has disk workers,
		// switch to the disk targets page.
		if (!manager->WorkerCount(GenericServerType) &&
		    manager->WorkerCount(GenericDiskType) &&
		    theApp.pView->m_pPropSheet->GetActiveIndex() == NETWORK_PAGE) {
			enable = FALSE;
			last_focused = GetFocus();
			theApp.pView->m_pPropSheet->SetActivePage(DISK_PAGE);
			if (last_focused)
				last_focused->SetFocus();
		}
		break;
	case ALL_MANAGERS:
		// Only enable the connection rate controls if there exists a
		// server worker.
		enable = enable && theApp.manager_list.WorkerCount(GenericServerType);
		enable_max_sends = enable && (theApp.manager_list.WorkerCount(VIServerType));
	}

	// Do not enable the target list for all managers.
	m_TTargets.EnableWindow(enable && selected_type != ALL_MANAGERS);
	m_DInterface.EnableWindow(enable && selected_type != ALL_MANAGERS);

	m_EMaxSends.EnableWindow(enable_max_sends);

	// Enable the connection rate check box.
	m_CConnectionRate.EnableWindow(enable);

	// Enable the connection rate edit box and spin control if the connection 
	// rate check box is checked.
	m_EConnectionRate.EnableWindow(enable && m_CConnectionRate.GetCheck() == 1);
	m_SConnectionRate.EnableWindow(enable && m_CConnectionRate.GetCheck() == 1);

	// The spin button sometimes needs to be redrawn even if it didn't change
	// when the edit box was partially redrawn.
	m_SConnectionRate.Invalidate(TRUE);

	// Redraw the page.  Note that all the child windows will be redrawn too.
	// Also note that only windows that have already been invalidated will get
	// redrawn, avoiding much flicker.
	RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE);
}
//
// This function is called whenever the selection in the WorkerView changes.
// If the selection changes to a worker, it displays that worker's access
// spec assignment.
//
void CPageAccess::ShowAssignedAccess()
{
	int		m, w, s, mgr_count, wkr_count, spec_count;
	Manager	*mgr;
	Worker	*wkr = NULL;
	Test_Spec *spec;

	// Clear the list of assigned access specs.
	m_LAssignedAccess.DeleteAllItems();

	// find out who is selected: All managers, a manager, or a worker.
	switch ( theApp.pView->m_pWorkerView->GetSelectedType() )
	{
	case ALL_MANAGERS:
		// Disable the Assigned Access Spec listbox if there are no workers.
		if ( !theApp.manager_list.WorkerCount() )
		{
			SetAssignedAccess( FALSE );
			return;
		}

		// Enable the Assigned Access Spec listbox.
		SetAssignedAccess( TRUE );

		// Only display items in the listbox if all the descended workers
		// have the same access spec list.
		if ( !theApp.manager_list.AreAccessSpecsIdentical() )
			return;

		// All access specs are the same.  Show the specs stored by any worker.

		// Find a manager with any non-client workers.
		mgr_count = theApp.manager_list.ManagerCount();
		for ( m = 0; m < mgr_count; m++ )
		{
			mgr = theApp.manager_list.GetManager( m );
			wkr_count = mgr->WorkerCount();
			if ( wkr_count > mgr->WorkerCount( GenericClientType ) )
				break;
		}

		// Find the manager's first non-client worker.
		for ( w = 0; w < wkr_count; w++ )
		{
			// Find the first non-client worker.
			wkr = mgr->GetWorker( w );
			if ( !IsType( wkr->Type(), GenericClientType ) )
				break;
		}
		break;

	case MANAGER:
		mgr = theApp.pView->m_pWorkerView->GetSelectedManager();
		wkr_count = mgr->WorkerCount();

		// Disable the access spec list if there are no non-client workers.
		if ( wkr_count == mgr->WorkerCount( GenericClientType ) )
		{
			SetAssignedAccess( FALSE );
			return;
		}

		// Enable the Assigned Access Spec listbox.
		SetAssignedAccess( TRUE );

		// Only display items in the listbox if all the descended workers
		// have the same access spec list.
		if ( !mgr->AreAccessSpecsIdentical() )
			return;

		// All the access specs are the same.

		// Find the first non-client worker.
		for ( w = 0; w < wkr_count; w++ )
		{
			wkr = mgr->GetWorker( w );
			if ( !IsType( wkr->Type(), GenericClientType ) )
				break;
		}
		break;

	case WORKER:

		wkr = theApp.pView->m_pWorkerView->GetSelectedWorker();

		if ( IsType( wkr->Type(), GenericClientType ) )
		{
			// Worker is a net client.  Display it's net server's spec 
			// assignment, but disable the view.
			wkr = wkr->net_partner;
			SetAssignedAccess( FALSE );
		}
		else
		{
			SetAssignedAccess( TRUE );
		}
		break;
	}
	if ( !wkr )
	{
		ErrorMessage( "No valid worker in CPageAccess::ShowAssignedAccess()." );
		return;
	}

	// Add the Access Spec to the assigned access spec list view.
	spec_count = wkr->AccessSpecCount();
	for ( s = 0; s < spec_count; s++ )
	{
		spec = wkr->GetAccessSpec( s );
		// Set the data portion to pointer to the access spec in the
		// worker's access spec list.
		m_LAssignedAccess.InsertItem( LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE,
			s, spec->name, NULL, LVIS_SELECTED, BLUE, 
			(ULONG_PTR)spec );
	}
}