Ejemplo n.º 1
0
  private void tabbedPaneStateChanged(
      javax.swing.event.ChangeEvent evt) { // GEN-FIRST:event_tabbedPaneStateChanged
    // Add your handling code here:
    try {
      AbstractPage newPage = (AbstractPage) tabbedPane.getSelectedComponent();

      Log.print(
          "AdminFrame.stateChanged: currentPage: "
              + (currentPage == null ? "null" : currentPage.getClass().getName()));

      // ignore if we aren't changing tabs
      // presumably, we failed to change tabs and are now resetting
      // also ignore first time -- we do at window opening
      if (currentPage == newPage || currentPage == null) {
        return;
      }

      // Log.print("AdminFrame.stateChanged: newPage: " + newPage.getClass().getName());

      // tab doesn't get focus before switch, so we need to check here that
      // this tab switch is acceptable
      // Also, initial tab setting could happen before window is visible,
      // so we do the initial call in the WindowOpening event

      if (currentPage.exitPageCheck()) {
        // open the page
        openNewPage(newPage);
      } else {
        // page did not permit exit (e.g., failed save check)
        tabbedPane.setSelectedComponent(currentPage);
      }
    } catch (Throwable t) {
      Log.quit(t);
    }
  } // GEN-LAST:event_tabbedPaneStateChanged
Ejemplo n.º 2
0
 /**
  * Create a <code>ManagedTable</code> instance and add it to the static ArrayList of instances.
  *
  * @param name the table name of this instance
  */
 private ManagedTable(String name) {
   this.tableName = name;
   tableList.add(this);
   tableNumber = tableList.size() - 1;
   Log.print(this.toString());
   if (tableNumber > 127) {
     Log.quit("Too many managed tables");
   }
 }
Ejemplo n.º 3
0
  private void formWindowOpened(
      java.awt.event.WindowEvent evt) { // GEN-FIRST:event_formWindowOpened
    // Add your handling code here:
    try {
      // Close the login frame, if any.  (This is done the first time the window is made visible.)
      if (loginFrame != null) {
        loginFrame.dispose();
        loginFrame = null;
      }

      // hide any invalid pages
      if (!Global.theServerConnection.getPermissionAdmin()
          && !Global.theServerConnection.getPermissionTeamLeader()) {
        tabbedPane.remove(sessionPanel);
      }
      if (!Global.theServerConnection.getPermissionAdminProject()) {
        tabbedPane.remove(projectPanel);
      }
      if (!Global.theServerConnection.getPermissionAdminUsers()) {
        tabbedPane.remove(userAdminPanel);
        tabbedPane.remove(teamAdminPanel);
      }
      if (!Global.theServerConnection.getPermissionAdminImport()) {
        tabbedPane.remove(importPanel);
        tabbedPane.remove(populatePanel);
      }
      if (!Global.theServerConnection.getPermissionAdminExport()) {
        tabbedPane.remove(exportPanel);
      }
      if (!Global.theServerConnection.getPermissionAdminProfit()) {
        tabbedPane.remove(receivablesPanel);
      }
      if (!Global.theServerConnection.getPermissionAdminBatch()) {
        tabbedPane.remove(batchingPanel);
      }
      if (!Global.theServerConnection.getPermissionAdmin()) {
        tabbedPane.remove(tablePanel);
        tabbedPane.remove(reportPanel);
        tabbedPane.remove(sessionPanel);
      }

      // Open the first page, after window is open
      AbstractPage newPage = (AbstractPage) tabbedPane.getSelectedComponent();
      openNewPage(newPage);
    } catch (Throwable t) {
      Log.quit(t);
    }
  } // GEN-LAST:event_formWindowOpened
Ejemplo n.º 4
0
  /** Write the message with attributes and set the result. */
  @Override
  public void run() throws IOException {
    MessageWriter writer = scon.startMessage(T_BINDER_UPDATE);
    writer.writeAttribute(A_PAGE_ID, pageId);
    if (isToRemovePage) {
      writer.writeAttribute(A_REMOVE, "YES");
    }
    addStandardAttributes(writer);
    writer.endElement();
    writer.close();
    Log.print("(TaskBinderUpdate.run) page=" + pageId + " isToRemovePage=" + isToRemovePage);

    Element reply = scon.receiveMessage();

    String ok = reply.getNodeName();

    if (!T_OK.equals(ok) && !T_FAIL.equals(ok)) {
      Log.quit("BatchBoundary unexpected message type: " + ok);
    }
  }
Ejemplo n.º 5
0
  public void closeSession(java.awt.event.WindowEvent evt) {
    try {
      // close the server and image server connections gently
      // TBD: really should be in a client task
      try {
        // client.Global.theServerConnection.shutdown();
        final ClientTask task;
        task = new TaskGoodbye();
        task.enqueue(this);

      } catch (Exception e) {
      }
      //            try {
      //                client.Global.theImageConnection.shutdown();
      //            } catch (Exception e) {
      //            }
      System.exit(0);
    } catch (Throwable th) {
      Log.quit(th);
    }
  }
Ejemplo n.º 6
0
  public void run(ServerTask task, Element action) {
    try {
      // Log.print("Handler_delimiter_data");
      Element givenValueList = action;

      // Note.  "child" may be ignored white space, if not validating parser
      Node firstChild = givenValueList.getFirstChild();
      while (firstChild != null && firstChild.getNodeType() != Node.ELEMENT_NODE) {
        firstChild = firstChild.getNextSibling();
      }
      if (firstChild != null) {
        DelimiterData data = new DelimiterData();
        // fill in the int and String fields of DelimiterData
        MessageReader.decode(givenValueList, data, /* trim? */ false);
        if (data != null) {
          // update or insert the export row contained in data
          // Log.print("(Handler_delimiter_data.run) project is " + data.delimiter_set_name);
          saveDelimiterData(task, data);
        }
      }
    } catch (Throwable t) {
      Log.quit(t);
    }
  }
