Exemplo n.º 1
0
        private void InitForm()
        {
            Debug.WriteLine("Initializing UI objects.");

            #region Menubar
            Debug.WriteLine("Loading menubar...");
            this.menubar = new DefaultMenubar();
            this.Controls.Add((Control)this.menubar);

            DefaultMenuItem exampleMenuItem1 = new DefaultMenuItem("File");
            this.menubar.AddMenuItem(exampleMenuItem1);

            DefaultMenuItem exampleMenuItem11 = new DefaultMenuItem("New Mindmap");
            exampleMenuItem1.AddMenuItem(exampleMenuItem11);
            DefaultMenuItem exampleMenuItem12 = new DefaultMenuItem("Open Mindmap");
            exampleMenuItem1.AddMenuItem(exampleMenuItem12);
            DefaultMenuItem exampleMenuItem13 = new DefaultMenuItem("Close");
            exampleMenuItem1.AddMenuItem(exampleMenuItem13);

            DefaultMenuItem exampleMenuItem2 = new DefaultMenuItem("Edit");
            this.menubar.AddMenuItem(exampleMenuItem2);

            DefaultMenuItem exampleMenuItem21 = new DefaultMenuItem("Add Proccess");
            exampleMenuItem2.AddMenuItem(exampleMenuItem21);

            DefaultMenuItem exampleMenuItem3 = new DefaultMenuItem("Export");
            this.menubar.AddMenuItem(exampleMenuItem3);

            #endregion
        }
Exemplo n.º 2
0
        private void InitUI()
        {
            Debug.WriteLine("Initializing UI objects.");

            #region Editor and Canvas

            Debug.WriteLine("Loading canvas...");
            this.editor = new DefaultEditor();
            this.toolStripContainer1.ContentPanel.Controls.Add((Control)this.editor);

            ICanvas canvas1 = new DefaultCanvas();
            canvas1.Name = "Untitled-1";
            this.editor.AddCanvas(canvas1);

            ICanvas canvas2 = new DefaultCanvas();
            canvas2.Name = "Untitled-2";
            this.editor.AddCanvas(canvas2);

            #endregion

            #region Commands

            //BlackCanvasBgCommand blackCanvasBgCmd = new BlackCanvasBgCommand(this.canvas);
            //WhiteCanvasBgCommand whiteCanvasBgCmd = new WhiteCanvasBgCommand(this.canvas);

            #endregion

            #region Menubar

            Debug.WriteLine("Loading menubar...");
            this.menubar = new DefaultMenubar();
            this.Controls.Add((Control)this.menubar);

            DefaultMenuItem fileMenuItem = new DefaultMenuItem("File");
            this.menubar.AddMenuItem(fileMenuItem);

            DefaultMenuItem newMenuItem = new DefaultMenuItem("New");
            fileMenuItem.AddMenuItem(newMenuItem);
            fileMenuItem.AddSeparator();
            DefaultMenuItem exitMenuItem = new DefaultMenuItem("Exit");
            fileMenuItem.AddMenuItem(exitMenuItem);

            DefaultMenuItem editMenuItem = new DefaultMenuItem("Edit");
            this.menubar.AddMenuItem(editMenuItem);

            DefaultMenuItem undoMenuItem = new DefaultMenuItem("Undo");
            editMenuItem.AddMenuItem(undoMenuItem);
            DefaultMenuItem redoMenuItem = new DefaultMenuItem("Redo");
            editMenuItem.AddMenuItem(redoMenuItem);

            DefaultMenuItem viewMenuItem = new DefaultMenuItem("View");
            this.menubar.AddMenuItem(viewMenuItem);

            DefaultMenuItem helpMenuItem = new DefaultMenuItem("Help");
            this.menubar.AddMenuItem(helpMenuItem);

            DefaultMenuItem aboutMenuItem = new DefaultMenuItem("About");
            helpMenuItem.AddMenuItem(aboutMenuItem);

            #endregion

            #region Toolbox

            // Initializing toolbox
            Debug.WriteLine("Loading toolbox...");
            this.toolbox = new DefaultToolbox();
            this.toolStripContainer1.LeftToolStripPanel.Controls.Add((Control)this.toolbox);
            this.editor.Toolbox = toolbox;

            #endregion

            #region Tools

            // Initializing tools
            Debug.WriteLine("Loading tools...");
            this.toolbox.AddTool(new SelectionTool());
            this.toolbox.AddSeparator();
            this.toolbox.AddTool(new LineTool());
            this.toolbox.AddTool(new RectangleTool());
            this.toolbox.AddTool(new TextTool());
            this.toolbox.ToolSelected += Toolbox_ToolSelected;

            #endregion

            #region Toolbar

            // Initializing toolbar
            Debug.WriteLine("Loading toolbar...");
            this.toolbar = new DefaultToolbar();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add((Control)this.toolbar);

            ExampleToolbarItem toolItem1 = new ExampleToolbarItem();
            //toolItem1.SetCommand(whiteCanvasBgCmd);
            ExampleToolbarItem toolItem2 = new ExampleToolbarItem();
            //toolItem2.SetCommand(blackCanvasBgCmd);

            this.toolbar.AddToolbarItem(toolItem1);
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(toolItem2);

            #endregion
        }
