class AssetAssociationNodeDialog:
  def __init__(self,objt,environmentName,builder):
    self.window = builder.get_object("AssetAssociationNodeDialog")
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theCurrentEnvironment = environmentName
    self.theHeadName = objt.name()
    self.decorator = NDImplementationDecorator(builder)
    assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment) 
    associationTypes = ['Inheritance','Association','Aggregation','Composition','Dependency']
    multiplicityTypes = ['1','*','1..*']

    self.decorator.updateComboCtrl("assetAssociationHeadAdornmentCtrl",associationTypes,'')
    self.decorator.updateComboCtrl("assetAssociationHeadNryCtrl",multiplicityTypes,'')
    self.decorator.updateComboCtrl("assetAssociationTailNryCtrl",multiplicityTypes,'')
    self.decorator.updateComboCtrl("assetAssociationTailAdornmentCtrl",associationTypes,'')
    self.decorator.updateComboCtrl("assetAssociationTailNameCtrl",assets,'')
    self.decorator.updateButtonLabel("assetAssociationOkButton","Create")

  def on_assetAssociationOkButton_clicked(self,callback_data):
    headAdornment = self.decorator.getComboValue("assetAssociationHeadAdornmentCtrl")
    headNry = self.decorator.getComboValue("assetAssociationHeadNryCtrl")
    headRole = self.decorator.getText("assetAssociationHeadRoleCtrl")
    tailRole = self.decorator.getText("assetAssociationTailRoleCtrl")
    tailNry = self.decorator.getComboValue("assetAssociationTailNryCtrl")
    tailAdornment = self.decorator.getComboValue("assetAssociationTailAdornmentCtrl")
    tailName = self.decorator.getComboValue("assetAssociationTailNameCtrl")
    parameters = ClassAssociationParameters(self.theCurrentEnvironment,self.theHeadName,'asset',tailAdornment,tailNry,tailRole,headRole,headNry,headAdornment,'asset',tailName)
    self.dbProxy.addClassAssociation(parameters)
    self.window.destroy()

  def show(self):
    self.window.show()
class GoalRefinementNodeDialog:
    def __init__(self,
                 objt,
                 environmentName,
                 builder,
                 goalIndicator,
                 gName,
                 reqIndicator=False):
        self.window = builder.get_object("GoalRefinementNodeDialog")
        b = Borg()
        self.dbProxy = b.dbProxy
        self.theEnvironmentName = environmentName
        self.decorator = NDImplementationDecorator(builder)
        self.reqIndicator = reqIndicator

        refTypes = ['and', 'or']
        goals = self.dbProxy.environmentGoals(self.theEnvironmentName)
        if (self.reqIndicator == True):
            refTypes = ['and']
            goals = self.dbProxy.getDimensionNames('requirement')

        self.decorator.updateComboCtrl("goalRefNameCtrl", goals, '')
        self.decorator.updateComboCtrl("goalRefinementCtrl", refTypes, '')
        self.decorator.updateButtonLabel("goalRefinementOkButton", "Create")
        self.window.resize(350, 200)
        self.goalIndicator = goalIndicator
        self.inputGoalName = gName

    def on_goalRefinementOkButton_clicked(self, callback_data):
        goalName = self.decorator.getComboValue("goalRefNameCtrl")
        assocType = self.decorator.getComboValue("goalRefinementCtrl")
        if (self.reqIndicator == True):
            parameters = GoalAssociationParameters(self.theEnvironmentName,
                                                   self.inputGoalName, 'goal',
                                                   'and', goalName,
                                                   'requirement')
        elif (self.goalIndicator == True):
            parameters = GoalAssociationParameters(self.theEnvironmentName,
                                                   goalName, 'goal', assocType,
                                                   self.inputGoalName, 'goal')
        else:
            parameters = GoalAssociationParameters(self.theEnvironmentName,
                                                   self.inputGoalName, 'goal',
                                                   assocType, goalName, 'goal')
        self.dbProxy.addGoalAssociation(parameters)
        self.window.destroy()

    def show(self):
        self.window.show()
