コード例 #1
0
        public void SizeTest()
        {
            CTableEntryList list = new CTableEntryList();

            for (int i = 1; i <= 10; i++)
            {
                list.addEntry(new CTableEntry(i.ToString()));
                Assert.IsTrue(list.Size == i);
            }
        }
コード例 #2
0
        public void addEntryTest()
        {
            CTableEntryList list = new CTableEntryList();

            for (int i = 0; i < 10; i++)
            {
                CTableEntry entry = new CTableEntry(i.ToString());
                list.addEntry(entry);
            }

            Assert.IsTrue(list.Size == 10);
        }
コード例 #3
0
        public void ItemTestIndex()
        {
            CTableEntryList list     = new CTableEntryList();
            CAttributeType  attrType = new CAttributeType(0);

            attrType.setUsed("asd", E_DATATYPE.E_STRING, false);

            for (int i = 0; i < 10; i++)
            {
                CTableEntry entry = new CTableEntry(i.ToString());
                entry.addValue(new CAttributeValue(attrType, i.ToString(), i.ToString(), null));
                list.addEntry(entry);
            }

            CTableEntry singleEntry;

            singleEntry = list[5];

            Assert.IsTrue(singleEntry.Size == 1);
            Assert.IsTrue(singleEntry[0].EntryIndex == "5");
            Assert.IsTrue(singleEntry[0].StringValue == "5");
        }
コード例 #4
0
        /*********************************************************************/
        /// <summary>
        /// Wird aufgrufen wenn ein Button von der Tabellenansicht geklickt wurde
        /// </summary>
        private void RibbonButtonTableView_Click(object sender, RoutedEventArgs e)
        {
            // Spalte hinzufügen Button
            if (sender.Equals(btnAddColumn) == true)
            {
                string name = Microsoft.VisualBasic.Interaction.InputBox("Geben Sie den Namen des Attributs ein", "Attributname", "");
                if (!name.Equals(""))
                {
                    CAttributeType columnData = mBusinessLogic.addAttribute(name);
                    addDatagridColumn(columnData);
                }
            }
            // selektierte Spalte löschen Button
            else if (sender.Equals(btnRemoveColumn) == true)
            {
                if (datagrid1.CurrentColumn != null)
                {
                    DataGridColumn column = datagrid1.CurrentColumn;
                    if (mBusinessLogic.removeAttribute((string)column.Header) == true)
                    {
                        datagrid1.Columns.Remove(column);
                    }
                }
            }
            // Neue Zeile hinzufügen
            else if (sender.Equals(btnAddRow) == true)
            {
                mTableEntryList.addEntry(mBusinessLogic.addDataset());
            }
            // Selektierte Zeile Löschen
            else if (sender.Equals(btnRemoveRow) == true)
            {
                if (datagrid1.SelectedItem != null)
                {
                    CTableEntry selectedEntry = (CTableEntry)datagrid1.SelectedItem;
                    if (mBusinessLogic.removeDataset(selectedEntry) == true)
                    {
                        mTableEntryList.Remove(selectedEntry);
                    }
                }
            }
            // Selektierte Zeile als Zielattribut setzen
            else if (sender.Equals(btnSetTargetAttribute) == true)
            {
                CTableColumn selectedColumn = datagrid1.CurrentColumn as CTableColumn;
                if (selectedColumn != null)
                {
                    if (mBusinessLogic.setTargetAttribute(selectedColumn.ColumnDataType) == true)
                    {
                        foreach (CTableColumn column in datagrid1.Columns)
                        {
                            //column.HeaderStyle = FindResource("DefaultColumnHeaderStyle") as Style;
                            column.HeaderStyle = null;
                        }

                        selectedColumn.HeaderStyle = FindResource("TargetValueColumnHeaderStyle") as Style;
                        CTableEntry entry = (CTableEntry)datagrid1.CurrentItem;

                        setTreeViewsEnabled(true);
                    }
                    else
                    {
                        MessageBox.Show("Das Attribut \"" + selectedColumn.ColumnDataType.Name + "\" kann nicht als Zielattribut gesetzt werden, da nur Datensätze mit den Einträgen \"j\" und \"n\" zugelassen sind.", "Ungültiges Zielattribut", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
            }
        }