virtual void dialogClosed(const DialogWindowEventUnrecPtr e)
    {
        if(e->getOption() != DialogWindowEvent::DIALOG_OPTION_CANCEL)
        {
            //Create the Layer FieldContainer
            CreateFieldContainerCommandPtr CreateCommand = CreateFieldContainerCommand::create(e->getInput());

		    TheCommandManager->executeCommand(CreateCommand);

            //If the layer is a ColorLayer then give it a random color
            if(CreateCommand->getContainer()->getType() == ColorLayer::getClassType())
            {
                Color4f RandColor(RandomPoolManager::getRandomReal32(0.0f,1.0f),
                                  RandomPoolManager::getRandomReal32(0.0f,1.0f),
                                  RandomPoolManager::getRandomReal32(0.0f,1.0f),
                                  1.0f);

                dynamic_cast<ColorLayer*>(CreateCommand->getContainer())->setColor(RandColor);
            }


            //Set the background layer to use the newly create layer
            SetFieldValueCommandPtr SetFieldCommand = SetFieldValueCommand::create(SinglePtrFieldLabel,Component::BackgroundFieldId, boost::lexical_cast<std::string>(CreateCommand->getContainer()->getId()));

		    TheCommandManager->executeCommand(SetFieldCommand);
        }
    }
   virtual void actionPerformed(const ActionEventUnrecPtr e)
    {
        std::ostringstream StrStream;
        operator<<(StrStream, _ChangeToColor);
        SetFieldValueCommandPtr TheCommand = SetFieldValueCommand::create(_TutorialBackground,ColorLayer::ColorFieldId, StrStream.str());

		_CommandManager->executeCommand(TheCommand);
    }
    virtual void dialogClosed(const DialogWindowEventUnrecPtr e)
    {
        if(e->getOption() != DialogWindowEvent::DIALOG_OPTION_CANCEL)
        {
            CommandPtr TheCommand = MoveFieldElementCommand::create(MultiPtrFieldInnerPanel,Panel::ChildrenFieldId, MultiPtrFieldList->getSelectionModel()->getMinSelectionIndex(), boost::lexical_cast<UInt32>(e->getInput()));

		    TheCommandManager->executeCommand(TheCommand);
        }
    }
    virtual void dialogClosed(const DialogWindowEventUnrecPtr e)
    {
        if(e->getOption() != DialogWindowEvent::DIALOG_OPTION_CANCEL)
        {
            SetFieldValueCommandPtr TheCommand = SetFieldValueCommand::create(MultiPtrFieldInnerPanel,Panel::ChildrenFieldId, e->getInput(), MultiPtrFieldList->getSelectionModel()->getMinSelectionIndex());

		    TheCommandManager->executeCommand(TheCommand);
        }
    }
    virtual void dialogClosed(const DialogWindowEventUnrecPtr e)
    {
        if(e->getOption() != DialogWindowEvent::DIALOG_OPTION_CANCEL)
        {
            CommandPtr TheCommand = SwapFieldElementCommand::create(TutorialBackground,GradientBackground::ColorFieldId, MultiFieldList->getSelectionModel()->getMinSelectionIndex(), boost::lexical_cast<UInt32>(e->getInput()));

		    TheCommandManager->executeCommand(TheCommand);
        }
    }
    virtual void dialogClosed(const DialogWindowEventUnrecPtr e)
    {
        if(e->getOption() != DialogWindowEvent::DIALOG_OPTION_CANCEL)
        {
            SetFieldValueCommandPtr TheCommand = SetFieldValueCommand::create(TutorialBackground,GradientBackground::ColorFieldId, e->getInput(), MultiFieldList->getSelectionModel()->getMinSelectionIndex());

		    TheCommandManager->executeCommand(TheCommand);
        }
    }
   virtual void actionPerformed(const ActionEventUnrecPtr e)
    {
        if(!MultiPtrFieldList->getSelectionModel()->isSelectionEmpty())
        {
            UndoableCommandPtr TheCommand = RemoveFieldElementCommand::create(MultiPtrFieldInnerPanel,Panel::ChildrenFieldId, MultiPtrFieldList->getSelectionModel()->getMinSelectionIndex());

		    TheCommandManager->executeCommand(TheCommand);
        }
    }
