private String getTitleText() { StringBuilder sb = new StringBuilder(); sb.append( factMetaModel.getName() ); if ( factMetaModel.hasSuperType() ) { sb.append( " extends " ); sb.append( factMetaModel.getSuperType() ); } return sb.toString(); }
private static String toDRL( final FactMetaModel mm ) { final StringBuilder sb = new StringBuilder(); sb.append( "declare " ).append( mm.getName() ); if ( mm.hasSuperType() ) { sb.append( " extends " ); sb.append( mm.getSuperType() ); } for ( int i = 0; i < mm.getAnnotations().size(); i++ ) { AnnotationMetaModel a = mm.getAnnotations().get( i ); sb.append( "\n\t" ); sb.append( buildAnnotationDRL( a ) ); } for ( int i = 0; i < mm.getFields().size(); i++ ) { FieldMetaModel f = mm.getFields().get( i ); sb.append( "\n\t" ); sb.append( f.name ).append( ": " ).append( f.type ); } sb.append( "\nend" ); return sb.toString(); }
private boolean addCircular( final FactMetaModel fmm, final Set<String> circulars ) { if ( !fmm.hasSuperType() ) { return false; } String type = fmm.getName(); if ( circulars.contains( type ) ) { return true; } circulars.add( type ); FactMetaModel efmm = getFactMetaModel( fmm.getSuperType() ); return addCircular( efmm, circulars ); }
@UiHandler("deleteIcon") void deleteClick( ClickEvent event ) { //Check if the Fact is a super type of any other facts for ( FactMetaModel fmm : superTypeFactModels ) { if ( fmm.hasSuperType() ) { if ( fmm.getSuperType().equals( factMetaModel.getName() ) ) { Window.confirm( Constants.INSTANCE.CannotDeleteADeclarationThatIsASuperType() ); return; } } } if ( Window.confirm( Constants.INSTANCE.AreYouSureYouWantToRemoveThisFact() ) ) { deleteEvent.execute(); } }
public void onChange( ChangeEvent event ) { if ( lstSuperTypes.getSelectedIndex() <= 0 ) { factModel.setSuperType( null ); } else { String oldSuperType = factModel.getSuperType(); String newSuperType = lstSuperTypes.getItemText( lstSuperTypes.getSelectedIndex() ); factModel.setSuperType( newSuperType ); if ( createsCircularDependency( newSuperType ) ) { Window.alert( Constants.INSTANCE.CreatesCircularDependency( name.getText() ) ); factModel.setSuperType( oldSuperType ); lstSuperTypes.setSelectedIndex( getSelectedIndex( oldSuperType ) ); return; } else { factModel.setSuperType( newSuperType ); } } }
if ( !fmm.getName().equals( factModel.getName() ) ) { lstSuperTypes.addItem( fmm.getName() ); if ( factModel.getSuperType() != null && factModel.getSuperType().equals( fmm.getName() ) ) { selectedIndex = lstSuperTypes.getItemCount() - 1;