Exemplo n.º 3
0
        private void InitUI()
        {
            Debug.WriteLine("Initializing UI objects.");

            #region Editor and Canvas

            Debug.WriteLine("Loading canvas...");
            this.editor = new DefaultEditor();
            this.toolStripContainer1.ContentPanel.Controls.Add((Control)this.editor);

            ICanvas canvas = new DefaultCanvas();
            canvas.Name = "Pattern Design";
            this.editor.AddCanvas(canvas);

            #endregion

            #region Commands

            //command di menubar file
            GenerateFile addGenerateFile = new GenerateFile(canvas);
            Save         save            = new Save(canvas);
            OpenFile     open            = new OpenFile(canvas);
            Exit         exit            = new Exit();

            //command di menubar edit
            undo  = new Undo(canvas);
            redo  = new Redo(canvas);
            copy  = new Copy(canvas);
            paste = new Paste(canvas);

            //command di menubar generate
            AddPattern1         addPattern1         = new AddPattern1(canvas);
            AddFactoryPattern   addFactoryPattern   = new AddFactoryPattern(canvas);
            AddCommandPattern   addCommandPattern   = new AddCommandPattern(canvas);
            AddCompositePattern addCompositePattern = new AddCompositePattern(canvas);
            AddFacadePattern    addFacadePattern    = new AddFacadePattern(canvas);
            AddMementoPattern   addMementroPattern  = new AddMementoPattern(canvas);
            AddSingletonPattern addSingletonPattern = new AddSingletonPattern(canvas);

            #endregion

            #region Menubar

            Debug.WriteLine("Loading menubar...");
            this.menubar = new DefaultMenubar();
            this.Controls.Add((Control)this.menubar);

            //menubar file
            DefaultMenuItem fileMenuItem = new DefaultMenuItem("File");
            this.menubar.AddMenuItem(fileMenuItem);

            DefaultMenuItem generateFile = new DefaultMenuItem("Generate Class File");
            generateFile.SetCommand(addGenerateFile);
            fileMenuItem.AddMenuItem(generateFile);

            DefaultMenuItem openItem = new DefaultMenuItem("Open");
            openItem.SetCommand(open);
            fileMenuItem.AddMenuItem(openItem);

            DefaultMenuItem saveItem = new DefaultMenuItem("Save");
            saveItem.SetCommand(save);
            fileMenuItem.AddMenuItem(saveItem);

            fileMenuItem.AddSeparator();

            DefaultMenuItem exitMenuItem = new DefaultMenuItem("Exit");
            exitMenuItem.SetCommand(exit);
            fileMenuItem.AddMenuItem(exitMenuItem);

            //menubar edit
            DefaultMenuItem editMenuItem = new DefaultMenuItem("Edit");
            this.menubar.AddMenuItem(editMenuItem);

            DefaultMenuItem undoItem = new DefaultMenuItem("Undo");
            undoItem.SetCommand(undo);
            editMenuItem.AddMenuItem(undoItem);

            DefaultMenuItem redoItem = new DefaultMenuItem("Redo");
            redoItem.SetCommand(redo);
            editMenuItem.AddMenuItem(redoItem);

            DefaultMenuItem copyItem = new DefaultMenuItem("Copy");
            copyItem.SetCommand(copy);
            editMenuItem.AddMenuItem(copyItem);

            DefaultMenuItem pasteItem = new DefaultMenuItem("Paste");
            pasteItem.SetCommand(paste);
            editMenuItem.AddMenuItem(pasteItem);

            //menubar generate
            DefaultMenuItem generateMenuItem = new DefaultMenuItem("Generate");
            this.menubar.AddMenuItem(generateMenuItem);

            DefaultMenuItem creationalSubMenu = new DefaultMenuItem("Creational Pattern");
            generateMenuItem.AddMenuItem(creationalSubMenu);

            DefaultMenuItem structuralSubMenu = new DefaultMenuItem("Structural Pattern");
            generateMenuItem.AddMenuItem(structuralSubMenu);

            DefaultMenuItem behavioralSubMenu = new DefaultMenuItem("Behavioral Pattern");
            generateMenuItem.AddMenuItem(behavioralSubMenu);

            DefaultMenuItem factoryMenuItem = new DefaultMenuItem("Factory Pattern");
            factoryMenuItem.SetCommand(addFactoryPattern);
            creationalSubMenu.AddMenuItem(factoryMenuItem);

            DefaultMenuItem singletonMenuItem = new DefaultMenuItem("Singleton Pattern");
            singletonMenuItem.SetCommand(addSingletonPattern);
            creationalSubMenu.AddMenuItem(singletonMenuItem);

            DefaultMenuItem compositeMenuItem = new DefaultMenuItem("Composite Pattern");
            compositeMenuItem.SetCommand(addCompositePattern);
            structuralSubMenu.AddMenuItem(compositeMenuItem);

            DefaultMenuItem facadeMenuItem = new DefaultMenuItem("Facade Pattern");
            facadeMenuItem.SetCommand(addFacadePattern);
            structuralSubMenu.AddMenuItem(facadeMenuItem);

            DefaultMenuItem commandMenuItem = new DefaultMenuItem("Command Pattern");
            commandMenuItem.SetCommand(addCommandPattern);
            behavioralSubMenu.AddMenuItem(commandMenuItem);

            DefaultMenuItem mementoMenuItem = new DefaultMenuItem("Memento Pattern");
            mementoMenuItem.SetCommand(addMementroPattern);
            behavioralSubMenu.AddMenuItem(mementoMenuItem);

            #endregion

            #region Toolbox

            // Initializing toolbox
            Debug.WriteLine("Loading toolbox...");
            this.toolbox = new DefaultToolbox();
            this.toolStripContainer1.LeftToolStripPanel.Controls.Add((Control)this.toolbox);
            this.editor.Toolbox = toolbox;

            #endregion

            #region Tools


            // Initializing tools
            Debug.WriteLine("Loading tools...");
            this.toolbox.AddTool(new SelectionTool());
            this.toolbox.AddSeparator();
            //this.toolbox.AddTool(new LineTool());
            this.toolbox.AddTool(new ClassTool());
            this.toolbox.AddSeparator();
            this.toolbox.AddTool(new AssociationTool());
            this.toolbox.AddTool(new DirectedTool());
            this.toolbox.AddTool(new GeneralizationTool());
            this.toolbox.AddTool(new DependencyTool());
            this.toolbox.AddTool(new RealizationTool());
            this.toolbox.AddSeparator();
            //this.toolbox.AddTool(new DeleteTool());
            this.toolbox.ToolSelected += Toolbox_ToolSelected;

            #endregion

            #region Toolbar

            // Initializing toolbar
            Debug.WriteLine("Loading toolbar...");
            this.toolbar = new DefaultToolbar();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add((Control)this.toolbar);

            UndoToolItem undoToolItem = new UndoToolItem(canvas);
            undoToolItem.SetCommand(undo);
            RedoToolItem redoToolItem = new RedoToolItem(canvas);
            redoToolItem.SetCommand(redo);
            SaveToolbarItem saveToolItem = new SaveToolbarItem(canvas);
            saveToolItem.SetCommand(save);

            OpenToolbarItem openToolItem = new OpenToolbarItem(canvas);
            openToolItem.SetCommand(open);

            CopyToolbarItem copyToolItem = new CopyToolbarItem(canvas);
            copyToolItem.SetCommand(copy);
            PasteToolbarItem pasteToolItem = new PasteToolbarItem(canvas);
            pasteToolItem.SetCommand(paste);


            this.toolbar.AddToolbarItem(openToolItem);
            this.toolbar.AddToolbarItem(saveToolItem);
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(undoToolItem);
            this.toolbar.AddToolbarItem(redoToolItem);
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(copyToolItem);
            this.toolbar.AddToolbarItem(pasteToolItem);


            #endregion
        }
