public void AddRowTest()
        {
            var percentWidths = new[] { 20, 30, 50 };
            var controls = new[]
                {
                    new InputBox(new XRect(0, 0, 10, 20), ""),
                    new InputBox(new XRect(0, 0, 10, 30), ""),
                    new InputBox(new XRect(0, 0, 10, 50), ""),
                };

            var rect = new XRect(0, 0, 100 + DefaultValues.Groupbox.MarginLeft + DefaultValues.Groupbox.MarginRight, 10);
            var target = new GroupBox(rect);

            target.AddRow(controls, percentWidths);
            foreach (var control in controls.Zip(target.Controls, (i, o) => new { Input = i, Output = o }))
            {
                Assert.AreSame(control.Input, control.Output);
            }

            Assert.AreEqual(target.Controls.ElementAt(0).Rect.Left, 0);
            Assert.AreEqual(target.Controls.ElementAt(1).Rect.Left, 20);
            Assert.AreEqual(target.Controls.ElementAt(2).Rect.Left, 50);

            Assert.AreEqual(target.Controls.ElementAt(0).Rect.Width, 20);
            Assert.AreEqual(target.Controls.ElementAt(1).Rect.Width, 30);
            Assert.AreEqual(target.Controls.ElementAt(2).Rect.Width, 50);

            Assert.AreEqual(target.Rect.Height, target.MarginBottom + target.MarginTop + 50);
        }
        public void AppendHeader(TNaglowek naglowek, string nip)
        {

            var headerBigFont = new XFont(DefaultValues.Groupbox.Font.FontFamily.Name, 12, XFontStyle.Bold, DefaultValues.Groupbox.Font.PdfOptions);

            var nipContent = new GroupBox(0, _document.Width * 3 / 4, "") { MarginLeft = 0, MarginTop = 0, MarginRight = 0, MarginBottom = 0 };
            var percentRowWidths = new[] { 45, 35, 20 };
            var rowControls = new[]
                {
                    new InputBox(Resources.InputTitle1, nip),
                    new InputBox(Resources.InputTitle2) {Brush = XBrushes.LightGray},
                    new InputBox(Resources.InputTitle3) {Brush = XBrushes.LightGray},
                };

            nipContent.AddRow(rowControls, percentRowWidths);
            _document.AddContainer(nipContent);

            var miesiacVal = naglowek.DateType == ItemChoiceType.Miesiac ? naglowek.Miesiac.ToString() : "";
            var kwartalVal = naglowek.ItemElementName == ItemChoiceType.Kwartal ? naglowek.Kwartal.ToString() : "";

            var titleContent = new GroupBox(0, _document.Width, "")
                {
                    MarginBottom = 10,
                    Brush = new XSolidBrush(XColor.FromArgb(128, 128, 255)),
                    Controls = new List<IControl>
                        {
                            new Label(20, 0, Resources.TitleLabel1) {Font = headerBigFont},
                            new Label(150, 0, Resources.TitleLabel2) {Font = headerBigFont},
                            new Label(270, 50, Resources.TitleLabel3) {Font = headerBigFont},
                            new InputBox(new XRect(200, 40, 60, 30), Resources.InputTitle4, miesiacVal),
                            new InputBox(new XRect(300, 40, 60, 30), Resources.InputTitle5, kwartalVal),
                            new InputBox(new XRect(400, 40, 80, 30), Resources.InputTitle6, naglowek.Rok)
                        }
                };
            _document.AddContainer(titleContent);

            var infoFont = new XFont(DocumentContainer.FontFamily, 8);
            var infoContent = new GroupBox(0, _document.Width, "")
                {
                    MarginLeft = 5,
                    MarginTop = 1,
                    MarginRight = 1,
                    MarginBottom = 1,
                    Controls = new List<IControl>
                        {
                            new Label(0, 0, Resources.InfoContent0Label) {Font = infoFont},
                            new Label(0, 10, Resources.InfoContent1Label) {Font = infoFont},
                            new Label(0, 40, Resources.InfoContent2Label) {Font = infoFont},
                            new Label(0, 50, Resources.InfoContent3Label) {Font = infoFont},
                            new Label(new XRect(80, 0, _document.Width, 50), Resources.InfoContent0Label){Font = infoFont},
                            new Label(new XRect(80, 10, _document.Width, 50), Resources.InfoContent1Value){Font = infoFont},
                            new Label(new XRect(80, 40, _document.Width, 50), Resources.InfoContent2Value){Font = infoFont},
                            new Label(new XRect(80, 50, _document.Width, 70), Resources.InfoContent3Value){Font = infoFont},
                        }
                };
            _document.AddContainer(infoContent);
        }
        public TableControl(int columnCount, ICollection<int> columnPercentWidths, double left, double width,
                            string title)
        {
            ColumnCount = columnCount;

            _columnWidths = columnPercentWidths;
            Rows = new Collection<IContainerControl>();
            HeadRows = new Collection<IContainerControl>();

            _left = left;
            _width = width;

            MarginLeft = DefaultValues.TableControl.MarginLeft;
            MarginRight = DefaultValues.TableControl.MarginRight;
            MarginTop = DefaultValues.TableControl.MarginTop;
            MarginBottom = DefaultValues.TableControl.MarginBottom;

            _backgroundControl = new GroupBox(title);

            Rect = new XRect(left, 0, width, MarginTop + MarginBottom);
        }
 public void AppendAContent(TKodUS kodUs)
 {
     var aContent = new GroupBox(0, _document.Width, Resources.ContainerTitleA);
     aContent.AddChild(new InputBox(new XRect(0, 0, _document.Width, 30))
         {
             Title = Resources.InputTitle7,
             Value = KodUSDictionary.GetCode(kodUs),
         });
     _document.AddContainer(aContent);
 }
        public void AppendFContent()
        {
            var fContent = new GroupBox(0, _document.Width,
                                        Resources.ContainerTitleF);

            var percentRow1Widths = new[] { 40, 60 };
            var row1Controls = new[]
                {
                    new InputBox(Resources.InputTitle20),
                    new InputBox(Resources.InputTitle21),
                };

            var percentRow2Widths = new[] { 25, 25, 50 };
            var row2Controls = new[]
                {
                    new InputBox(Resources.InputTitle22),
                    new InputBox(Resources.InputTitle23),
                    new InputBox(Resources.InputTitle24)
                };
            fContent.AddRow(row1Controls, percentRow1Widths);
            fContent.AddRow(row2Controls, percentRow2Widths);

            _document.AddContainer(fContent);
        }
        private void AppendB2Content(GroupBox b2Content, TAdresZagraniczny adres)
        {
            var percentRow1Widths = new[] { 20, 45, 35 };
            var row1Controls = new[]
                {
                    new InputBox(Resources.InputTitle10, KodKrajowyDictionary.GetCode(adres.KodKraju)),
                    new InputBox(Resources.InputTitle11),
                    new InputBox(Resources.InputTitle12),
                };

            var percentRow2Widths = new[] { 25, 45, 15, 15 };
            var row2Controls = new[]
                {
                    new InputBox(Resources.InputTitle13),
                    new InputBox(Resources.InputTitle14, adres.Ulica),
                    new InputBox(Resources.InputTitle15, adres.NrDomu),
                    new InputBox(Resources.InputTitle16, adres.NrLokalu)
                };

            var percentRow3Widths = new[] { 40, 20, 40 };
            var row3Controls = new[]
                {
                    new InputBox(Resources.InputTitle17, adres.Miejscowosc),
                    new InputBox(Resources.InputTitle18, adres.KodPocztowy),
                    new InputBox(Resources.InputTitle19)
                };


            b2Content.AddRow(row1Controls, percentRow1Widths);
            b2Content.AddRow(row2Controls, percentRow2Widths);
            b2Content.AddRow(row3Controls, percentRow3Widths);
        }
 private void AppendB1Content(GroupBox b1Content, TIdentyfikatorOsobyFizycznej osobyFizycznej)
 {
     var container = new GroupBox()
         {
             MarginTop = 0,
             MarginBottom = 0,
             MarginLeft = 0,
             MarginRight = 0,
             Brush = XBrushes.White
         };
     var personDataWidths = new[] { 25, 25, 25, 25 };
     var personDataControls = new[]
         {
             new InputBox(Resources.InputTitle9, osobyFizycznej.Nazwisko){Pen = XPens.Transparent},
             new InputBox(Resources.InputTitle9A, osobyFizycznej.ImiePierwsze){Pen = XPens.Transparent},
             new InputBox(Resources.InputTitle9B, osobyFizycznej.DataUrodzenia.ToString("dd-MM-yyyy")){Pen = XPens.Transparent},
             new InputBox(Resources.InputTitle9C, osobyFizycznej.PESEL){Pen = XPens.Transparent},
         };
     container.AddRow(personDataControls, personDataWidths);
     b1Content.AddRow(container);
 }
 private void AppendB1Content(GroupBox b1Content, TIdentyfikatorOsobyNiefizycznej osobyNiefizycznej)
 {
     var container = new GroupBox()
     {
         MarginTop = 0,
         MarginBottom = 0,
         MarginLeft = 0,
         MarginRight = 0,
         Brush = XBrushes.White
     };
     var companyDataWidths = new[] { 75, 25 };
     var companyDataControls = new[]
         {
             new InputBox(Resources.InputTitle9D, osobyNiefizycznej.PelnaNazwa){Pen = XPens.Transparent},
             new InputBox(Resources.InputTitle9E, osobyNiefizycznej.REGON){Pen = XPens.Transparent},
         };
     container.AddRow(companyDataControls, companyDataWidths);
     b1Content.AddRow(container);
 }
        /// <summary>
        /// Appends the content of the B.
        /// </summary>
        /// <param name="podmiot">The podmiot.</param>
        public void AppendBContent(DeklaracjaPodmiot1 podmiot)
        {
            var bContent = new GroupBox(0, _document.Width, Resources.ContainerTitleB) { MarginBottom = 10 };
            _document.AddContainer(bContent);

            var font = new XFont(DocumentContainer.FontFamily, 12, XFontStyle.Regular);

            var b1Content = new GroupBox(0, _document.Width, Resources.ContainerTitleB1)
                {
                    Font = font,
                    Controls = new List<IControl>
                        {
                            new InputBox(new XRect(0, 0, _document.Width, 30), Resources.InputTitle8),
                            new CheckBox(100, 5) {Title = Resources.InputTitle81, IsChecked = !podmiot.IsOsobaFizyczna},
                            new CheckBox(400, 5) {Title = Resources.InputTitle82, IsChecked = podmiot.IsOsobaFizyczna},
                        }
                };

            if (podmiot.IsOsobaFizyczna)
            {
                AppendB1Content(b1Content, podmiot.OsobaFizyczna);
            }
            else
            {
                AppendB1Content(b1Content, podmiot.OsobaNiefizyczna);
            }

            var b2Content = new GroupBox(0, _document.Width,
                                         podmiot.IsOsobaFizyczna
                                             ? Resources.ContainerTitleB2A
                                             : Resources.ContainerTitleB2B) { Font = font };


            if (podmiot.AdresZamieszkaniaSiedziby.IsAdresPol)
            {
                AppendB2Content(b2Content, podmiot.AdresZamieszkaniaSiedziby.AdresPolski);
            }
            else
            {
                AppendB2Content(b2Content, podmiot.AdresZamieszkaniaSiedziby.AdresZagraniczny);
            }

            _document.AddContainer(b1Content);
            _document.AddContainer(b2Content);
        }
        public void AddRow(ICollection<IControl> controls, int marginTop = 0, int marginBottom = 0)
        {
            if (controls.Count != ColumnCount)
            {
                throw new ArgumentException("Column count and controls count have to be equal");
            }

            GroupBox row = GetNewRow(_left + MarginLeft);
            ////Each Control box into groupbox with no margins, draw cell border
            var cells = new List<IControl>();
            foreach (IControl control in controls)
            {
                var groupBox = new GroupBox
                    {
                        MarginLeft = 0,
                        MarginRight = 0,
                        MarginTop = marginTop,
                        MarginBottom = marginBottom,
                    };
                groupBox.AddRow(control);
                cells.Add(groupBox);
            }

            row.AddRow(cells, _columnWidths);

            Rows.Add(row);
            _currentY += row.Rect.Height;

            Rect = new XRect(Rect.X, Rect.Y, Rect.Width, _currentY + MarginTop + MarginBottom);
        }
 private GroupBox GetNewRow(double left = 0)
 {
     //Headrow container at end of table; _currentY - end of table
     var headRow = new GroupBox(new XRect(_left, _currentY, _width, 20))
         {
             MarginBottom = 0,
             MarginTop = 0,
             Brush = XBrushes.LightGray,
             Pen = XPens.LightGray
         };
     return headRow;
 }
 public void AddChildTest()
 {
     var rect = new XRect();
     var target = new GroupBox(rect);
     IControl control = new Label(0, 0, "foo");
     target.AddChild(control);
     Assert.AreEqual(target.Controls.Count, 1);
 }
 public void AddRowTest2()
 {
     var rect = new XRect(0, 0, 100, 20);
     var target = new GroupBox(rect);
     ICollection<IControl> controls = new Collection<IControl> { new Label(0, 0, "foo"), new Label(0, 0, "bar") };
     ICollection<int> percentWidths = new Collection<int>() { 50, 50 };
     target.AddRow(controls, percentWidths);
     Assert.AreEqual(target.Controls.Count, 2);
 }
 public void AddRowTest1()
 {
     var rect = new XRect(0, 0, 50, 50);
     var target = new GroupBox(rect);
     IControl control = new InputBox("foo", "bar");
     target.AddRow(control);
     Assert.AreEqual(target.Controls.Contains(control), true);
 }