Beispiel #1
0
UmlCanvas::UmlCanvas(wxSFDiagramManager* manager, UmlEditor* editor)
	: wxSFShapeCanvas(manager, editor, wxID_ANY, wxDefaultPosition,
	 editor->GetSize(), wxHSCROLL | wxVSCROLL | wxSTATIC_BORDER)
// LETARTARE
	 ,EditDiag (0), m_Editor(editor)
{
	editor->SetCanvas(this);
	//AddStyle(sfsGRID_USE);
	//AddStyle(sfsGRID_SHOW);
	SetGridLineMult(5);
	SetGridStyle(wxSHORT_DASH);
	AddStyle(sfsGRADIENT_BACKGROUND);
	SetGradientFrom(sfdvSHAPECANVAS_GRADIENT_FROM);
	SetGradientTo(sfdvSHAPECANVAS_GRADIENT_TO);
	GetDiagramManager()->ClearAcceptedShapes();
	GetDiagramManager()->AcceptShape(_T("All"));
}
Beispiel #2
0
void UmlCanvas::OnKeyDown(wxKeyEvent& event)
{
    if(event.GetKeyCode() == WXK_DELETE)
    {
        ShapeList sl;
        GetSelectedShapes(sl);
        GetDiagramManager()->RemoveShapes(sl);
        Refresh(false);
    }
    if(event.GetKeyCode() == WXK_EXECUTE) // I expect Execute being the Enter button
    {

    }
}
Beispiel #3
0
void DatabaseCanvas::CreateFKConstraint(const DatabaseTable *fkTable, const std::vector<FKField *> &foreignKeyField)
{
    Constraint* pConstr = NULL;
    bool found = false;
    for( std::vector<MyErdTable *>::iterator it = m_displayedTables.begin(); it < m_displayedTables.end() && !found; it ++ )
    {
        if( const_cast<DatabaseTable &>( (*it)->GetTable() ).GetTableName() == foreignKeyField.at( 0 )->GetReferencedTableName() )
        {
            found = true;
            for( std::vector<FKField *>::const_iterator it4 = foreignKeyField.begin(); it4 < foreignKeyField.end(); it4++ )
            {
                if( ((DrawingView *) m_view)->GetViewType() == DatabaseView )
                {
                    pConstr = new DatabaseConstraint( (*it4)->GetFKName() );
                    pConstr->SetLocalColumn( (*it4)->GetOriginalFieldName() );
                    pConstr->SetRefColumn( (*it4)->GetReferencedFieldName() );
                    pConstr->SetRefTable( (*it4)->GetReferencedTableName() );
                    pConstr->SetType( Constraint::foreignKey );
                    pConstr->SetFKDatabaseTable( fkTable );
                    pConstr->SetPGMatch( (*it4)->GetMatchOPtion() );
                    switch( foreignKeyField.at( 0 )->GetOnUpdateConstraint() )
                    {
                        case RESTRICT_UPDATE:
                            pConstr->SetOnUpdate( Constraint::restrict );
                            break;
                        case SET_NULL_UPDATE:
                            pConstr->SetOnUpdate( Constraint::setNull );
                            break;
                        case SET_DEFAULT_UPDATE:
                        case CASCADE_UPDATE:
                            pConstr->SetOnUpdate( Constraint::cascade );
                            break;
                        case NO_ACTION_UPDATE:
                            pConstr->SetOnUpdate( Constraint::noAction );
                            break;
                    }
                    switch( foreignKeyField.at( 0 )->GetOnDeleteConstraint() )
                    {
                        case RESTRICT_DELETE:
                            pConstr->SetOnUpdate( Constraint::restrict );
                            break;
                        case SET_NULL_DELETE:
                            pConstr->SetOnUpdate( Constraint::setNull );
                            break;
                        case SET_DEFAULT_DELETE:
                        case CASCADE_DELETE:
                            pConstr->SetOnUpdate( Constraint::cascade );
                            break;
                        case NO_ACTION_DELETE:
                            pConstr->SetOnUpdate( Constraint::noAction );
                            break;
                    }
                    (*it)->GetShapeManager()->CreateConnection( (*it)->GetId(), dynamic_cast<DrawingDocument *>( m_view->GetDocument() )->GetReferencedTable( foreignKeyField.at( 0 )->GetReferencedTableName() )->GetId(), new ErdForeignKey( pConstr, ((DrawingView *) m_view)->GetViewType(), GetDiagramManager() ), sfDONT_SAVE_STATE );
                }
            }
        }
    }
}