class AssetAssociationNodeDialog:
    def __init__(self, objt, environmentName, builder):
        self.window = builder.get_object("AssetAssociationNodeDialog")
        b = Borg()
        self.dbProxy = b.dbProxy
        self.theCurrentEnvironment = environmentName
        self.theHeadName = objt.name()
        self.decorator = NDImplementationDecorator(builder)
        assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment)
        associationTypes = [
            'Inheritance', 'Association', 'Aggregation', 'Composition',
            'Dependency'
        ]
        multiplicityTypes = ['1', '*', '1..*']

        self.decorator.updateComboCtrl("assetAssociationHeadAdornmentCtrl",
                                       associationTypes, '')
        self.decorator.updateComboCtrl("assetAssociationHeadNryCtrl",
                                       multiplicityTypes, '')
        self.decorator.updateComboCtrl("assetAssociationTailNryCtrl",
                                       multiplicityTypes, '')
        self.decorator.updateComboCtrl("assetAssociationTailAdornmentCtrl",
                                       associationTypes, '')
        self.decorator.updateComboCtrl("assetAssociationTailNameCtrl", assets,
                                       '')
        self.decorator.updateButtonLabel("assetAssociationOkButton", "Create")

    def on_assetAssociationOkButton_clicked(self, callback_data):
        headAdornment = self.decorator.getComboValue(
            "assetAssociationHeadAdornmentCtrl")
        headNry = self.decorator.getComboValue("assetAssociationHeadNryCtrl")
        headRole = self.decorator.getText("assetAssociationHeadRoleCtrl")
        tailRole = self.decorator.getText("assetAssociationTailRoleCtrl")
        tailNry = self.decorator.getComboValue("assetAssociationTailNryCtrl")
        tailAdornment = self.decorator.getComboValue(
            "assetAssociationTailAdornmentCtrl")
        tailName = self.decorator.getComboValue("assetAssociationTailNameCtrl")
        parameters = ClassAssociationParameters(self.theCurrentEnvironment,
                                                self.theHeadName, 'asset',
                                                tailAdornment, tailNry,
                                                tailRole, headRole, headNry,
                                                headAdornment, 'asset',
                                                tailName)
        self.dbProxy.addClassAssociation(parameters)
        self.window.destroy()

    def show(self):
        self.window.show()
class GoalRefinementNodeDialog:
  def __init__(self,objt,environmentName,builder,goalIndicator,gName,reqIndicator = False):
    self.window = builder.get_object("GoalRefinementNodeDialog")
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theEnvironmentName = environmentName
    self.decorator = NDImplementationDecorator(builder)
    self.reqIndicator = reqIndicator

    refTypes = ['and','or']
    goals = self.dbProxy.environmentGoals(self.theEnvironmentName)
    if (self.reqIndicator == True):
      refTypes = ['and']
      goals = self.dbProxy.getDimensionNames('requirement')

    self.decorator.updateComboCtrl("goalRefNameCtrl",goals,'')
    self.decorator.updateComboCtrl("goalRefinementCtrl",refTypes,'')
    self.decorator.updateButtonLabel("goalRefinementOkButton","Create")
    self.window.resize(350,200)
    self.goalIndicator = goalIndicator
    self.inputGoalName = gName

  def on_goalRefinementOkButton_clicked(self,callback_data):
    goalName = self.decorator.getComboValue("goalRefNameCtrl")
    assocType = self.decorator.getComboValue("goalRefinementCtrl")
    if (self.reqIndicator == True):
      parameters = GoalAssociationParameters(self.theEnvironmentName,self.inputGoalName,'goal','and',goalName,'requirement')
    elif (self.goalIndicator == True):
      parameters = GoalAssociationParameters(self.theEnvironmentName,goalName,'goal',assocType,self.inputGoalName,'goal')
    else:
      parameters = GoalAssociationParameters(self.theEnvironmentName,self.inputGoalName,'goal',assocType,goalName,'goal')
    self.dbProxy.addGoalAssociation(parameters)
    self.window.destroy()

  def show(self):
    self.window.show()
