Beispiel #1
0
void CtrfFolderColumn::Expand  (CTreeCtrl* pTree, HTREEITEM hExpand)
{
	BOOL bAlreadyExpanded = m_treeCtrlData.IsAlreadyExpanded();
	CtrfItemData::Expand(pTree, hExpand);
	if (!bAlreadyExpanded)
	{
		CtrfItemData::Expand(pTree, hExpand);
		CaRefreshTreeInfo info;
		info.SetInfo (0);
		RefreshData (pTree, hExpand, &info);
	}
}
Beispiel #2
0
void CtrfFolderGroup::Expand  (CTreeCtrl* pTree, HTREEITEM hExpand)
{
	TRACE0 ("CtrfFolderGroup::Expand \n");
	BOOL bAlreadyExpanded = m_treeCtrlData.IsAlreadyExpanded();
	CtrfItemData::Expand(pTree, hExpand);
	if (!bAlreadyExpanded)
	{
		CaRefreshTreeInfo info;
		info.SetInfo (0);
		RefreshData (pTree, hExpand, &info);
	}
}
Beispiel #3
0
void CaIjaNode::Expand  (CTreeCtrl* pTree, HTREEITEM hExpand, CaIjaTreeData* pTreeData)
{
	BOOL bAlreadyExpanded = m_treeCtrlData.IsAlreadyExpanded();
	CaIjaTreeItemData::Expand(pTree, hExpand, pTreeData);
	if (!bAlreadyExpanded)
	{
		CString csItem;
		csItem.LoadString(IDS_NO_DATABASES);
		m_EmptyDatabase.SetItem(csItem);
		CaRefreshTreeInfo info;
		info.SetInfo (0);
		RefreshData (pTree, hExpand, &info);
	}
}
Beispiel #4
0
void CaIjaTreeData::Expand (CTreeCtrl* pTree, HTREEITEM hExpand, CaIjaTreeData* pTreeData)
{
	BOOL bAlreadyExpanded = m_treeCtrlData.IsAlreadyExpanded();
	CaIjaTreeItemData::Expand(pTree, hExpand, pTreeData);
	pTree->SetItemImage(m_treeCtrlData.GetTreeItem(), m_treeCtrlData.GetImageExpanded(), m_treeCtrlData.GetImageExpanded());
	if (!bAlreadyExpanded)
	{
		CString csItem;
		csItem.LoadString(IDS_NO_NODES);
		m_EmptyNode.SetItem(csItem);
		CaRefreshTreeInfo info;
		info.SetInfo (0);
		RefreshData(pTree, hExpand, &info);
	}
}
Beispiel #5
0
BOOL CaIjaTreeData::RefreshData(CTreeCtrl* pTree, HTREEITEM hItem, CaRefreshTreeInfo* pInfo)
{
	BOOL bError = FALSE;
	CTypedPtrList<CObList, CaIjaTreeItemData*> listNode;
	try
	{
		//
		// Refresh only the branch has already been expanded:
		if (!GetTreeCtrlData().IsAlreadyExpanded())
			return TRUE;

		if (!IJA_QueryNode (listNode))
			return FALSE;
	}
	catch (CeSqlException e)
	{
		if (!INGRESII_IsRunning())
		{
			CString strMsg;
			strMsg.LoadString(IDS_INGRES_NOT_RUNNING);
			AfxMessageBox (strMsg);
		}
		else
			AfxMessageBox (e.GetReason());
		bError = TRUE;
	}
	catch (...)
	{
		AfxMessageBox (_T("System error::IJA_QueryNode, failed to query nodes."));
		bError = TRUE;
	}
	if (bError)
	{
		CString csItem;
		csItem.LoadString(IDS_DATA_UNAVAILABLE);
		m_EmptyNode.SetItem(csItem);
		if (pTree && hItem)
			Display (pTree, NULL);
		return FALSE;
	}


	CfMainFrame* pm = (CfMainFrame*)theApp.m_pMainWnd;
	ASSERT (pm);
	if (!pm)
		return FALSE;
	CvViewRight* pV = (CvViewRight*)pm->GetRightView();
	ASSERT (pV);
	if (!pV)
		return FALSE;
	BOOL bAddNode = FALSE;
	if (pV->m_pCtrl && IsWindow (pV->m_pCtrl->m_hWnd))
	{
		pV->m_pCtrl->CleanNode();
		bAddNode = TRUE;
	}
	//
	// Mark all old Node to be deleted:
	POSITION pos = m_listNode.GetHeadPosition();
	while (pos != NULL)
	{
		CaIjaTreeItemData* pItem = m_listNode.GetNext (pos);
		pItem->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_DELETE);
	}
	//
	// Add new Node:
	pos = listNode.GetHeadPosition();
	while (pos != NULL)
	{
		CaIjaTreeItemData* pItem = listNode.GetNext (pos);
		CaIjaTreeItemData* pExist = IJA_FindItem (m_listNode, pItem);
		if (pExist)
		{
			pExist->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_EXIST);
			delete pItem;
			continue;
		}

		pItem->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_NEW);
		m_listNode.AddTail (pItem);
	}

	if (pInfo->m_nLevel == 1 || pInfo->m_nLevel == -1)
	{
		pos = m_listNode.GetHeadPosition();
		while (pos != NULL)
		{
			CaIjaTreeItemData* pItem = m_listNode.GetNext (pos);
			if (pItem->GetTreeCtrlData().GetState () == CaTreeCtrlData::ITEM_DELETE)
				continue;
			CaRefreshTreeInfo info;
			if (pInfo->m_nLevel == 1)
				info.SetInfo (0);
			else
				info.SetInfo (-1);
			pItem->RefreshData (NULL, NULL, &info);
		}
	}

	//
	// Update display of all nodes:
	if (pTree && hItem)
		Display (pTree, NULL);
	if (bAddNode)
	{
		pos = m_listNode.GetHeadPosition();
		while (pos != NULL)
		{
			CaIjaTreeItemData* pItem = m_listNode.GetNext (pos);
			pV->m_pCtrl->AddNode(pItem->GetItem());
		}
	}

	return TRUE;
}
Beispiel #6
0
BOOL CaIjaNode::RefreshData(CTreeCtrl* pTree, HTREEITEM hItem, CaRefreshTreeInfo* pInfo)
{
	CTypedPtrList<CObList, CaIjaTreeItemData*> listDatabase;
	BOOL bError = FALSE;
	try
	{
		//
		// Refresh only the branch has already been expanded:
		if (!GetTreeCtrlData().IsAlreadyExpanded())
			return TRUE;

		if (!IJA_QueryDatabase (m_strItem, listDatabase))
			return FALSE;
	}
	catch (CeSqlException e)
	{
		AfxMessageBox (e.GetReason());
		bError = TRUE;
	}
	catch (...)
	{
		AfxMessageBox (_T("System error::IJA_QueryDatabase, failed to query databases."));
		bError = TRUE;
	}
	if (bError)
	{
		CString csItem;
		csItem.LoadString(IDS_DATA_UNAVAILABLE);
		m_EmptyDatabase.SetItem(csItem);
		if (pTree && hItem)
			Display (pTree, m_treeCtrlData.GetTreeItem());
		return FALSE;
	}


	CTypedPtrList<CObList, CaIjaTreeItemData*>& listOldDatabase = m_listDatabase;
	//
	// Mark all old databases to be deleted:
	POSITION pos = listOldDatabase.GetHeadPosition();
	while (pos != NULL)
	{
		CaIjaTreeItemData* pItem = listOldDatabase.GetNext (pos);
		pItem->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_DELETE);
	}
	//
	// Add new Databases:
	pos = listDatabase.GetHeadPosition();
	while (pos != NULL)
	{
		CaIjaTreeItemData* pItem = listDatabase.GetNext (pos);
		CaIjaTreeItemData* pExist = IJA_FindItem (listOldDatabase, pItem);
		if (pExist)
		{
			pExist->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_EXIST);
			delete pItem;
			continue;
		}

		pItem->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_NEW);
		pItem->SetBackParent (this);
		listOldDatabase.AddTail (pItem);
	}

	if (pInfo->m_nLevel == 1 || pInfo->m_nLevel == -1)
	{
		CaRefreshTreeInfo info;
		pos = listOldDatabase.GetHeadPosition();
		while (pos != NULL)
		{
			CaIjaTreeItemData* pItem = listOldDatabase.GetNext (pos);
			if (pItem->GetTreeCtrlData().GetState () == CaTreeCtrlData::ITEM_DELETE)
				continue;
			info.SetInfo (pInfo->m_nLevel);
			pItem->RefreshData(NULL, NULL, &info);
		}
	}
	//
	// Update display the branches of path <Node>::<Database>:
	if (pTree && hItem)
		Display (pTree, pTree->GetParentItem(hItem));
	return TRUE;
}