createOglClassCommand.py :  » UML » Python-UML-Tool » pyut-1.4.0 » src » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » UML » Python UML Tool 
Python UML Tool » pyut 1.4.0 » src » createOglClassCommand.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from historyUtils import *
from delOglClassCommand import *
from command import *

class CreateOglClassCommand(DelOglClassCommand):
    """
    @author P. Dabrowski <przemek.dabrowski@destroy-display.com> (15.11.2005)
    This class is a part of the history system of PyUt.
    It creates an OglClass and allowds to undo/redo it.
    """
    
    def __init__(self, x = 0, y = 0, forExecute = False, shape = None):
        """
        Constructor.
        @param x integer    :   abscissa of the class to create 
        @param y integer    :   ordinate of the class to create
        """
        
        

        if forExecute:
            self._shape = self._createNewClass(x, y)
        else:
            DelOglClassCommand.__init__(self, shape)
            

    #>-------------------------------------------------------------------------------
        
    def serialize(self):
        """
        serialize the data needed by the command to undo/redo the created link
        """

        return DelOglClassCommand.serialize(self)
##        cmd = DelOglClassCommand(self._shape)
##
##        return cmd.serialize()

    #>-------------------------------------------------------------------------------

    def unserialize(self, serializedInfos):
        """
        unserialize the data needed by the command to undo/redo the created link
        @param serializedInfos string   :   string representation of the data needed
                                            by the command to undo redo a link
        """

        DelOglClassCommand.unserialize(self, serializedInfos)
##        cmd = DelOglClassCommand(self._shape)
##        
##        cmd.unserialize(serializedInfos)
##
##        self._shape = cmd._shape
        
    #>-------------------------------------------------------------------------------

    def redo(self):
        """
        redo the creation of the link.
        """

        DelOglClassCommand.undo(self)
##        cmd = DelOglClassCommand(self._shape)
##        print self._shape
##        cmd.undo()
##        
##        self.getGroup().getHistory().getFrame().Refresh()
        
    #>-------------------------------------------------------------------------------    
        
    def undo(self):
        """
        Undo the creation of link, what means that we destroy the link
        """

        DelOglClassCommand.redo(self)
##        cmd = DelOglClassCommand(self._shape)
##        cmd.redo(self)

    #>-------------------------------------------------------------------------------

    def execute(self):
        pass
        
    #>-------------------------------------------------------------------------------        
        
    def _createNewClass(self, x, y):
        """
        Add a new class at (x, y).

        @return PyutClass : the newly created PyutClass
        @since 1.4
        @author L. Burgbacher <lb@alawa.ch>
        """
        from mediator import getMediator
        from PyutClass import PyutClass
        from OglClass import OglClass
        
        med = getMediator()
        umlFrame = med.getFileHandling().getCurrentFrame()
        
        pyutClass = PyutClass(_("NoName"))
        oglClass = OglClass(pyutClass)
        med.classEditor(pyutClass)
        #med.autoResize(pyutClass)

        umlFrame.addShape(oglClass, x, y, withModelUpdate = True)
        med.autoResize(pyutClass)
        umlFrame.Refresh()
        
        return oglClass
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.