示例#5
0
class ObstacleNodeDialog:
  def __init__(self,objt,environmentName,dupProperty,overridingEnvironment,builder):
    self.window = builder.get_object("ObstacleNodeDialog")
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theEnvironmentName = environmentName
    self.theObstacleAssociation = None
    self.theObstacleId = -1
    self.decorator = NDImplementationDecorator(builder)
    obstacleCategories = self.dbProxy.getDimensionNames('obstacle_category_type')
    self.obstacleAssociations = []
    self.subObstacleAssociations = []
    if (objt == None):
      self.decorator.updateComboCtrl("obstacleCategoryCtrl",obstacleCategories,'')
      self.decorator.updateButtonLabel("obstacleOkButton","Create")
      self.isCreate = True
    else:
      self.theObstacleId= objt.id()
      envProperty = objt.environmentProperty(self.theEnvironmentName)
      self.obstacleAssociations = envProperty.goalRefinements()
      self.subObstacleAssociations = envProperty.subGoalRefinements()
      self.decorator.updateTextCtrl("obstacleNameCtrl",objt.name())
      self.decorator.updateComboCtrl("obstacleCategoryCtrl",obstacleCategories,objt.category(environmentName,dupProperty))
      self.decorator.updateMLTextCtrl("obstacleDefinitionCtrl",objt.definition(environmentName,dupProperty))
      self.decorator.updateButtonLabel("obstacleOkButton","Update")
      self.isCreate = False
    self.window.resize(350,600)

  def environmentProperties(self):
    obsCat = self.decorator.getComboValue("obstacleCategoryCtrl")
    obsDef = self.decorator.getMLText("obstacleDefinitionCtrl")
    envProperties = ObstacleEnvironmentProperties(self.theEnvironmentName,'',obsDef,obsCat,self.obstacleAssociations,self.subObstacleAssociations)
    return envProperties

  def newObstacleParameters(self):
    obsName = self.decorator.getText("obstacleNameCtrl")
    envProperties = self.environmentProperties()
    parameters = ObstacleParameters(obsName,'Obstacle refinement',[],[envProperties])
    parameters.setId(self.theObstacleId)
    return parameters

  def existingObstacleParameters(self):
    obsName = self.decorator.getText("obstacleNameCtrl")
    modifiedProperties = self.environmentProperties()
    envProperties = self.dbProxy.obstacleEnvironmentProperties(self.theObstacleId)
    for idx,p in enumerate(envProperties):
      if (p.name() == self.theEnvironmentName):
        envProperties[idx] = modifiedProperties
    parameters = ObstacleParameters(obsName,'Obstacle refinement',[],envProperties)
    parameters.setId(self.theObstacleId)
    return parameters

  def parentObstacle(self,obsName,assocType):
    self.theObstacleAssociation = GoalAssociationParameters(self.theEnvironmentName,obsName,'obstacle',assocType)

  def on_obstacleOkButton_clicked(self,callback_data):
    if (self.isCreate):
      parameters = self.newObstacleParameters()
      self.dbProxy.addObstacle(parameters)
      self.theObstacleAssociation.theSubGoal = parameters.name()
      self.theObstacleAssociation.theSubGoalDimension = 'obstacle'
      self.theObstacleAssociation.theAlternativeId = 0
      self.theObstacleAssociation.theRationale = ''
      self.dbProxy.addGoalAssociation(self.theObstacleAssociation)
    else:
      parameters = self.existingObstacleParameters()
      self.dbProxy.updateObstacle(parameters)
    self.window.destroy()

  def show(self):
    self.window.show()
