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 Display(StructuredReportColumn column) { throwChange = false; this.Column = column; if (this.Column == null) { this.Column = GetNewColumn(); } String colName = Kernel.Util.RangeUtil.GetColumnName(this.Column.position); ColumnTextBox.Text = colName; TypeTextBox.Text = this.Column.type != null ? this.Column.type : ""; NameTextBox.Text = this.Column.name != null ? this.Column.name : ""; CellRefTextBox.Text = this.Column.cellRef != null ? this.Column.cellRef : ""; FreeTextBox.Text = this.Column.freeText != null ? this.Column.freeText : ""; LoopTextBox.Text = this.Column.loop != null ? this.Column.loop.name : ""; StartAtTextBox.Text = this.Column.incrementalStart.HasValue ? this.Column.incrementalStart.Value.ToString() : "1"; ShowCheckBox.IsChecked = this.Column.show; DisplaySpecial(this.Column.type); DisplayPeriodFormula(this.Column.type, this.Column.loop); PeriodFormulaNumberValueTextBox.Text = this.Column.periodFormulaNumber.HasValue ? this.Column.periodFormulaNumber.Value.ToString() : Kernel.Util.TagFormulaUtil.isSyntaxeFormulaCorrectly(this.Column.periodFormula) ? this.Column.periodFormula : ""; this.PeriodFormulaOperationComboBox.SelectedItem = string.IsNullOrEmpty(this.Column.periodFormulaOperation) ? Operation.PLUS.sign : this.Column.periodFormulaOperation; this.PeriodFormulaGranulartityComBox.SelectedItem = string.IsNullOrEmpty(this.Column.periodFormulaGranularity) ? Granularity.WEEK.name : this.Column.periodFormulaGranularity; ItemForm.Display(this.Column); this.ModifyThisColumn = false; throwChange = true; }
public StructuredReportColumn GetNewColumn() { StructuredReportColumn column = new StructuredReportColumn(); column.isModified = false; column.isAdded = false; column.position = this.StructuredReport.columnListChangeHandler.Items.Count + 1; return(column); }
public void SelecteColumn(Kernel.Ui.Office.Cell activeCell) { if (activeCell == null) { return; } int col = activeCell.Column; StructuredReportColumn column = this.StructuredReport.GetColumn(col); ColumnForms.Display(column); }
private void OnSelectedColumnChanged(object sender, SelectionChangedEventArgs e) { if (!throwEvent) { return; } StructuredReportColumn column = (StructuredReportColumn)this.ColumnsListBox.SelectedItem; FillActiveColumn(); ColumnForms.Display(column); if (selectionColumnChanged != null) { selectionColumnChanged(column); } }
public void Display(StructuredReportColumn column) { this.Column = column; FromListBox.ItemsSource = new ObservableCollection <Object>(); ToListBox.ItemsSource = new ObservableCollection <Object>(); if (column.type == StructuredReportColumn.Type.MEASURE.ToString()) { Measure measure = column.measure; if (measure != null && !measure.IsLeaf()) { FromListBox.ItemsSource = measure.GetLeafs(); } } else if (column.type == StructuredReportColumn.Type.PERIOD.ToString()) { if (column.periodName != null) { FromListBox.ItemsSource = column.periodName.Leafs; } else if (column.periodInterval != null && !column.periodInterval.IsLeaf) { FromListBox.ItemsSource = column.periodInterval.Leafs; } } else if (column.type == StructuredReportColumn.Type.TARGET.ToString()) { Target target = column.scope; if (target != null) { if (target is AttributeValue && !((AttributeValue)target).IsLeaf) { FromListBox.ItemsSource = ((AttributeValue)target).Leafs; } else if (target is Misp.Kernel.Domain.Attribute) { FromListBox.ItemsSource = ((Misp.Kernel.Domain.Attribute)target).LeafAttributeValues; } else if (target is Entity) { FromListBox.ItemsSource = ((Entity)target).LeafAttributeValues; } } } ToListBox.ItemsSource = column.itemListChangeHandler.Items; updateButtons(); }
public void SetListValue(List <Measure> values) { int col = this.StructuredReport.columnListChangeHandler.Items.Count + 1; StructuredReportColumn column = ColumnForms.Column; foreach (Measure value in values) { column = new StructuredReportColumn(); column.isModified = false; column.isAdded = false; column.position = col++; column.SetValue(value); this.StructuredReport.AddColumn(column); } ColumnForms.Display(column); OnColumnChanged(true); }