コード例 #1
0
  static RandomIntegerWorkspaceObject load(Node node) throws ProgramLoadingException {
    if (!node.getNodeName().equals("randint")) throw new ProgramLoadingException();

    RandomIntegerWorkspaceObject obj = new RandomIntegerWorkspaceObject(Workspace.getWorkspace());

    Node subNode = Workspace.getNthChildElement(node, 0);
    if (subNode != null) {
      WorkspaceObject wsObj = Workspace.dispatchLoad(subNode);
      if (wsObj != null) {
        obj.sink.progCombine(wsObj);
      }
    }
    return obj;
  }
コード例 #2
0
 /** Hinzufuegen der ausgewaehlten Events */
 public void addEvents() throws SQLException {
   for (int i = 0; i < tm.getRowCount(); i++)
     if (tm.getValueAt(i, 2).equals(true))
       Workspace.getInstance()
           .getDatabase()
           .setEventToTutor(
               Integer.parseInt(tm.getValueAt(i, 0).toString()), tutorPanel.getTutor().getID());
 }
コード例 #3
0
  static DivisionOperatorWorkspaceObject load(Node node) throws ProgramLoadingException {
    if (!node.getNodeName().equals("division")) throw new ProgramLoadingException();

    DivisionOperatorWorkspaceObject obj =
        new DivisionOperatorWorkspaceObject(Workspace.getWorkspace());
    Node lop = Workspace.getChildElementByName(node, "loperand");
    Node rop = Workspace.getChildElementByName(node, "roperand");

    if (lop != null) {
      Node lopNode = Workspace.getNthChildElement(lop, 0);
      if (lopNode != null) {
        WorkspaceObject lopObj = Workspace.dispatchLoad(lopNode);
        if (lopObj != null) {
          obj.leftSink.progCombine(lopObj);
        }
      }
    }

    if (rop != null) {
      Node ropNode = Workspace.getNthChildElement(rop, 0);
      if (ropNode != null) {
        WorkspaceObject ropObj = Workspace.dispatchLoad(ropNode);
        if (ropObj != null) {
          obj.rightSink.progCombine(ropObj);
        }
      }
    }

    return obj;
  }
コード例 #4
0
  /** Konstruktor */
  public TutorToEventFrame(TutorPanel tut) {
    super("Veranstaltungen zuordnen");
    this.tutorPanel = tut;
    setLayout(new BorderLayout());
    try {
      tm =
          new TableModel(
              prakColumnNames, Workspace.getInstance().getDatabase().getUnassignedEvents());
      table = new Table(tm);
      setTableSize();
      getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
    } catch (Exception e) {
      e.printStackTrace();
    }

    // Hinzufuegen
    btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              addEvents();
              ((TutorPanel) tutorPanel).rewritePrakTable();
              setVisible(false);
            } catch (Exception err) {
              err.printStackTrace();
            }
          }
        });

    // Schliessen Button
    btnClose.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false);
          }
        });

    actionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));
    actionPanel.add(btnOk);
    actionPanel.add(btnClose);
    getContentPane().add(actionPanel, BorderLayout.SOUTH);
    this.setLocation(MainFrame.getInstance().getLocation());
    this.pack();
    this.setVisible(true);
  }