示例#1
0
        internal static void Main(string[] args)
        {
            IWidget widget = new BorderDecorator(new ScrollDecorator(new TextField(10.1, 12.1)));

            widget.Draw();
            Console.Read();
        }
示例#2
0
        public void DecoratorTest()
        {
            IWidget widget = new BorderDecorator(
                new BorderDecorator(
                    new Button(200, 70)));

            widget.Draw();
        }
示例#3
0
        static void Main(string[] args)
        {
            // plain old text view
            var textView = new TextView();

            // decorated text view
            // TODO uncomment this line when you have refactored TextViewWithBorder and TextViewWithScroll
            var decoratedTextView = new BorderDecorator(new ScrollDecorator(textView, 54), 5);

            // change this line to render your decorated text view
            RenderView (decoratedTextView);
        }
示例#4
0
        static void Main(string[] args)
        {
            // plain old text view
            var textView = new TextView();

            // decorated text view
            // TODO uncomment this line when you have refactored TextViewWithBorder and TextViewWithScroll
            var decoratedTextView = new BorderDecorator(new ScrollDecorator(textView, 54), 5);

            // change this line to render your decorated text view
            RenderView(decoratedTextView);
        }
    public static void UnitTest()
    {
        OpenGL theOpenGL = new OpenGL();

        Sphere theSphere = new Sphere();

        theSphere.SetRenderEngine(theOpenGL);

        BorderDecorator theSphereWithBorder = new BorderDecorator(theSphere);

        theSphereWithBorder.SetRenderEngine(theOpenGL);
        theSphereWithBorder.Draw();
    }
示例#6
0
        public void CreateBorderedScrollableView()
        {
            TextView textView = new TextView();

            // TextView is a VisualComponent, which lets us put it into SetContents
            SetContents(textView);

            // But we want a bordered and scrollable TextView. So we decorate it accordingly
            // before calling the SetContents method.
            var scrollingTextView           = new ScrollDecorator(textView);
            var scrollingTextViewWithBorder = new BorderDecorator(scrollingTextView, 1);

            SetContents(scrollingTextViewWithBorder);
        }
示例#7
0
        static void Main(string[] args)
        {
            TextField       TXTfield     = new TextField(2, 5);
            ScrollDecorator newscrolly   = new ScrollDecorator(TXTfield);
            ScrollDecorator otherscrolly = new ScrollDecorator(newscrolly);
            BorderDecorator newBorder    = new BorderDecorator(otherscrolly);
            BorderDecorator otherBorder  = new BorderDecorator(newBorder);

            TXTfield.Draw();
            otherBorder.Draw();


            Console.ReadKey();
        }
        public static void Main()
        {
            Console.WriteLine("Document : Text --> \n");
            DocumentComponent documentComponentText = new BorderDecorator(new FontDecorator(new HeaderAndFooterDecorator(new TextView())));

            documentComponentText.DisplayDocument();
            Console.WriteLine("Total Size : " + documentComponentText.GetSize());

            Console.WriteLine("Document : Graph --> \n");
            DocumentComponent documentComponentGraph = new ScrollBarDecorator(new GraphView());

            documentComponentGraph.DisplayDocument();
            Console.WriteLine("Total Size : " + documentComponentGraph.GetSize());
        }
示例#9
0
    //
    void UnitTest_Shape()
    {
        OpenGL theOpenGL = new OpenGL();

        // 圓型
        Sphere theSphere = new Sphere();

        theSphere.SetRenderEngine(theOpenGL);

        //在圖型加外框
        BorderDecorator theSphereWithBorder = new BorderDecorator(theSphere);

        theSphereWithBorder.SetRenderEngine(theOpenGL);
        theSphereWithBorder.Draw();
    }
示例#10
0
文件: Usage.cs 项目: Eregrith/Prez
        public void Main()
        {
            IWindow usefulWindow = new BorderDecorator(
                new HorizontalScrollBarDecorator(
                    new VerticalScrollBarDecorator(
                        new Window())));

            usefulWindow.Draw();

            //Or you can add some syntaxic sugar:

            IWindow sugarWindow = new Window()
                                  .DecorateWith(new VerticalScrollBarDecorator())
                                  .DecorateWith(new HorizontalScrollBarDecorator())
                                  .DecorateWith(new BorderDecorator());

            sugarWindow.Draw();
        }
示例#11
0
        public static void DecoratorDemo(bool showColourAndBorder)
        {
            IComponent button;
            IComponent window;

            if (showColourAndBorder)
            {
                button = new BorderDecorator(new Button());
                button.draw();
                window = new ColourDecorator(new Window());
                window.draw();
            }
            else
            {
                button = new Button();
                button.draw();
                window = new Window();
                window.draw();
            }
        }
示例#12
0
        public static void Test()
        {
            VisualComponent frame, frame_s;

            frame   = new Frame();
            frame_s = new ScrollbarDecorator(frame);
            frame_s.display();

            VisualComponent textbox, textbox_b;

            textbox   = new Textbox();
            textbox_b = new BorderDecorator(textbox);
            textbox_b.display();

            VisualComponent listbox, listbox_s, listbox_sb;

            listbox    = new Listbox();
            listbox_s  = new ScrollbarDecorator(listbox);
            listbox_sb = new BorderDecorator(listbox_s);
            listbox_sb.display();
        }
 public override void Execute()
 {
     IFigure tmp = new BorderDecorator(f);
     cf.Replace(f, tmp);
 }
示例#14
0
        public override void Execute()
        {
            IFigure tmp = new BorderDecorator(f);

            cf.Replace(f, tmp);
        }