public override void Apply(IScreenItem Source) { base.Apply(Source); var source = Source as IScreenSection; Apply_Actual(source); }
public override void Apply(IScreenItem sourceItem) { var source = sourceItem as IScreenField; base.Apply(source); this.Usage = source.Usage; }
public static ScreenItemInstance FindItem( this IScreenItem item, IScreenLoc Start, IScreenLoc FindZeroLoc, ScreenContent Content) { ScreenItemInstance findItem = null; if (item.ItemType == ShowItemType.Section) { var sectionItem = item as IScreenSection; findItem = sectionItem.FindItem(Start, FindZeroLoc, Content); } else { // adjust screen loc of the item by start pos of the section it is contained in. var adjRow = Start.RowNum - 1; var adjCol = Start.ColNum - 1; var loc = new OneScreenLoc( item.ScreenLoc.RowNum + adjRow, item.ScreenLoc.ColNum + adjCol); var zeroLoc = loc.ToZeroRowCol(); var itemAtomic = item as IScreenAtomic; var range = new ScreenLocRange(zeroLoc, itemAtomic.Length, Content.ScreenDim); if (range.Contains(FindZeroLoc) == true) findItem = new ScreenItemInstance(item, range.From); } return findItem; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems) { IScreenItem item = items.First() as IScreenItem; item.Viewport.RestoreLayout(); return(null); }
public static string GetValue( this IScreenItem Item) { if (Item is IScreenLiteral) return (Item as IScreenLiteral).Value; else return ""; }
public static ScreenItemModel Factory(ShowItemType ItemType, IScreenItem source) { var item = ScreenItem.Factory(ItemType, source); var model = ScreenItemModel.Factory(item); return(model); }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems) { IScreenItem screen = modItems.First() as IScreenItem; IEnumerable <Window> windows = null; if (items.First() is IApplicationItem) { windows = items.Cast <IApplicationItem> ().SelectMany(app => WindowUtils.WindowListForCmd(app.Exec)); } else if (items.First() is IWindowItem) { windows = items.Cast <IWindowItem> ().SelectMany(wi => wi.Windows); } if (windows != null) { foreach (Wnck.Window window in windows) { screen.Viewport.MoveWindowInto(window); } } return(null); }
public void InsertItemBefore(IScreenItem item, IScreenItem nextItem) { //create a temp list to hold everything var tempItems = new List <IScreenItem>(); //add all the items to the list foreach (var currentItem in Items) { //check if this is the item to add after if (currentItem == nextItem) { tempItems.Add(item); } tempItems.Add(currentItem); } //create a new layout list Items = new List <IScreenItem>(); //add all the temp items to the layout list foreach (var tempItem in tempItems) { AddItem(tempItem); } }
/// <summary> /// construct a new ScreenItem with the specific itemType. Then apply properties /// from the source item. /// </summary> /// <param name="itemType"></param> /// <param name="source"></param> /// <returns></returns> public static IScreenItem Factory(ShowItemType itemType, IScreenItem source) { var item = Factory(itemType); item.ApplyMatch(source); return(item); if (item is ScreenAtomic) { var atomic = item as ScreenAtomic; if (source is IScreenAtomic) { atomic.Apply(source as IScreenAtomic); } else { (item as ScreenItem).ApplyMatch(source as IScreenItem); } } else if (item is ScreenSection) { var section = item as ScreenSection; if (source is IScreenSection) { section.Apply(source); } else { (section as ScreenItem).ApplyMatch(source); } } return(item); }
public static IScreenItem Factory(ShowItemType itemType) { IScreenItem item = null; if ((itemType == ShowItemType.Field) || (itemType == ShowItemType.StaticLit) || (itemType == ShowItemType.VarLit)) { item = new ScreenField(); } else if ((itemType == ShowItemType.Literal) || (itemType == ShowItemType.Static)) { item = new ScreenLiteral(); } else if (itemType == ShowItemType.Section) { item = new ScreenSection(); } else { throw new Exception("unsupported itemType"); } return(item); }
/// <summary> /// Set the position of a widget to be relative to this layout /// </summary> /// <param name="item"></param> private void SetItemPosition(IScreenItem item, Rectangle rect) { //point to set the location of the item Point pos = Point.Zero; switch (item.Horizontal) { case HorizontalAlignment.Center: { pos.X = Rect.Center.X; } break; case HorizontalAlignment.Left: { pos.X = Rect.Left; } break; case HorizontalAlignment.Right: { pos.X = Rect.Right; } break; } switch (item.Vertical) { case VerticalAlignment.Center: { pos.Y = Rect.Center.Y; } break; case VerticalAlignment.Top: { pos.Y = Rect.Top; } break; case VerticalAlignment.Bottom: { pos.Y = Rect.Bottom; } break; } //set the position of the new item item.Position = pos; }
public bool RemoveItem(IScreenItem item) { var result = Layout.RemoveItem(item); CalculateRect(); return(result); }
public static IScreenItem ToScreenItem(this XElement Elem, XNamespace Namespace) { IScreenItem item = null; if (Elem != null) { // first get itemType. Could be field, literal or section. var itemType = Elem.Element(Namespace + "ItemType").StringOrDefault("").TryParseShowItemType().Value; var itemName = Elem.Element(Namespace + "ItemName").StringOrDefault(""); var screenLoc = Elem.Element(Namespace + "ScreenLoc").ToScreenLoc(Namespace) as OneScreenLoc; var hoverCode = Elem.Element(Namespace + "HoverCode").ToIEnumerableString("Item").ToArray(); var hoverXaml = Elem.Element(Namespace + "HoverXaml").ToIEnumerableString("Item").ToArray(); item = ScreenItem.Factory(itemType); item.ItemType = itemType; item.ItemName = itemName; item.MatchNum = Elem.Element(Namespace + "MatchNum").IntOrDefault(0).Value; item.ItemGuid = Elem.Element(Namespace + "ItemGuid").StringOrDefault(null); item.IsOptional = Elem.Element(Namespace + "IsOptional").BooleanOrDefault(false).Value; item.ScreenLoc = screenLoc; item.HoverCode = hoverCode; item.HoverXaml = hoverXaml; if (item is IScreenAtomic) { var atom = item as ScreenAtomic; atom.Length = Elem.Element(Namespace + "Length").IntOrDefault(0).Value; atom.DsplyAttr = Elem.Element(Namespace + "DsplyAttr").ToDsplyAttr(Namespace); } if (item is ScreenLiteral) { var lit = item as ScreenLiteral; lit.ListValues = Elem.Element(Namespace + "ListValues").ListStringOrDefault(Namespace, "Item", null); } if (item is IScreenField) { var fld = item as IScreenField; fld.Usage = Elem.Element(Namespace + "Usage").StringOrDefault("").TryParseShowUsage().Value; } if (item is IScreenSection) { var sect = item as IScreenSection; var itemList = Elem.Element(Namespace + "ItemList").ToScreenItemList(Namespace); sect.Items = new List<IScreenItem>(); var sectionHeader = item as ISectionHeader; sectionHeader.LoadItems(itemList); sect.RepeatCount = Elem.Element(Namespace + "RepeatCount").IntOrDefault(0).Value; sect.IsExpanded = Elem.Element(Namespace + "IsExpanded").BooleanOrDefault(false).Value; sect.AssocSectionName = Elem.Element(Namespace + "AssocSectionName").StringOrDefault(""); sect.PurposeCode = Elem.Element(Namespace + "PurposeCode").StringOrDefault("").TryParseScreenPurposeCode(); } } return item; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems) { IScreenItem item = items.First() as IScreenItem; item.Viewport.ShowDesktop(); return(null); }
public override void Apply(IScreenItem sourceItem) { var source = sourceItem as IScreenLiteral; base.Apply(source); // this.Value = source.Value; this.ListValues = source.ListValues.ToList(); }
/// <summary> /// Set the position of the item as store it /// </summary> /// <param name="item"></param> public override void AddItem(IScreenItem item) { SetItemPosition(item, CalculateRect()); //store the new item Items.Add(item); Sort(); }
public override void Apply(IScreenItem Source) { var source = Source as IScreenAtomic; base.Apply(source); this.Length = source.Length; this.DsplyAttr = source.DsplyAttr; }
/// <summary> /// Set the position of a widget to be relative to this layout /// </summary> /// <param name="item"></param> protected virtual void UpdateItemPosition(IScreenItem item, Rectangle rect) { //Get the delta position var delta = PreviousRect.Location - rect.Location; //add the delt to the current position item.Position -= delta; }
public static Tuple<DataItem, DataItemReport> CaptureReport( this IScreenItem item, IScreenLoc Start, ScreenContent Content) { string captureText = null; DataItem dataItem = null; DataItemReport itemReport = null; ContentItemBase contentItem = null; // get the content item at the rowcol location. bool rc = true; IScreenAtomic atomicItem = null; // adjust screen loc of the item by start pos of the section it is contained in. var adjRow = Start.RowNum - 1; var adjCol = Start.ColNum - 1; var loc = new OneScreenLoc( item.ScreenLoc.RowNum + adjRow, item.ScreenLoc.ColNum + adjCol); var zeroLoc = loc.ToZeroRowCol(); if (item.ItemType != ShowItemType.Section) { rc = Content.FieldDict.TryGetValue(zeroLoc, out contentItem); atomicItem = item as IScreenAtomic; } if (rc == false) { } else if (item.ItemType == ShowItemType.Section) { var sectionItem = item as IScreenSection; itemReport = sectionItem.CaptureReport(Content); } else if (item.ItemType == ShowItemType.Field) { if ((contentItem is ContentField) == true) { var contentField = contentItem as ContentField; dataItem = new DataItem(item.ItemName, contentField.GetShowText(Content)); captureText = item.ItemName + "=" + contentField.GetShowText(Content); } } // match fixed literal else if (item.ItemType == ShowItemType.Literal) { if ((contentItem is ContentText) == true) { var contentText = contentItem as ContentText; var itemLit = item as IScreenLiteral; var ctValue = contentText.GetShowText(Content).TrimEndWhitespace(); } } return new Tuple<DataItem, DataItemReport>(dataItem, itemReport); }
public override void ApplyMatch(IScreenItem sourceItem) { base.ApplyMatch(sourceItem); if (sourceItem is IScreenField) { var source = sourceItem as IScreenField; this.Usage = source.Usage; } }
void Apply_Actual(IScreenItem source) { this.ItemName = source.ItemName; this.ItemGuid = source.ItemGuid; this.MatchNum = source.MatchNum; this.ScreenLoc = source.ScreenLoc; this.HoverCode = source.HoverCode; this.IsOptional = source.IsOptional; }
public override void ApplyMatch(IScreenItem sourceItem) { base.ApplyMatch(sourceItem); if (sourceItem is IScreenSection) { var source = sourceItem as IScreenSection; Apply_Actual(source); } }
/// <summary> /// apply source to target where the types match. /// </summary> /// <param name="sourceItem"></param> public override void ApplyMatch(IScreenItem sourceItem) { base.ApplyMatch(sourceItem); if (sourceItem is IScreenLiteral) { var source = sourceItem as IScreenLiteral; this.ListValues = source.ListValues.ToObservableCollection(); } }
public override void ApplyMatch(IScreenItem sourceItem) { base.ApplyMatch(sourceItem); if (sourceItem is IScreenLiteral) { var source = sourceItem as IScreenLiteral; // this.Value = source.Value; this.ListValues = source.ListValues.ToList(); } }
public override void Apply(IScreenItem Item) { base.Apply(Item); if (Item is IScreenField) { var item = Item as IScreenField; this.Usage = item.Usage; } }
public override void AddItem(IScreenItem item) { PrepareAdd(item); //add to the stack control Stack.AddItem(item); UpdateMinMaxScroll(); UpdateScrollBars(); }
public void InsertItem(IScreenItem item, IScreenItem prevItem) { PrepareAdd(item); //add to the stack control Stack.InsertItem(item, prevItem); UpdateMinMaxScroll(); UpdateScrollBars(); }
public override void AddItem(IScreenItem item) { var widget = item as IWidget; if (null != widget) { widget.TransitionObject = new WipeTransitionObject(TransitionWipeType.None); } base.AddItem(item); }
public void InsertItemBefore(IScreenItem item, IScreenItem nextItem) { PrepareAdd(item); //add to the stack control Stack.InsertItemBefore(item, nextItem); UpdateMinMaxScroll(); UpdateScrollBars(); }
public override void ApplyMatch(IScreenItem Source) { base.ApplyMatch(Source); if (Source is IScreenAtomic) { var source = Source as IScreenAtomic; this.Length = source.Length; this.DsplyAttr = source.DsplyAttr; } }