2008-03-26 18:28:34 +00:00

182 lines
4.7 KiB
C#

// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
using System.Configuration;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
namespace VEPROMS.CSLA.Library
{
public partial class Folder : IVEDrillDown
{
#region Folder Config
[NonSerialized]
private FolderConfig _FolderConfig;
public FolderConfig FolderConfig
{
get
{
if (_FolderConfig == null)
{
_FolderConfig = new FolderConfig(this);
_FolderConfig.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_FolderConfig_PropertyChanged);
}
return _FolderConfig;
}
}
public void FolderConfigRefresh()
{
_FolderConfig = null;
}
private void _FolderConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
Config = _FolderConfig.ToString();
}
#endregion
public override string ToString()
{
return _Title;
}
#region IVEReadOnlyItem
public System.Collections.IList GetChildren()
{
if (FolderDocVersionCount != 0) return FolderDocVersions;
if (ChildFolderCount != 0) return ChildFolders;
return null;
}
public bool HasChildren
{
get { return _FolderDocVersionCount > 0 || _ChildFolderCount > 0; }
}
public IVEDrillDown ActiveParent
{
get
{
return MyParent;
}
}
public Format ActiveFormat
{
get { return LocalFormat != null ? LocalFormat : (ActiveParent != null ? ActiveParent.ActiveFormat : null); }
}
public Format LocalFormat
{
get { return MyFormat; }
}
public DynamicTypeDescriptor MyConfig
{
get { return FolderConfig; }
}
#endregion
}
public partial class FolderInfo:IVEDrillDownReadOnly
{
#region Folder Config (Read-Only)
[NonSerialized]
private FolderConfig _FolderConfig;
public FolderConfig FolderConfig
{ get {
return (_FolderConfig != null ? _FolderConfig : _FolderConfig = new FolderConfig(this));
} }
private void FolderConfigRefresh()
{
_FolderConfig = null;
}
#endregion
#region IVEReadOnlyItem
public System.Collections.IList GetChildren()
{
if(FolderDocVersionCount != 0)return FolderDocVersions;
if (ChildFolderCount != 0) return ChildFolders;
return null;
}
//public bool ChildrenAreLoaded
//{
// get { return _FolderDocVersions != null || _ChildFolders != null; }
//}
public bool HasChildren
{
get { return _FolderDocVersionCount > 0 || _ChildFolderCount > 0; }
}
public IVEDrillDownReadOnly ActiveParent
{
get
{
return MyParent;
}
}
public FormatInfo ActiveFormat
{
get { return LocalFormat != null ? LocalFormat : ( ActiveParent != null ? ActiveParent.ActiveFormat : null); }
}
public FormatInfo LocalFormat
{
get { return MyFormat; }
}
public DynamicTypeDescriptor MyConfig
{
get { return Get().FolderConfig; }
}
/// <summary>
/// These settings are set on the user interface side.
/// This is used to control whether the Name and/or Title is displayed
/// next to the tree nodes in the user interface
/// </summary>
private bool _DisplayTreeNodeNames = true;
public bool DisplayTreeNodeNames
{
get { return _DisplayTreeNodeNames; }
set { _DisplayTreeNodeNames = value; }
}
private bool _DisplayTreeNodeTitles = false;
public bool DisplayTreeNodeTitles
{
get { return _DisplayTreeNodeTitles; }
set { _DisplayTreeNodeTitles = value; }
}
public override string ToString()
{
// assume that at least one of the two options was selected
string rtnstr = "";
if ( _DisplayTreeNodeNames) rtnstr = Name;
if (_DisplayTreeNodeTitles)
{
if (rtnstr.Length > 0) rtnstr += " - ";
rtnstr += Title;
}
return rtnstr;
//return string.Format("{0} - {1}", Name, Title);
}
//public string ToString(string str, System.IFormatProvider ifp)
//{
// return ToString();
//}
#endregion
public Color BackColor
{ get { return FolderConfig.Default_BkColor; } }
#region Extension
partial class FolderInfoExtension : extensionBase
{
public override void Refresh(FolderInfo tmp)
{
tmp.FolderConfigRefresh();
}
}
#endregion
}
}