protected void AddDefaultAttributeValues(Domain.AttributeValue parent) { Domain.AttributeValue addNewAttribute = new Kernel.Domain.AttributeValue(); addNewAttribute.IsAddNewItem = true; addNewAttribute.name = "Add new value..."; addNewAttribute.parent = this.Root; this.Root.childrenListChangeHandler.Items.Add(addNewAttribute); if (parent.isCompleted && parent.HasMoreElements()) { Domain.AttributeValue showModeAttributes = new Domain.AttributeValue(); showModeAttributes.IsShowMoreItem = true; showModeAttributes.name = "Show more value..."; showModeAttributes.parent = parent; parent.childrenListChangeHandler.Items.Add(showModeAttributes); } if (parent != this.Root && this.Root.isCompleted && this.Root.HasMoreElements()) { Domain.AttributeValue showModeAttributes = new Domain.AttributeValue(); showModeAttributes.IsShowMoreItem = true; showModeAttributes.name = "Show more values..."; showModeAttributes.parent = this.Root; this.Root.childrenListChangeHandler.Items.Add(showModeAttributes); } }
private void OnStructuredReportPropertiesSelectionColumnChange(object obj) { StructuredReportEditorItem page = (StructuredReportEditorItem)getStructuredReportEditor().getActivePage(); if (page == null) return; if (obj is StructuredReportColumn) { StructuredReportColumn column = (StructuredReportColumn)obj; if (column.type.Equals(StructuredReportColumn.Type.TARGET.ToString())) { Target target = column.scope; if (target.typeName.Equals(typeof(AttributeValue).Name, StringComparison.OrdinalIgnoreCase)) { Kernel.Domain.AttributeValue value = GetStructuredReportService().ModelService.getAttributeValue(target.oid.Value, target.name); column.SetValue(value); page.getStructuredReportForm().StructuredReportPropertiesPanel.ColumnForms.Display(column); } if (target.typeName.Equals(typeof(Misp.Kernel.Domain.Attribute).Name, StringComparison.OrdinalIgnoreCase)) { Misp.Kernel.Domain.Attribute value = GetStructuredReportService().ModelService.getAttributeByOid(target.oid.Value); column.SetValue(value); page.getStructuredReportForm().StructuredReportPropertiesPanel.ColumnForms.Display(column); } if (target.typeName.Equals(typeof(Entity).Name, StringComparison.OrdinalIgnoreCase)) { Misp.Kernel.Domain.Entity value = GetStructuredReportService().ModelService.getEntityByOid(target.oid.Value); column.SetValue(value); page.getStructuredReportForm().StructuredReportPropertiesPanel.ColumnForms.Display(column); } } } }
public void setValue(Kernel.Domain.AttributeValue value) { if (this.ModelService == null) { return; } this.ReconciliationContextPanel.ModelService = this.ModelService; this.ReconciliationContextPanel.setAttributeValue(value); }
public void setAttributeValue(Kernel.Domain.AttributeValue value) { this.getCurrentFieldValue().setValue(value); if (ItemChanged != null) { ItemChanged(this.WriteOffFieldValue); } display(); }
static void addParent(String name, ref List <Kernel.Domain.AttributeValue> liste) { if (!String.IsNullOrEmpty(name)) { Kernel.Domain.AttributeValue parent = new Kernel.Domain.AttributeValue() { name = name }; liste.Add(parent); } }
private void OnSelectedItemChanged(object sender, SelectedItemChangedEventArgs e) { Kernel.Domain.AttributeValue value = GetSelectedValue(); if (value != null && value.IsShowMoreItem) { ForgetDefaultAttributeValues(value.parent); if (value.parent.HasMoreElements() && ShowMore != null) { ShowMore(value); } AddDefaultAttributeValues(value.parent); return; } }
/// <summary> /// Initialize chidren's parent /// </summary> /// <param name="item"></param> private void RefreshParent(Kernel.Domain.AttributeValue item, bool addToSource = true) { if (item != null) { foreach (Domain.AttributeValue child in item.childrenListChangeHandler.Items) { if (addToSource) { Source.Add(child); } child.SetParent(item); RefreshParent(child); } } }
public void setAttributeValue(Kernel.Domain.AttributeValue value) { if (canSetValue(ActiveItem)) { if (ActiveItem == debitValuePanel) { reconciliationContext.debitAttributeValue = value; } else if (ActiveItem == creditValuePanel) { reconciliationContext.creditAttributeValue = value; } this.ActiveItem.setValue(value); } }
protected String GetNewAttributeValueName(string name) { Domain.AttributeValue attribute = new Domain.AttributeValue(); attribute.name = name; if (Root != null) { Kernel.Domain.AttributeValue m = (Domain.AttributeValue)Root.GetChildByName(attribute.name); int i = 1; while (m != null) { attribute.name = name + i++; m = (Domain.AttributeValue)Root.GetChildByName(attribute.name); } } return(attribute.name); }
protected Domain.AttributeValue GetNewAttributeValue() { Domain.AttributeValue attribute = new Domain.AttributeValue(); attribute.name = "AttributeValue"; if (Root != null) { Kernel.Domain.AttributeValue m = null; int i = 1; do { attribute.name = "AttributeValue" + i++; m = (Domain.AttributeValue)Root.GetChildByName(attribute.name); }while (m != null); } return(attribute); }
/// <summary> /// /// </summary> /// <param name="attribute"></param> /// <param name="name"></param> /// <returns>La attribute à copier</returns> private bool ValidateName(Kernel.Domain.AttributeValue value, string name) { if (string.IsNullOrWhiteSpace(name)) { Kernel.Util.MessageDisplayer.DisplayError("Empty value name", "Name can't be empty! "); return(false); } Domain.AttributeValue found = getAttributeValueByName(this.Root, name); if (found == null || found.Equals(value)) { return(true); } Kernel.Util.MessageDisplayer.DisplayError("Duplicate value", "There is another value named : '" + name + "'!"); return(false); }
protected override IHierarchyObject GetNewTreeViewModel() { Kernel.Domain.AttributeValue value = new Kernel.Domain.AttributeValue(); value.name = "Value1"; if (Root != null) { Kernel.Domain.AttributeValue m = null; int i = 1; do { value.name = "Value" + i++; m = (Kernel.Domain.AttributeValue)Root.GetChildByName(value.name); }while (m != null); } return(value); }
private void treeviewMatch_SelectionChanged(object newSelection) { if (newSelection == null) { return; } if (newSelection is Kernel.Domain.AttributeValue) { selectedAttributeValue = (Kernel.Domain.AttributeValue)newSelection; this.manualMatch.Text = selectedAttributeValue.name; this.okButton.IsEnabled = true; if (this.tableSaveIssue.targetItem == null) { return; } this.tableSaveIssue.targetItem.value = (Kernel.Domain.AttributeValue)newSelection; } }
private void onAttributeValueShowMore(object item) { if (item != null && item is Kernel.Domain.AttributeValue) { Kernel.Domain.AttributeValue selection = (Kernel.Domain.AttributeValue)item; Kernel.Domain.AttributeValue parent = selection.parent; parent.DataFilter.page++; BrowserDataPage <Kernel.Domain.AttributeValue> page = parent.parent != null ? ModelService.getAttributeValueChildren(parent.DataFilter) : ModelService.getRootAttributeValuesByAttribute(parent.DataFilter); parent.isCompleted = true; attributeValueTreeList.addPage(parent, page); parent.DataFilter.page = page.currentPage; parent.DataFilter.totalPages = page.pageCount; } }
/// <summary> /// Display entity attributes. /// Builds the root node and calls DisplayRoot() /// </summary> /// <param name="entity"> Entity to display </param> public void DisplayAttribute(Domain.Attribute attribute) { this.Attribute = attribute; if (attribute != null) { if (attribute.IsDefault) { this.Attribute = null; this.DisplayRoot(null); return; } Domain.AttributeValue root = new Kernel.Domain.AttributeValue(); root.name = "Root"; root.childrenListChangeHandler = attribute.valueListChangeHandler; root.DataFilter = this.Attribute.DataFilter; this.DisplayRoot(root); } else { this.DisplayRoot(null); } }
private void onAttributeValueExpend(object item) { if (item != null && item is Kernel.Domain.AttributeValue) { Kernel.Domain.AttributeValue selection = (Kernel.Domain.AttributeValue)item; if (selection != null && !selection.isCompleted && selection.oid.HasValue) { if (selection.DataFilter == null) { selection.DataFilter = new BrowserDataFilter(); selection.DataFilter.groupOid = selection.oid.Value; selection.DataFilter.page = 0; selection.DataFilter.pageSize = 10; } selection.DataFilter.page++; BrowserDataPage <Kernel.Domain.AttributeValue> page = ModelService.getAttributeValueChildren(selection.DataFilter); attributeValueTreeList.addPage(selection, page); selection.isCompleted = true; selection.DataFilter.page = page.currentPage; selection.DataFilter.totalPages = page.pageCount; } } }
private void OnNewClick(object sender, RoutedEventArgs e) { Domain.AttributeValue parent = GetSelectedValue(); if (IsUsedToGenerateUniverse(parent)) { return; } Kernel.Domain.AttributeValue attributeValue = GetNewAttributeValue(); if (parent == null) { parent = this.Root; } if (parent != null) { ForgetDefaultAttributeValues(parent); parent.AddChild(attributeValue); AddDefaultAttributeValues(parent); int row = Source.Count; Source.Remove(attributeValue); if (row - 2 >= 0) { Source.Insert(row - 2, attributeValue); } else { Source.Add(attributeValue); } SetSelectedValue(attributeValue); if (Changed != null) { Changed(); } } }
public void setValue(Kernel.Domain.AttributeValue value) { //this.WriteOffConfigPanel.ActiveFieldPanel.setAttribute(attribute); }
public void setAttributeValue(Kernel.Domain.AttributeValue attributeValue) { this.FieldValuePanel.setAttributeValue(attributeValue); }
public static List <Object> GetTextDatas(string format) { List <Object> datas = new List <Object>(0); if (format != null && System.Windows.Clipboard.ContainsText()) { string name = System.Windows.Clipboard.GetText(); if (format.Equals(GROUP_CLIPBOARD_FORMAT)) { foreach (string copies in ExcelCellsCopies(name)) { Domain.BGroup group = new Domain.BGroup(); group.name = copies; group.subjectType = Domain.SubjectType.DEFAULT.label; datas.Add(group as Domain.BGroup); } } else if (format.Equals(MEASURE_CLIPBOARD_FORMAT)) { Kernel.Domain.Measure parent = null; List <String> listeResult = ExcelCellsCopies(name); if (listeResult == null) { return(null); } if (listeResult[0] == IS_PARENT_CHILD_MODE) { parent = new Domain.Measure() { name = listeResult[1] }; listeResult.RemoveAt(0); listeResult.RemoveAt(0); } foreach (string copies in listeResult) { Domain.Measure value = new Domain.Measure(); value.name = copies.Trim(); if (parent != null) { parent.AddChild(value as Domain.Measure); } else { datas.Add(value as Domain.Measure); } } if (parent != null) { datas.Add(parent as Domain.Measure); } } else if (format.Equals(ATTRIBUTE_CLIPBOARD_FORMAT)) { List <String> listeResult = ExcelCellsCopies(name); if (listeResult[0] == IS_PARENT_CHILD_MODE) { listeResult.RemoveAt(0); } foreach (string copies in listeResult) { Domain.Attribute attribute = new Domain.Attribute(); attribute.name = copies; datas.Add(attribute as Domain.Attribute); } } else if (format.Equals(ATTRIBUTE_VALUE_CLIPBOARD_FORMAT)) { Kernel.Domain.AttributeValue parent = null; List <String> listeResult = ExcelCellsCopies(name); if (listeResult == null) { return(null); } if (listeResult[0] == IS_PARENT_CHILD_MODE) { parent = new Domain.AttributeValue() { name = listeResult[1] }; listeResult.RemoveAt(0); listeResult.RemoveAt(0); } foreach (string copies in listeResult) { Domain.AttributeValue value = new Domain.AttributeValue(); value.name = copies; if (parent != null) { parent.AddChild(value as Domain.AttributeValue); } else { datas.Add(value as Domain.AttributeValue); } } if (parent != null) { datas.Add(parent as Domain.AttributeValue); } } } return(datas); }
/// <summary> /// Cette méthode vérifie si le presse-papier contient un type de donnés et /// renvoie un objet de ce type /// </summary> /// <param name="format">Le format du type de données</param> /// <returns>L'objet présent dans le presse-papiers</returns> public static List <Domain.IHierarchyObject> GetHierarchyObject(string format) { List <Domain.IHierarchyObject> copiedElements = new List <Domain.IHierarchyObject>(0); if (format == null) { return(copiedElements); } if (System.Windows.Clipboard.ContainsData(format)) { try { if (System.Windows.Clipboard.GetData(format) is IList) { copiedElements = (List <Domain.IHierarchyObject>)System.Windows.Clipboard.GetData(format); } else { copiedElements.Add(System.Windows.Clipboard.GetData(format) as Domain.IHierarchyObject); } return(copiedElements); } catch (Exception) { Kernel.Util.MessageDisplayer.DisplayError("Error copy", "Unable to paste " + format.Split('.')[1]); return(null); } } else if (System.Windows.Clipboard.ContainsText()) { string name = System.Windows.Clipboard.GetText(); if (format.Equals(GROUP_CLIPBOARD_FORMAT)) { foreach (string copies in ExcelCellsCopies(name)) { Domain.BGroup group = new Domain.BGroup(); group.name = copies; group.subjectType = Domain.SubjectType.DEFAULT.label; copiedElements.Add(group as Domain.BGroup); } return(copiedElements); } if (format.Equals(ATTRIBUTE_CLIPBOARD_FORMAT)) { List <String> listeResult = ExcelCellsCopies(name); if (listeResult[0] == IS_PARENT_CHILD_MODE) { listeResult.RemoveAt(0); } foreach (string copies in listeResult) { Domain.Attribute attribute = new Domain.Attribute(); attribute.name = copies; copiedElements.Add(attribute as Domain.Attribute); } return(copiedElements); } if (format.Equals(ATTRIBUTE_VALUE_CLIPBOARD_FORMAT)) { Kernel.Domain.AttributeValue parent = null; List <String> listeResult = ExcelCellsCopies(name); if (listeResult == null) { return(null); } if (listeResult[0] == IS_PARENT_CHILD_MODE) { parent = new Domain.AttributeValue() { name = listeResult[1] }; listeResult.RemoveAt(0); listeResult.RemoveAt(0); } foreach (string copies in listeResult) { Domain.AttributeValue value = new Domain.AttributeValue(); value.name = copies; if (parent != null) { parent.AddChild(value as Domain.AttributeValue); } else { copiedElements.Add(value as Domain.AttributeValue); } } if (parent != null) { copiedElements.Add(parent as Domain.AttributeValue); } return(copiedElements); // List<String> listeResult = ExcelGetCellsCopies(name); // List<Kernel.Domain.AttributeValue> Liste = ExcelGetCellsCopies(name, ATTRIBUTE_VALUE_CLIPBOARD_FORMAT); //if (listeResult == null) return null; //if (listeResult[0] == IS_PARENT_CHILD_MODE) //{ // parent = new Domain.AttributeValue() // { // name = listeResult[1] // }; // listeResult.RemoveAt(0); // listeResult.RemoveAt(0); //} //foreach (string copies in listeResult) //{ // Domain.AttributeValue value = new Domain.AttributeValue(); // value.name = copies; // if (parent != null) parent.AddChild(value as Domain.AttributeValue); // else copiedElements.Add(value as Domain.AttributeValue); //} //if (parent != null) copiedElements.Add(parent as Domain.AttributeValue); //return copiedElements; } } return(null); }