Exemplo n.º 4
0
        private void InitUI()
        {
            Debug.WriteLine("Initializing UI objects.");

            #region Canvas
            Debug.WriteLine("Loading canvas...");
            this.canvas = new DefaultCanvas();
            this.toolStripContainer1.ContentPanel.Controls.Add((Control)this.canvas);
            #endregion

            #region Commands

            BlackCanvasBgCommands blackCanvasBgCommands = new BlackCanvasBgCommands(this.canvas);
            WhiteCanvasBgCommands whiteCanvasBgCommands = new WhiteCanvasBgCommands(this.canvas);

            #endregion

            #region Menubar
            Debug.WriteLine("Loading menubar...");
            this.menubar = new DefaultMenubar();
            this.Controls.Add((Control)this.menubar);

            DefaultMenuItem fileMenuItem = new DefaultMenuItem("File");
            this.menubar.AddMenuItem(fileMenuItem);

            DefaultMenuItem newMenuItem = new DefaultMenuItem("New");
            fileMenuItem.AddMenuItem(newMenuItem);

            DefaultMenuItem editMenuItem = new DefaultMenuItem("Edit");
            this.menubar.AddMenuItem(editMenuItem);

            DefaultMenuItem changeToBlackMenuItem = new DefaultMenuItem("Change to Black");
            changeToBlackMenuItem.SetCommand(blackCanvasBgCommands);
            editMenuItem.AddMenuItem(changeToBlackMenuItem);

            DefaultMenuItem changeToWhiteMenuItem = new DefaultMenuItem("Change to White");
            changeToWhiteMenuItem.SetCommand(whiteCanvasBgCommands);
            editMenuItem.AddMenuItem(changeToWhiteMenuItem);

            #endregion

            #region Toolbox

            // Initializing toolbox
            Debug.WriteLine("Loading toolbox...");
            this.toolbox = new DefaultToolbox();
            this.toolStripContainer1.LeftToolStripPanel.Controls.Add((Control)this.toolbox);

            #endregion

            #region Tools

            // Initializing tools
            Debug.WriteLine("Loading tools...");
            this.toolbox.AddTool(new SelectionTool());
            this.toolbox.AddSeparator();
            this.toolbox.AddTool(new LineTool());
            this.toolbox.AddTool(new RectangleTool());
            this.toolbox.AddTool(new TextTool());
            this.toolbox.AddTool(new ConnectorTool());
            this.toolbox.ToolSelected += Toolbox_ToolSelected;

            #endregion

            #region Toolbar
            // Initializing toolbar
            Debug.WriteLine("Loading toolbar...");
            this.toolbar = new DefaultToolbar();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add((Control)this.toolbar);

            ExampleToolbarItem whiteBackgroundTool = new ExampleToolbarItem();
            whiteBackgroundTool.SetCommand(whiteCanvasBgCommands);
            ExampleToolbarItem blackBackgroundTool = new ExampleToolbarItem();
            blackBackgroundTool.SetCommand(blackCanvasBgCommands);

            this.toolbar.AddToolbarItem(whiteBackgroundTool);
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(blackBackgroundTool);
            #endregion
        }