示例#6
0
class GoalNodeDialog:
  def __init__(self,objt,environmentName,dupProperty,overridingEnvironment,builder):
    self.window = builder.get_object("GoalNodeDialog")
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theEnvironmentName = environmentName
    self.theGoalAssociation = None
    self.theGoalId = -1
    self.decorator = NDImplementationDecorator(builder)
    goalCategories = self.dbProxy.getDimensionNames('goal_category_type')
    priorityTypes = self.dbProxy.getDimensionNames('priority_type')
    self.goalAssociations = []
    self.subGoalAssociations= []
    if (objt == None):
      self.decorator.updateComboCtrl("goalCategoryCtrl",goalCategories,'')
      self.decorator.updateComboCtrl("goalPriorityCtrl",priorityTypes,'')
      self.decorator.updateButtonLabel("goalOkButton","Create")
      self.isCreate = True
    else:
      self.theGoalId = objt.id()
      envProperty = objt.environmentProperty(self.theEnvironmentName)
      self.goalAssociations = envProperty.goalRefinements()
      self.subGoalAssociations = envProperty.subGoalRefinements()
      self.decorator.updateTextCtrl("goalNameCtrl",objt.name())
      self.decorator.updateMLTextCtrl("goalDefinitionCtrl",objt.definition(environmentName,dupProperty))
      self.decorator.updateComboCtrl("goalCategoryCtrl",goalCategories,objt.category(environmentName,dupProperty))
      self.decorator.updateComboCtrl("goalPriorityCtrl",priorityTypes,objt.priority(environmentName,dupProperty))
      self.decorator.updateMLTextCtrl("goalFitCriterionCtrl",objt.fitCriterion(environmentName,dupProperty))
      self.decorator.updateMLTextCtrl("goalIssueCtrl",objt.issue(environmentName,dupProperty))
      self.decorator.updateButtonLabel("goalOkButton","Update")
      self.isCreate = False
    self.window.resize(350,600)


  def environmentProperties(self):
    goalDef = self.decorator.getMLText("goalDefinitionCtrl")
    goalCat = self.decorator.getComboValue("goalCategoryCtrl")
    goalPri = self.decorator.getComboValue("goalPriorityCtrl")
    goalFC = self.decorator.getMLText("goalFitCriterionCtrl")
    goalIssue = self.decorator.getMLText("goalIssueCtrl")
    envProperties = GoalEnvironmentProperties(self.theEnvironmentName,'',goalDef,goalCat,goalPri,goalFC,goalIssue,self.goalAssociations,self.subGoalAssociations)
    return envProperties

  def newGoalParameters(self):
    goalName = self.decorator.getText("goalNameCtrl")
    envProperties = self.environmentProperties()
    parameters = GoalParameters(goalName,'None',[],[envProperties]) 
    parameters.setId(self.theGoalId)
    return parameters

  def existingGoalParameters(self):
    goalName = self.decorator.getText("goalNameCtrl")
    modifiedProperties = self.environmentProperties()
    goalEnvProperties = self.dbProxy.goalEnvironmentProperties(self.theGoalId)
    for idx,p in enumerate(goalEnvProperties):
      if (p.name() == self.theEnvironmentName):
        goalEnvProperties[idx] = modifiedProperties
    parameters = GoalParameters(goalName,'None',[],goalEnvProperties) 
    parameters.setId(self.theGoalId)
    return parameters

  def parentGoal(self,goalName,assocType):
    self.theGoalAssociation = GoalAssociationParameters(self.theEnvironmentName,goalName,'goal',assocType)

  def on_goalOkButton_clicked(self,callback_data):
    if (self.isCreate):
      parameters = self.newGoalParameters()
      self.dbProxy.addGoal(parameters)
      self.theGoalAssociation.theSubGoal = parameters.name()
      self.theGoalAssociation.theSubGoalDimension = 'goal'
      self.theGoalAssociation.theAlternativeId = 0
      self.theGoalAssociation.theRationale = ''
      self.dbProxy.addGoalAssociation(self.theGoalAssociation)
    else:
      parameters = self.existingGoalParameters()
      self.dbProxy.updateGoal(parameters)
    self.window.destroy()

  def show(self):
    self.window.show()