Ejemplo n.º 7
0
 /** Exit the Application. Note: This may be called from the various tab pages. */
 public void exitForm(java.awt.event.WindowEvent evt) { // GEN-FIRST:event_exitForm
   try {
     // close the server and image server connections gently
     // TBD: really should be in a client task
     Log.print("AdminFrame.exitForm");
     try {
       client.Global.theServerConnection.shutdown();
       closeSession(evt);
     } catch (Exception e) {
     }
     try {
       synchronized (ImageThread.class) {
         if (Global.theImageConnection != null) {
           Global.theImageConnection.shutdown();
         }
       }
     } catch (Exception e) {
     }
     System.exit(0);
   } catch (Throwable th) {
     Log.quit(th);
   }
   System.exit(0);
 } // GEN-LAST:event_exitForm
Ejemplo n.º 8
0
 private void saveDelimiterData(ServerTask task, DelimiterData data) throws java.io.IOException {
   try {
     Log.print("(Handler_delimiter_data.save) '" + data.value_separator + "'");
     Connection con = task.getConnection();
     Statement st = task.getStatement();
     PreparedStatement pst = null;
     if (data.force.equals("")) {
       // delete
       pst = con.prepareStatement("delete from export" + " where export_name = ?");
       pst.setString(1, data.delimiter_set_name);
       pst.executeUpdate();
     } else {
       // see if the export_name exists
       pst = con.prepareStatement("select export_name" + " from export" + " where export_name=?");
       pst.setString(1, data.delimiter_set_name);
       ResultSet rs = pst.executeQuery();
       if (rs.next()) {
         // Log.print("(Handler_export_data.saveExportData) update " + data.delimiter_set_name);
         // update
         rs.close();
         pst =
             con.prepareStatement(
                 "update export set"
                     + " force_export = ?,"
                     + " uppercase = ?,"
                     + " uppercase_names = ?,"
                     + " field_delimiter = ?,"
                     + " text_qualifier = ?,"
                     + " value_separator = ?,"
                     + " date_format = ?,"
                     + " missing_date = ?,"
                     + " missing_year = ?,"
                     + " missing_month = ?,"
                     + " missing_day = ?,"
                     + " missing_date_character = ?,"
                     + " name_mask1 = ?,"
                     + " name_mask2 = ?,"
                     + " name_mask3 = ?,"
                     + " name_mask4 = ?,"
                     + " brs_format = ?"
                     + " where export_name = ?");
         pst.setString(1, data.force);
         pst.setString(2, data.uppercase);
         pst.setString(3, data.uppercase_names);
         pst.setString(4, data.field_delimiter);
         pst.setString(5, data.text_qualifier);
         pst.setString(6, data.value_separator);
         pst.setString(7, data.date_format);
         pst.setString(8, data.missing_date);
         pst.setString(9, data.missing_year);
         pst.setString(10, data.missing_month);
         pst.setString(11, data.missing_day);
         pst.setString(12, data.missing_date_character);
         pst.setString(13, data.name_mask1);
         pst.setString(14, data.name_mask2);
         pst.setString(15, data.name_mask3);
         pst.setString(16, data.name_mask4);
         pst.setString(17, data.brs_format);
         pst.setString(18, data.delimiter_set_name);
         pst.executeUpdate();
         pst.close();
       } else {
         // insert
         // Log.print("(Handler_export_data.saveExportData) insert " + data.delimiter_set_name);
         rs.close();
         pst =
             con.prepareStatement(
                 "insert into export set"
                     + " force_export = ?,"
                     + " uppercase = ?,"
                     + " uppercase_names = ?,"
                     + " field_delimiter = ?,"
                     + " text_qualifier = ?,"
                     + " value_separator = ?,"
                     + " date_format = ?,"
                     + " missing_date = ?,"
                     + " missing_year = ?,"
                     + " missing_month = ?,"
                     + " missing_day = ?,"
                     + " missing_date_character = ?,"
                     + " export_name = ?,"
                     + " name_mask1 = ?,"
                     + " name_mask2 = ?,"
                     + " name_mask3 = ?,"
                     + " name_mask4 = ?,"
                     + " brs_format = ?");
         pst.setString(1, data.force);
         pst.setString(2, data.uppercase);
         pst.setString(3, data.uppercase_names);
         pst.setString(4, data.field_delimiter);
         pst.setString(5, data.text_qualifier);
         pst.setString(6, data.value_separator);
         pst.setString(7, data.date_format);
         pst.setString(8, data.missing_date);
         pst.setString(9, data.missing_year);
         pst.setString(10, data.missing_month);
         pst.setString(11, data.missing_day);
         pst.setString(12, data.missing_date_character);
         pst.setString(13, data.delimiter_set_name);
         pst.setString(14, data.name_mask1);
         pst.setString(15, data.name_mask2);
         pst.setString(16, data.name_mask3);
         pst.setString(17, data.name_mask4);
         pst.setString(18, data.brs_format);
         pst.executeUpdate();
         pst.close();
       }
     }
     pst.close();
   } catch (Throwable t) {
     Log.quit(t);
   }
   MessageWriter writer = task.getMessageWriter();
   writer.startElement(T_OK);
   writer.endElement();
 }