Exemplo n.º 5
0
        private void InitForm()
        {
            Debug.WriteLine("Initializing UI objects.");

            #region Toolbox

            //tempat2 nya tool
            //Initialize toolbox
            Debug.WriteLine("Loading toolbox...");

            //inisialisasi toolbox
            this.toolbox = new DefaultToolbox();
            this.toolStripContainer1.LeftToolStripPanel.Controls.Add((Control)this.toolbox);

            #endregion

            #region Tools
            //tool tool yang di keluarkan
            ////Initialize tools
            Debug.WriteLine("Loading tools...");

            this.toolbox.AddTool(new SelectionTool());
            //state
            this.toolbox.AddTool(new StateLineTool());
            this.toolbox.AddTool(new StateRectangleTool());
            this.toolbox.AddTool(new StateCircleTool());
            this.toolbox.AddTool(new ConnectorTool());

            this.toolbox.ToolSelected += Toolbox_ToolSelected;
            #endregion

            #region Toolbar
            // Initializing toolbar
            Debug.WriteLine("Loading toolbar...");
            this.toolbar = new DefaultToolbar();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add((Control)this.toolbar);

            this.toolbar.AddToolbarItem(new ExampleToolbarItem());
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(new ExampleToolbarItem());
            #endregion

            #region Menubar
            Debug.WriteLine("Loading menubar...");
            this.menubar = new DefaultMenubar();
            this.Controls.Add((Control)this.menubar);

            DefaultMenuitem exampleMenuItem1 = new DefaultMenuitem("File");
            this.menubar.AddMenuItem(exampleMenuItem1);
            DefaultMenuitem exampleMenuItem11 = new DefaultMenuitem("New");
            exampleMenuItem1.AddMenuItem(exampleMenuItem11);

            DefaultMenuitem exampleMenuItem2 = new DefaultMenuitem("Edit");
            this.menubar.AddMenuItem(exampleMenuItem2);
            DefaultMenuitem exampleMenuItem21 = new DefaultMenuitem("Cut");
            exampleMenuItem2.AddMenuItem(exampleMenuItem21);
            DefaultMenuitem exampleMenuItem22 = new DefaultMenuitem("Copy");
            exampleMenuItem2.AddMenuItem(exampleMenuItem22);

            #endregion

            #region Canvas
            Debug.WriteLine("Loading canvas...");
            this.canvas = new DefaultCanvas();
            this.toolStripContainer1.ContentPanel.Controls.Add((Control)this.canvas);
            #endregion
        }
