Ejemplo n.º 1
0
 @Override
 public void contextDiscarded(Context context) {
   Transaction transaction = persistenceManager.beginDirtyTransaction();
   try {
     cliJPanel.message("Context:" + context.identifier(transaction) + " couldn't be proved!");
   } catch (InterruptedException e) {
     logger.error("Error", e);
   } finally {
     transaction.abort();
   }
 }
Ejemplo n.º 2
0
 @Override
 public void contextProved(Context context, Proof proof) {
   Transaction transaction = persistenceManager.beginTransaction();
   try {
     try {
       proof.execute(transaction);
       cliJPanel.message("Context:" + context.identifier(transaction) + " proved!");
       transaction.commit();
     } catch (ExecutionException e) {
       logger.error("Error", e);
       cliJPanel.exception(e);
     }
   } catch (InterruptedException e) {
     logger.error("Error", e);
   } finally {
     transaction.abort();
   }
 }
Ejemplo n.º 3
0
  public AuthorityHeaderJPanel(
      AuthorityJPanel authorityJPanel, StatementAuthority statementAuthority) {
    super();
    this.authorityJPanel = authorityJPanel;
    this.statementAuthority = statementAuthority;
    GridBagLayout gridBagLayout = new GridBagLayout();
    setLayout(gridBagLayout);
    setBackground(Color.white);
    Transaction transaction = getPersistenceManager().beginTransaction(transactionTimeOut);
    try {
      Insets insets = new Insets(0, 0, 0, 10);
      {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.insets = insets;
        gbc.anchor = GridBagConstraints.WEST;
        add(new BoldTextLabelRenderer("Author"), gbc);
      }
      {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.insets = insets;
        gbc.anchor = GridBagConstraints.WEST;
        add(new PersonLabelRenderer(statementAuthority.getAuthor(transaction)), gbc);
      }
      {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.insets = insets;
        gbc.anchor = GridBagConstraints.WEST;
        add(new BoldTextLabelRenderer("Created"), gbc);
      }
      {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 1;
        gbc.insets = insets;
        gbc.anchor = GridBagConstraints.WEST;
        add(new DateLabelRenderer(statementAuthority.getCreationDate()), gbc);
      }
      {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 2;
        gbc.insets = insets;
        gbc.anchor = GridBagConstraints.WEST;
        add(new BoldTextLabelRenderer("Status"), gbc);
      }
      {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 2;
        gbc.insets = insets;
        gbc.anchor = GridBagConstraints.WEST;
        add(new SignatureStatusLabelRenderer(statementAuthority.signatureStatus()), gbc);
      }
      Statement statement = statementAuthority.getStatement(transaction);
      if (statement != null) {
        this.dependenciesListJTable =
            new MyStatementListJTable(
                "Dependencies", new BufferedList<>(statement.dependencies(transaction)));
        {
          GridBagConstraints gbc = new GridBagConstraints();
          gbc.gridx = 2;
          gbc.gridy = 0;
          gbc.gridheight = 4;
          gbc.insets = insets;
          gbc.anchor = GridBagConstraints.WEST;
          gbc.fill = GridBagConstraints.BOTH;
          JScrollPane depPane = new JScrollPane(this.dependenciesListJTable);
          add(depPane, gbc);
          this.dependenciesListFocusBorderManager =
              new FocusBorderManager(depPane, dependenciesListJTable);
        }
        if (statement instanceof Context) {
          Context context = (Context) statement;
          this.solverListJTable =
              new MyStatementListJTable(
                  "Solvers", new BufferedList<>(context.solvers(transaction)));
          {
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.gridx = 3;
            gbc.gridy = 0;
            gbc.gridheight = 4;
            gbc.insets = insets;
            gbc.anchor = GridBagConstraints.WEST;
            gbc.fill = GridBagConstraints.BOTH;
            JScrollPane solPane = new JScrollPane(this.solverListJTable);
            add(solPane, gbc);
            this.solverListFocusBorderManager = new FocusBorderManager(solPane, solverListJTable);
          }
        } else {
          this.solverListJTable = null;
          this.solverListFocusBorderManager = null;
        }
        DelegateTreeRootNode delegateTreeRootNode =
            statementAuthority.getDelegateTreeRootNode(transaction);
        if (delegateTreeRootNode != null && !delegateTreeRootNode.successorEntries().isEmpty()) {

          {
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.gridx = 4;
            gbc.gridy = 0;
            gbc.gridheight = 4;
            gbc.insets = insets;
            gbc.anchor = GridBagConstraints.WEST;
            gbc.fill = GridBagConstraints.BOTH;
            JLabel label = new JLabel("             ");
            label.setFont(FontManager.instance.defaultFont());
            add(label, gbc);
          }
          this.successorListJTable =
              new SuccessorsJTable(getPersistenceManager(), delegateTreeRootNode);
          {
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.gridx = 5;
            gbc.gridy = 0;
            gbc.gridheight = 4;
            gbc.insets = insets;
            gbc.anchor = GridBagConstraints.WEST;
            gbc.fill = GridBagConstraints.BOTH;
            JScrollPane sucPane = new JScrollPane(this.successorListJTable);
            add(sucPane, gbc);
            this.successorListFocusBorderManager =
                new FocusBorderManager(sucPane, successorListJTable);
          }
        } else {
          this.successorListJTable = null;
          this.successorListFocusBorderManager = null;
        }
      } else {
        this.dependenciesListJTable = null;
        this.dependenciesListFocusBorderManager = null;
        this.solverListJTable = null;
        this.solverListFocusBorderManager = null;
        this.successorListJTable = null;
        this.successorListFocusBorderManager = null;
      }

    } finally {
      transaction.abort();
    }
  }