home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xa / SchemaWin$EditModelDialog.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.9 KB  |  95 lines

  1. package com.extensibility.xa;
  2.  
  3. import com.extensibility.app.DialogFactory;
  4. import com.extensibility.app.UI;
  5. import com.extensibility.xml.BaseDeclaration;
  6. import com.extensibility.xml.ContentModelOwner;
  7. import com.extensibility.xml.DTDUtilities;
  8. import com.extensibility.xml.InternalPEDeclaration;
  9. import com.extensibility.xml.ParserException;
  10. import java.util.Enumeration;
  11.  
  12. public class SchemaWin$EditModelDialog extends ModelCellDialog {
  13.    // $FF: synthetic field
  14.    final SchemaWin this$0;
  15.  
  16.    public SchemaWin$EditModelDialog(SchemaWin var1, SchemaDoc var2, boolean var3) {
  17.       super(var1, var2, (ContentModelQlicker)null, (ContentModelOwner)null, var3, (String)null);
  18.       this.this$0 = var1;
  19.       ((CellDialog)this).setURI(((ModelCellDialog)this).getSchemaDoc().getFocusedURI(true));
  20.    }
  21.  
  22.    public SchemaWin$EditModelDialog(SchemaWin var1, SchemaDoc var2, boolean var3, String var4) {
  23.       super(var1, var2, (ContentModelQlicker)null, (ContentModelOwner)null, var3, (String)null);
  24.       this.this$0 = var1;
  25.       if (var4 != null) {
  26.          ((CellDialog)this).setText(var4);
  27.          super.orgValue = var4;
  28.       }
  29.  
  30.    }
  31.  
  32.    protected void doDelete() {
  33.       String var1 = ((CellDialog)this).getCellOwner();
  34.       SchemaDoc var2 = ((ModelCellDialog)this).getSchemaDoc();
  35.       InternalPEDeclaration var3 = (InternalPEDeclaration)var2.getNamedContentModelOwner(var1);
  36.       if (!var2.isEditable(var3)) {
  37.          DialogFactory.stop(this, UI.getString("stop.foreign.uri", ((BaseDeclaration)var3).getURI().getFullName()));
  38.       } else {
  39.          Enumeration var4 = var2.getUsedBy(var3);
  40.          if (var4.hasMoreElements()) {
  41.             String var6 = UI.getString("stop.delete.in.use", var1, ((BaseDeclaration)var4.nextElement()).getName());
  42.             DialogFactory.stop(this, var6);
  43.          } else {
  44.             boolean var5 = DialogFactory.showConfirm(this, UI.getString("dialog.delete.pe", var1), UI.getString("dialog.delete"));
  45.             if (var5) {
  46.                var2.removeDeclaration(var3);
  47.                super.doDelete();
  48.             }
  49.          }
  50.       }
  51.    }
  52.  
  53.    protected boolean doSave() {
  54.       try {
  55.          if (!super.doSave()) {
  56.             boolean var8 = false;
  57.             return var8;
  58.          } else {
  59.             String var1 = ((CellDialog)this).getCellOwner();
  60.             String var9 = ((CellDialog)this).getText();
  61.             var1 = DTDUtilities.convertPEName(var1, false);
  62.             SchemaDoc var3 = ((ModelCellDialog)this).getSchemaDoc();
  63.             if (((CellDialog)this).getMode() == 1) {
  64.                if (var3.getNamedDeclaration(var1, Class.forName("com.extensibility.xml.InternalPEDeclaration")) != null) {
  65.                   throw new ParserException(206, var1);
  66.                }
  67.  
  68.                InternalPEDeclaration var4 = new InternalPEDeclaration(var1, Class.forName("com.extensibility.xml.ContentModelTerm"));
  69.                var3.ensureURI(var4);
  70.                var3.updateContentModel(var4, var9);
  71.                var4.setValue(var9);
  72.                var3.insertDeclaration(var4, (BaseDeclaration)null);
  73.             } else {
  74.                InternalPEDeclaration var10 = (InternalPEDeclaration)var3.getNamedContentModelOwner(var1);
  75.                if (!var3.isEditable(var10)) {
  76.                   DialogFactory.stop(this, UI.getString("stop.foreign.uri", ((BaseDeclaration)var10).getURI().getFullName()));
  77.                   boolean var5 = false;
  78.                   return var5;
  79.                }
  80.  
  81.                var3.updateContentModel(var10, var9);
  82.                var10.setValue(var9);
  83.             }
  84.  
  85.             boolean var11 = true;
  86.             return var11;
  87.          }
  88.       } catch (ParserException var6) {
  89.          DialogFactory.showValidation(this, var6.getMessage(), false);
  90.          boolean var2 = false;
  91.          return var2;
  92.       }
  93.    }
  94. }
  95.