Exemplo n.º 6
0
        private void InitUI()
        {
            Debug.WriteLine("Initializing UI objects.");

            IPanel canvas1 = new DefaultPanel();

            #region Toolbar

            // Initializing toolbar
            Debug.WriteLine("Loading toolbar...");
            this.toolbar = new DefaultToolbar();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add((Control)this.toolbar);

            UnDoRedo undoredo = new UnDoRedo();

            ToolbarItem toolItem1 = new ToolbarItem("undo", IconSet.undo, canvas1);
            toolItem1.UnDoObject = undoredo;
            //toolItem1.SetCommand(whiteCanvasBgCmd);
            ToolbarItem toolItem2 = new ToolbarItem("redo", IconSet.redo, canvas1);
            toolItem2.UnDoObject = undoredo;
            //toolItem2.SetCommand(blackCanvasBgCmd);

            this.toolbar.AddToolbarItem(toolItem1);
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(toolItem2);

            #endregion

            #region Editor and Panel
            Debug.WriteLine("Loading panel...");
            this.editor = new DefaultEditor();
            this.toolStripContainer1.ContentPanel.Controls.Add((Control)this.editor);


            canvas1.Name       = "Untitled-1";
            canvas1.UnDoObject = undoredo;
            this.editor.AddCanvas(canvas1);

            /*IPanel canvas2 = new DefaultPanel();
             * canvas2.Name = "Untitled-2";
             * this.editor.AddCanvas(canvas2);*/
            #endregion

            #region Menubar
            Debug.WriteLine("Loading menubar...");
            this.menubar = new DefaultMenubar();
            this.Controls.Add((Control)this.menubar);

            DefaultMenuItem exampleMenuItem1 = new DefaultMenuItem("File");
            this.menubar.AddMenuItem(exampleMenuItem1);

            DefaultMenuItem exampleMenuItem11 = new DefaultMenuItem("New Mindmap");
            exampleMenuItem1.AddMenuItem(exampleMenuItem11);
            DefaultMenuItem exampleMenuItem12 = new DefaultMenuItem("Open Mindmap");
            exampleMenuItem1.AddMenuItem(exampleMenuItem12);
            DefaultMenuItem exampleMenuItem13 = new DefaultMenuItem("Close");
            exampleMenuItem1.AddMenuItem(exampleMenuItem13);

            DefaultMenuItem exampleMenuItem2 = new DefaultMenuItem("Edit");
            this.menubar.AddMenuItem(exampleMenuItem2);

            DefaultMenuItem exampleMenuItem21 = new DefaultMenuItem("Add Proccess");
            exampleMenuItem2.AddMenuItem(exampleMenuItem21);

            DefaultMenuItem exampleMenuItem3 = new DefaultMenuItem("Export");
            this.menubar.AddMenuItem(exampleMenuItem3);
            DefaultMenuItem exampleMenuItem31 = new DefaultMenuItem("Image");
            exampleMenuItem3.AddMenuItem(exampleMenuItem31);
            DefaultMenuItem exampleMenuItem311 = new DefaultMenuItem("JPEG");
            exampleMenuItem31.AddMenuItem(exampleMenuItem311);
            DefaultMenuItem exampleMenuItem312 = new DefaultMenuItem("PNG");
            exampleMenuItem31.AddMenuItem(exampleMenuItem312);
            DefaultMenuItem exampleMenuItem32 = new DefaultMenuItem("PDF");
            exampleMenuItem3.AddMenuItem(exampleMenuItem32);
            #endregion

            #region Toolbox

            // Initializing toolbox
            Debug.WriteLine("Loading toolbox...");
            this.toolbox = new DefaultToolbox();
            this.toolStripContainer1.LeftToolStripPanel.Controls.Add((Control)this.toolbox);
            //this.editor.Toolbox = toolbox;

            #endregion

            #region Tools

            // Initializing tools
            Debug.WriteLine("Loading tools...");
            ITool selectionTool = new SelectionTool();
            selectionTool.UnDoObject = undoredo;
            this.toolbox.AddTool(selectionTool);
            this.toolbox.AddSeparator();
            this.toolbox.AddTool(new LineTool());
            this.toolbox.AddTool(new RectangleTool());
            this.toolbox.AddTool(new TextTool());
            this.toolbox.ToolSelected += Toolbox_ToolSelected;
            #endregion
        }