// one that agrees to open the model.
while (factories.hasNext() && (factory == null)) {
factory = (TableauFactory) factories.next();
try {
Tableau tableau = factory.createTableau(effigy);
if (tableau != null) {
// The first tableau is a master if the container
// of the containing effigy is the model directory.
// Used to do this:
// if (effigy.getContainer() instanceof ModelDirectory) {
if (effigy.masterEffigy() == effigy) {
tableau.setMaster(true);
}
tableau.setEditable(effigy.isModifiable());
//THALES MODIF
catchTableau(tableau);
tableau.show();
return tableau;
}
} catch (Exception ex) {
// Ignore so we keep trying.
factory = null;
}
}
}
}
// Defer to the configuration.
// Create a tableau if there is a tableau factory.
factory = (TableauFactory) getAttribute("tableauFactory");
if (factory != null) {
// If this fails, we do not want the effigy to linger
try {
Tableau tableau = factory.createTableau(effigy);
if (tableau == null) {
throw new Exception("Tableau factory returns null.");
}
// The first tableau is a master if the container
// of the containing effigy is the model directory.
if (effigy.getContainer() instanceof ModelDirectory) {
tableau.setMaster(true);
}
tableau.setEditable(effigy.isModifiable());
//THALES MODIF
catchTableau(tableau);
tableau.show();
return tableau;
} catch (Exception ex) {
// Note that we can't rethrow the exception here
// because removing the effigy may result in
// the application exiting.