示例#7
0
class ObstacleNodeDialog:
    def __init__(self, objt, environmentName, dupProperty, overridingEnvironment, builder):
        self.window = builder.get_object("ObstacleNodeDialog")
        b = Borg()
        self.dbProxy = b.dbProxy
        self.theEnvironmentName = environmentName
        self.theObstacleAssociation = None
        self.theObstacleId = -1
        self.decorator = NDImplementationDecorator(builder)
        obstacleCategories = self.dbProxy.getDimensionNames("obstacle_category_type")
        self.obstacleAssociations = []
        self.subObstacleAssociations = []
        if objt == None:
            self.decorator.updateComboCtrl("obstacleCategoryCtrl", obstacleCategories, "")
            self.decorator.updateButtonLabel("obstacleOkButton", "Create")
            self.isCreate = True
        else:
            self.theObstacleId = objt.id()
            envProperty = objt.environmentProperty(self.theEnvironmentName)
            self.obstacleAssociations = envProperty.goalRefinements()
            self.subObstacleAssociations = envProperty.subGoalRefinements()
            self.decorator.updateTextCtrl("obstacleNameCtrl", objt.name())
            self.decorator.updateComboCtrl(
                "obstacleCategoryCtrl", obstacleCategories, objt.category(environmentName, dupProperty)
            )
            self.decorator.updateMLTextCtrl("obstacleDefinitionCtrl", objt.definition(environmentName, dupProperty))
            self.decorator.updateButtonLabel("obstacleOkButton", "Update")
            self.isCreate = False
        self.window.resize(350, 600)

    def environmentProperties(self):
        obsCat = self.decorator.getComboValue("obstacleCategoryCtrl")
        obsDef = self.decorator.getMLText("obstacleDefinitionCtrl")
        envProperties = ObstacleEnvironmentProperties(
            self.theEnvironmentName, "", obsDef, obsCat, self.obstacleAssociations, self.subObstacleAssociations
        )
        return envProperties

    def newObstacleParameters(self):
        obsName = self.decorator.getText("obstacleNameCtrl")
        envProperties = self.environmentProperties()
        parameters = ObstacleParameters(obsName, "Obstacle refinement", [], [envProperties])
        parameters.setId(self.theObstacleId)
        return parameters

    def existingObstacleParameters(self):
        obsName = self.decorator.getText("obstacleNameCtrl")
        modifiedProperties = self.environmentProperties()
        envProperties = self.dbProxy.obstacleEnvironmentProperties(self.theObstacleId)
        for idx, p in enumerate(envProperties):
            if p.name() == self.theEnvironmentName:
                envProperties[idx] = modifiedProperties
        parameters = ObstacleParameters(obsName, "Obstacle refinement", [], envProperties)
        parameters.setId(self.theObstacleId)
        return parameters

    def parentObstacle(self, obsName, assocType):
        self.theObstacleAssociation = GoalAssociationParameters(self.theEnvironmentName, obsName, "obstacle", assocType)

    def on_obstacleOkButton_clicked(self, callback_data):
        if self.isCreate:
            parameters = self.newObstacleParameters()
            self.dbProxy.addObstacle(parameters)
            self.theObstacleAssociation.theSubGoal = parameters.name()
            self.theObstacleAssociation.theSubGoalDimension = "obstacle"
            self.theObstacleAssociation.theAlternativeId = 0
            self.theObstacleAssociation.theRationale = ""
            self.dbProxy.addGoalAssociation(self.theObstacleAssociation)
        else:
            parameters = self.existingObstacleParameters()
            self.dbProxy.updateObstacle(parameters)
        self.window.destroy()

    def show(self):
        self.window.show()