Shortening some class names

Small refactoring, preparing for descriptor binding variations

--HG--
branch : theming
This commit is contained in:
Louis DeJardin
2010-09-13 18:23:57 -07:00
parent 672d2d2178
commit b368a0e5df
6 changed files with 20 additions and 20 deletions

View File

@@ -45,7 +45,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
}
}
private IEnumerable<ShapeDescriptorAlteration> GetInitializers() {
private IEnumerable<ShapeAlteration> GetInitializers() {
var strategy = _container.Resolve<IShapeDescriptorBindingStrategy>();
var builder = new ShapeTableBuilder();
strategy.Discover(builder);

View File

@@ -36,7 +36,7 @@ namespace Orchard.DisplayManagement.Descriptors {
});
}
static bool IsModuleOrRequestedTheme(ShapeDescriptorAlteration alteration, string themeName) {
static bool IsModuleOrRequestedTheme(ShapeAlteration alteration, string themeName) {
if (alteration == null ||
alteration.Feature == null ||
alteration.Feature.Extension == null) {

View File

@@ -3,10 +3,10 @@ using System.Collections.Generic;
using Orchard.Environment.Extensions.Models;
namespace Orchard.DisplayManagement.Descriptors {
public class ShapeDescriptorAlteration {
public class ShapeAlteration {
private readonly IList<Action<ShapeDescriptor>> _configurations;
public ShapeDescriptorAlteration(string shapeType, FeatureDescriptor feature, IList<Action<ShapeDescriptor>> configurations) {
public ShapeAlteration(string shapeType, FeatureDescriptor feature, IList<Action<ShapeDescriptor>> configurations) {
_configurations = configurations;
ShapeType = shapeType;
Feature = feature;

View File

@@ -6,27 +6,27 @@ using Orchard.DisplayManagement.Implementation;
using Orchard.Environment.Extensions.Models;
namespace Orchard.DisplayManagement.Descriptors {
public class ShapeDescriptorAlterationBuilder {
public class ShapeAlterationBuilder {
protected FeatureDescriptor _feature;
protected string _shapeType;
protected readonly IList<Action<ShapeDescriptor>> _configurations = new List<Action<ShapeDescriptor>>();
public ShapeDescriptorAlterationBuilder Named(string shapeType) {
public ShapeAlterationBuilder Named(string shapeType) {
_shapeType = shapeType;
return this;
}
public ShapeDescriptorAlterationBuilder From(FeatureDescriptor feature) {
public ShapeAlterationBuilder From(FeatureDescriptor feature) {
_feature = feature;
return this;
}
public ShapeDescriptorAlterationBuilder Configure(Action<ShapeDescriptor> action) {
public ShapeAlterationBuilder Configure(Action<ShapeDescriptor> action) {
_configurations.Add(action);
return this;
}
public ShapeDescriptorAlterationBuilder BoundAs(string bindingSource, Func<ShapeDescriptor, Func<DisplayContext, IHtmlString>> binder) {
public ShapeAlterationBuilder BoundAs(string bindingSource, Func<ShapeDescriptor, Func<DisplayContext, IHtmlString>> binder) {
// schedule the configuration
return Configure(descriptor => {
@@ -47,14 +47,14 @@ namespace Orchard.DisplayManagement.Descriptors {
});
}
public ShapeDescriptorAlterationBuilder OnCreating(Action<ShapeCreatingContext> action) {
public ShapeAlterationBuilder OnCreating(Action<ShapeCreatingContext> action) {
return Configure(descriptor => {
var existing = descriptor.Creating ?? Enumerable.Empty<Action<ShapeCreatingContext>>();
descriptor.Creating = existing.Concat(new[] { action });
});
}
public ShapeDescriptorAlterationBuilder OnCreated(Action<ShapeCreatedContext> action) {
public ShapeAlterationBuilder OnCreated(Action<ShapeCreatedContext> action) {
return Configure(descriptor => {
var existing = descriptor.Created ?? Enumerable.Empty<Action<ShapeCreatedContext>>();
descriptor.Created = existing.Concat(new[] { action });

View File

@@ -3,23 +3,23 @@ using System.Linq;
namespace Orchard.DisplayManagement.Descriptors {
public class ShapeTableBuilder {
readonly IList<ShapeDescriptorAlterationBuilderImpl> _descriptorBuilders = new List<ShapeDescriptorAlterationBuilderImpl>();
readonly IList<ShapeAlterationBuilderImpl> _descriptorBuilders = new List<ShapeAlterationBuilderImpl>();
public ShapeDescriptorAlterationBuilder Describe {
public ShapeAlterationBuilder Describe {
get {
var db = new ShapeDescriptorAlterationBuilderImpl();
var db = new ShapeAlterationBuilderImpl();
_descriptorBuilders.Add(db);
return db;
}
}
public IEnumerable<ShapeDescriptorAlteration> Build() {
public IEnumerable<ShapeAlteration> Build() {
return _descriptorBuilders.Select(b => b.Build());
}
class ShapeDescriptorAlterationBuilderImpl : ShapeDescriptorAlterationBuilder {
public ShapeDescriptorAlteration Build() {
return new ShapeDescriptorAlteration(_shapeType, _feature, _configurations.ToArray());
class ShapeAlterationBuilderImpl : ShapeAlterationBuilder {
public ShapeAlteration Build() {
return new ShapeAlteration(_shapeType, _feature, _configurations.ToArray());
}
}
}

View File

@@ -141,8 +141,8 @@
<ItemGroup>
<Compile Include="ContentManagement\Handlers\BuildModelContext.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeDescriptor.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeDescriptorAlteration.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeDescriptorAlterationBuilder.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeAlteration.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeAlterationBuilder.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeTable.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeTableBuilder.cs" />
<Compile Include="DisplayManagement\Shapes\ITagBuilderFactory.cs" />