///
/// Copyright © 2003-2008 JetBrains s.r.o.
/// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder).
///
using System;
namespace JetBrains.Omea.OpenAPI
{
///
/// Base class for blocks displayed in contact edit/view panes.
///
public class AbstractContactViewBlock : AbstractEditPane
{
///
/// Queries the contact block whether the user changed any data in it.
///
/// true if the data was changed by the user, false otherwise.
public virtual bool IsChanged() { return true; }
///
/// Check whether this block owns (processes and displays) the
/// partucular property of a contact resource.
///
/// Id of a property.
/// Return true if contact block is responsible for the given property.
/// 2.0
public virtual bool OwnsProperty( int propId ) { throw new NotImplementedException(); }
///
/// Get an html representation of the block of information on the
/// united Contact View pane.
///
/// 2.1.5
public virtual string HtmlContent( IResource contact ){ throw new NotImplementedException(); }
///
/// Construct simple pair of paragraphs Name/Value placed in one line
/// one after another. If requested property is not set show a standard
/// placeholder.
///
/// A resource which property to show.
/// Pair heading title.
/// Property id.
/// Html representation of the Name/Value property value.
/// 2.1.5
protected static string ObligatoryTag( IResource res, string head, int prop )
{
string result = "\t
" + head + " | ";
string text = res.GetPropText( prop );
result += (text.Length > 0) ? "" + text + " | " : ContactViewStandardTags.NotSpecifiedHtmlText;
result += "
";
return result;
}
///
/// Construct simple pair of paragraphs Name/Value placed in one line
/// one after another. If requested property is not set nothing constructed.
///
/// A resource which property to show.
/// Pair heading title.
/// Property id.
/// Html representation of the Name/Value property value.
/// 2.1.5
protected static string OptionalTag( IResource res, string head, int prop )
{
string result = string.Empty;
string text = res.GetPropText( prop );
if( text.Length > 0 )
{
result += "\t" + head + " | " + text + " |
";
}
return result;
}
}
public class ContactViewStandardTags
{
///
/// Predefined formatting of the property value when it is not defined.
///
public const string NotSpecifiedHtmlText = "Not specified | ";
}
}