void handleSetBackgroundColorAction(ActionEventDetails* const details,
                                    CommandManagerPtr TheCommandManager,
                                    ColorLayer* const TheBackground,
                                    Color4f ChangeToColor)
{
    UndoableCommandPtr TheCommand = SetBackgroundColor::create(TheBackground, ChangeToColor);

    TheCommandManager->executeCommand(TheCommand);
}
void handleSetBorderColorAction(ActionEventDetails* const details,
                                CommandManagerPtr TheCommandManager,
                                LineBorder* const TheBorder,
                                Color4f ChangeToColor)
{
    SetBorderColorRecPtr TheCommand = SetBorderColor::create(TheBorder, ChangeToColor);

    TheCommandManager->executeCommand(TheCommand);
}
    virtual void dialogClosed(const DialogWindowEventUnrecPtr e)
    {
        if(e->getOption() != DialogWindowEvent::DIALOG_OPTION_CANCEL)
        {
            ButtonUnrecPtr NewButton = Button::create();
            NewButton->setText(e->getInput());

            CommandPtr TheCommand = AddFieldElementCommand::create(MultiPtrFieldInnerPanel,Panel::ChildrenFieldId, boost::lexical_cast<std::string>(NewButton->getId()));

		    TheCommandManager->executeCommand(TheCommand);
        }
    }
    virtual void dialogClosed(const DialogWindowEventUnrecPtr e)
    {
        if(e->getOption() != DialogWindowEvent::DIALOG_OPTION_CANCEL)
        {
            UndoableCommandPtr TheCommand1 = AddFieldElementCommand::create(TutorialBackground,GradientBackground::ColorFieldId, e->getInput());
            UndoableCommandPtr TheCommand2 = AddFieldElementCommand::create(TutorialBackground,GradientBackground::PositionFieldId, "1.0");

            std::vector<UndoableCommandPtr> CommandVec;
            CommandVec.push_back(TheCommand1);
            CommandVec.push_back(TheCommand2);

            CommandPtr TheCommand = CompoundUndoableCommand::create(CommandVec);
		    TheCommandManager->executeCommand(TheCommand);
        }
    }
   virtual void actionPerformed(const ActionEventUnrecPtr e)
    {
        if(!MultiFieldList->getSelectionModel()->isSelectionEmpty())
        {
            UndoableCommandPtr TheCommand1 = RemoveFieldElementCommand::create(TutorialBackground,GradientBackground::ColorFieldId, MultiFieldList->getSelectionModel()->getMinSelectionIndex());


            UndoableCommandPtr TheCommand2 = RemoveFieldElementCommand::create(TutorialBackground,GradientBackground::PositionFieldId, MultiFieldList->getSelectionModel()->getMinSelectionIndex());

            std::vector<UndoableCommandPtr> CommandVec;
            CommandVec.push_back(TheCommand1);
            CommandVec.push_back(TheCommand2);

            CommandPtr TheCommand = CompoundUndoableCommand::create(CommandVec);
		    TheCommandManager->executeCommand(TheCommand);
        }
    }
   virtual void actionPerformed(const ActionEventUnrecPtr e)
    {
		UndoableCommandPtr TheCommand = SetBackgroundColor::create(_TheBackground, _ChangeToColor);

		_CommandManager->executeCommand(TheCommand);
    }
   virtual void actionPerformed(const ActionEventUnrecPtr e)
    {
		SetBorderColorRefPtr TheCommand = SetBorderColor::create(_TheBorder, _ChangeToColor);

		_CommandManager->executeCommand(TheCommand);
    }