@Bean(name = "mainDataSource")
  public DataSource dataSource() {

    ComboPooledDataSource dataSource = new ComboPooledDataSource();
    try {
      dataSource.setDriverClass(env.getProperty("jdbc.driverClassName"));
    } catch (PropertyVetoException e) {
      // TODO Auto-generated catch block
      logger.info("PropertyVetoException : {}", e.getMessage());
    }
    dataSource.setJdbcUrl(env.getProperty("jdbc.url"));
    dataSource.setUser(env.getProperty("jdbc.username"));
    dataSource.setPassword(env.getProperty("jdbc.password"));
    dataSource.setAcquireIncrement(20);
    dataSource.setAcquireRetryAttempts(30);
    dataSource.setAcquireRetryDelay(1000);
    dataSource.setAutoCommitOnClose(false);
    dataSource.setDebugUnreturnedConnectionStackTraces(true);
    dataSource.setIdleConnectionTestPeriod(100);
    dataSource.setInitialPoolSize(10);
    dataSource.setMaxConnectionAge(1000);
    dataSource.setMaxIdleTime(200);
    dataSource.setMaxIdleTimeExcessConnections(3600);
    dataSource.setMaxPoolSize(10);
    dataSource.setMinPoolSize(2);
    dataSource.setPreferredTestQuery("select 1");
    dataSource.setTestConnectionOnCheckin(false);
    dataSource.setUnreturnedConnectionTimeout(1000);
    return dataSource;
  }
Example #2
0
  /**
   * Returns a JMenu object for use in the JMenuBar.
   *
   * @return JMenu
   */
  private JMenu getAboutMenu() {

    JMenu aboutMenu = new JMenu("Om");
    aboutMenu.setMnemonic('o');

    JMenuItem tipsItem = new JMenuItem("Dagens tips");
    tipsItem.setMnemonic('d');
    tipsItem.addActionListener(evt -> dailyTips());

    JMenuItem aboutItem = new JMenuItem("Om Fargestiften");
    aboutItem.setMnemonic('o');
    aboutItem.addActionListener(
        evt -> {
          AboutDialog about = new AboutDialog();

          internalFrameSize = about.getSize();
          about.setLocation(
              (desktopSize.width - internalFrameSize.width) / 2,
              (desktopSize.height - internalFrameSize.height) / 2);

          about.setVisible(true);

          jDesktopPane.add(about, JLayeredPane.MODAL_LAYER);
          try {
            about.setSelected(true);
          } catch (PropertyVetoException e) {
            e.printStackTrace();
          }
        });

    aboutMenu.add(tipsItem);
    aboutMenu.add(aboutItem);

    return aboutMenu;
  }
Example #3
0
  /** Default constructor, creates a new frame. */
  public MainWindow() {
    super("Fargestiften");

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new Dimension(640, 480));
    setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);

    jDesktopPane = new JDesktopPane();
    desktopSize = jDesktopPane.getSize();

    firstStartup = true;

    // Create welcome screen
    StartupDialog startupDialog = new StartupDialog(this);

    internalFrameSize = startupDialog.getSize();
    startupDialog.setLocation(
        (screenSize.width - internalFrameSize.width) / 2,
        (screenSize.height - internalFrameSize.height) / 3);

    startupDialog.setVisible(true);

    jDesktopPane.add(startupDialog, JLayeredPane.MODAL_LAYER);
    try {
      startupDialog.setSelected(true);
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    }

    serialization = new StorageSerialization();
  }
Example #4
0
  /**
   * This method handels the creation of a new DrawingArea
   *
   * @param projectName Name of project created
   */
  private void createDrawing(String projectName) {
    if (firstStartup) {
      dailyTips();
      firstStartup = false;
    }

    drawingArea = new DrawingArea(toolbox, toolSettings, activeColorSettings);
    drawingArea.setProjectName(projectName.toLowerCase());

    Dimension desktopSize = jDesktopPane.getSize();
    Dimension jInternalFrameSize = drawingArea.getSize();
    drawingArea.setLocation(
        (desktopSize.width - jInternalFrameSize.width) / 2,
        (desktopSize.height - jInternalFrameSize.height) / 2);

    drawingArea.setTitle("Prosjekt: " + projectName);

    drawingArea.setVisible(true);

    jDesktopPane.add(drawingArea);
    try {
      drawingArea.setSelected(true);
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    }
  }
Example #5
0
  /**
   * Gerenciador de JInternalFrames
   *
   * @param jIFrame JInternalFrame : InternalFrame que se deseja gerenciar
   */
  public void manager(JInternalFrame jIFrame) {

    boolean isActive = false;
    JInternalFrame[] frames = dPane.getAllFrames();
    for (JInternalFrame jif : frames) {

      if (!reply) {
        if (jif.getClass().equals(jIFrame.getClass())) {
          isActive = true;
          jif.moveToFront();
          try {
            jif.setMaximum(true);
            jif.setMaximum(false);
          } catch (PropertyVetoException e) {
            e.printStackTrace();
          }
        }
      }
    }
    if (!isActive) {
      if (frames.length > 0) {
        cascata(jIFrame, frames[0]);
        jIFrame.setLocation(x, y);
      } else {
        jIFrame.setLocation(minX, minY);
      }

      dPane.add(jIFrame);
      jIFrame.setVisible(true);
    }
  }
  /**
   * Creates a new instance of VirtualPluginBuild
   *
   * @param url the complete url of the build
   */
  public VirtualPluginBuild(URL url) {
    super();

    this.url = url;

    /** no check for virtual build */
    this.setCheckType(CheckSum.NONE);
    this.setVersion(Version.UNKNOWN_VERSION);

    /* set name according to url */
    if (this.getURL() != null) {
      String file = this.getURL().getFile();

      if (file != null) {
        int lastSlashIndex = file.lastIndexOf('/');

        if (lastSlashIndex > -1) {
          file = file.substring(lastSlashIndex + 1);
        }

        try {
          this.setName(file);
        } catch (PropertyVetoException e) {
          e.printStackTrace();
        }
      }
    }
  }
Example #7
0
 public Finocyl() {
   try {
     setLength(Amount.valueOf(70, SI.MILLIMETER));
   } catch (PropertyVetoException e) {
     e.printStackTrace();
   }
   generateGeometry();
 }
Example #8
0
 /**
  * Delete the bean after all the checking has been done.
  *
  * <p>Separate so that it can be easily subclassed if other functionality is needed.
  */
 void doDelete(NamedBean bean) {
   try {
     getManager().deleteBean(bean, "DoDelete");
   } catch (PropertyVetoException e) {
     // At this stage the DoDelete shouldn't fail, as we have already done a can delete, which
     // would trigger a veto
     log.error(e.getMessage());
   }
 }
Example #9
0
 @Override
 public void internalFrameOpened(InternalFrameEvent e) {
   // TODO: Setting as selected isn't working for any internal frames
   try {
     e.getInternalFrame().setSelected(true);
   } catch (PropertyVetoException e1) {
     e1.printStackTrace();
   }
 }
  private void prepareSearchArea() {
    initPhase = true;
    searchPanes = new CollapsiblePanes();
    searchPanes.setLayout(new JideBoxLayout(searchPanes, JideBoxLayout.Y_AXIS));

    CollapsiblePane searchPane = new CollapsiblePane(SYSTools.xx(internalClassID));
    searchPane.setSlidingDirection(SwingConstants.SOUTH);
    searchPane.setStyle(CollapsiblePane.PLAIN_STYLE);
    searchPane.setCollapsible(false);

    try {
      searchPane.setCollapsed(false);
    } catch (PropertyVetoException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }
    JPanel mypanel = new JPanel();
    mypanel.setLayout(new VerticalLayout(3));
    mypanel.setBackground(Color.WHITE);

    JideButton printButton =
        GUITools.createHyperlinkButton(
            "Drucken",
            SYSConst.icon22print2,
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent actionEvent) {
                SYSFilesTools.print(
                    ResInfoTools.getTXReport(
                        resident,
                        true,
                        false,
                        tbMedi.isSelected(),
                        tbBilanz.isSelected(),
                        tbBerichte.isSelected(),
                        true,
                        false,
                        true,
                        true),
                    true);
              }
            });
    mypanel.add(printButton);

    searchPane.setContentPane(mypanel);
    searchPanes.add(searchPane);
    searchPanes.add(addFilters());
    searchPanes.addExpansion();

    jspSearch.setViewportView(searchPanes);

    initPhase = false;
  }
Example #11
0
 protected void changeToOracle() {
   ComboPooledDataSource dataSource = (ComboPooledDataSource) jdbcTemplate.getDataSource();
   try {
     dataSource.setDriverClass("oracle.jdbc.driver.OracleDriver");
     dataSource.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:XE");
     dataSource.setUser("javashop");
     dataSource.setPassword("752513");
   } catch (PropertyVetoException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
  // This function will get the advisor details from the database depending upon the username
  // entered by the advisor in the forgot password form
  public AdvisorProfileDTO getForgotPasswordDetails(String userName, String register) {

    logger.info("Entered getForgotPasswordDetails method of ForgotPasswordDAO");

    PreparedStatement pstmt;
    ResultSet results = null;
    String query = "";
    AdvisorProfileDTO profile = new AdvisorProfileDTO();
    Boolean flag = true;
    try {
      conn = ConnectionFactory.getConnection();
      conn.setAutoCommit(false);
      if (register.equals("true")) {
        query = "SELECT ADVISOR_ID,EMAIL FROM advisordetails WHERE EMAIL = ?";
      } else {
        query = "SELECT ADVISOR_ID,EMAIL FROM advisordetails WHERE EMAIL = ? AND ISACTIVE= ?";
      }
      pstmt = conn.prepareStatement(query);
      pstmt.setString(1, userName);
      if (!register.equals("true")) {
        pstmt.setBoolean(2, flag);
      }
      results = pstmt.executeQuery();
      if (results.first()) {
        profile.setAdvisorId(results.getInt("ADVISOR_ID"));
        profile.setEmail(results.getString("EMAIL"));
      }
      logger.info("Entered getForgotPasswordDetails method of ForgotPasswordDAO");
    } catch (SQLException e) {
      logger.error(
          "getForgotPasswordDetails method of ForgotPasswordDAO threw error:" + e.getMessage());
      e.printStackTrace();
    } catch (IOException e) {
      logger.error(
          "getForgotPasswordDetails method of ForgotPasswordDAO threw error:" + e.getMessage());
      e.printStackTrace();
    } catch (PropertyVetoException e) {
      logger.error(
          "getForgotPasswordDetails method of ForgotPasswordDAO threw error:" + e.getMessage());
      e.printStackTrace();
    } finally {
      try {
        conn.close();
      } catch (SQLException e) {
        logger.error(
            "getForgotPasswordDetails method of ForgotPasswordDAO threw error:" + e.getMessage());
        e.printStackTrace();
      }
    }

    return profile;
  }
Example #13
0
  private void testeWechsel() {
    int vorher = 0, nachher = 0;
    //		for(int i = 0;i<1;i++){
    if (this.desktop == 0) {
      vorher = 0;
      nachher = 1;
      //			break;
    } else {
      vorher = 1;
      nachher = 0;
      //			break;
    }
    //		}
    this.removeInternalFrameListener(this);

    this.setVisible(false);
    //// System.out.println("Layer vor dem Wechsel"
    // +Reha.thisClass.desktops[vorher].getLayer(this));
    Reha.thisClass.desktops[vorher].remove(this);
    ((JDesktopPane) Reha.thisClass.desktops[vorher]).updateUI();
    Reha.thisClass.desktops[vorher].repaint();
    this.setVisible(true);
    Reha.thisClass.desktops[nachher].add(this);

    this.setLocation(20, 10);
    Reha.thisClass.desktops[nachher].validate();
    ((JDesktopPane) Reha.thisClass.desktops[nachher]).updateUI();
    Reha.thisClass.desktops[nachher].repaint();
    this.desktop = nachher;
    this.addInternalFrameListener(this);
    try {
      this.toFront();
      this.setSelected(true);
      this.isActive = true;
      this.validateTree();
    } catch (PropertyVetoException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    frameAktivieren(this.getName());
    //// System.out.println("Layer nach dem Wechsel"
    // +Reha.thisClass.desktops[nachher].getLayer(this));
    /*
    try {
    	setSelected(true);
    } catch (PropertyVetoException e) {
    	// TODO Auto-generated catch block
    	e.printStackTrace();
    }
    */
  }
  /**
   * maximizes the internal frame to the viewport bounds rather than the desktop bounds
   *
   * @param f the internal frame being maximized
   */
  public void maximizeFrame(JInternalFrame f) {

    Rectangle p = desktopPane.getScrollPaneRectangle();
    f.setNormalBounds(f.getBounds());
    setBoundsForFrame(f, p.x, p.y, p.width, p.height);
    try {
      f.setSelected(true);
    } catch (PropertyVetoException pve) {
      System.out.println(pve.getMessage());
    }

    removeIconFor(f);
  }
Example #15
0
  /**
   * This method handles the loading of an existing project into a new DrawingArea. Gives feedback
   * to the user if project is not found or incompatible with the current version
   *
   * @param projectName Name of project to load
   */
  private void loadDrawing(String projectName) {
    if (firstStartup) {
      dailyTips();
      firstStartup = false;
    }

    drawingArea = new DrawingArea(toolbox, toolSettings, activeColorSettings);
    drawingArea.setProjectName(projectName.toLowerCase());

    try {
      serialization.load(drawingArea, projectName.toLowerCase());

      Dimension desktopSize = jDesktopPane.getSize();
      Dimension jInternalFrameSize = drawingArea.getSize();
      drawingArea.setLocation(
          (desktopSize.width - jInternalFrameSize.width) / 2,
          (desktopSize.height - jInternalFrameSize.height) / 2);

      drawingArea.setTitle("Prosjekt: " + projectName);

      drawingArea.setVisible(true);

      jDesktopPane.add(drawingArea);

    } catch (StorageException ex) {
      // ex.printStackTrace();
      Toolkit.getDefaultToolkit().beep();
      JOptionPane.showMessageDialog(
          null, "Fant ikke prosjektet på serveren.", "Feil", JOptionPane.ERROR_MESSAGE);

    } catch (IOException ex) {
      // ex.printStackTrace();
      Toolkit.getDefaultToolkit().beep();
      JOptionPane.showMessageDialog(
          null,
          "Dette prosjektet ble laget på en eldre versjon av programmet.\n"
              + "Dessverre er det ikke kompatibelt med nåværende versjon.",
          "Gammel versjon",
          JOptionPane.ERROR_MESSAGE);

    } catch (URISyntaxException | ClassNotFoundException ex) {
      ex.printStackTrace();
    }

    try {
      drawingArea.setSelected(true);
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    }
  }
 @VisibleForTesting
 void failIfVetoed(
     JInternalFrame internalFrame, JInternalFrameAction action, UnexpectedException unexpected) {
   PropertyVetoException vetoError = vetoFrom(unexpected);
   if (vetoError == null) return;
   throw actionFailure(
       concat(
           action.name,
           " of ",
           format(internalFrame),
           " was vetoed: <",
           vetoError.getMessage(),
           ">"));
 }
 public static ComboPooledDataSource dameDataSource() {
   if (cpds == null) {
     cpds = new ComboPooledDataSource();
     try {
       cpds.setDriverClass("org.gjt.mm.mysql.Driver");
     } catch (PropertyVetoException e) {
       e.printStackTrace();
     }
     cpds.setJdbcUrl("jdbc:mysql://localhost/practica1");
     cpds.setUser("UsuarioP1");
     cpds.setPassword("pass");
   }
   return cpds;
 }
 @VisibleForTesting
 void failIfVetoed(
     @Nonnull JInternalFrame internalFrame,
     @Nonnull JInternalFrameAction action,
     @Nonnull UnexpectedException unexpected) {
   PropertyVetoException vetoError = vetoFrom(unexpected);
   if (vetoError == null) {
     return;
   }
   String msg =
       String.format(
           "%s of %s was vetoed: <%s>",
           action.name, format(internalFrame), vetoError.getMessage());
   throw actionFailure(msg);
 }
  /**
   * Manages the JDBC connection
   *
   * @return comboPooledDataSource
   */
  @Bean(name = "dataSource")
  public DataSource dataSource() {
    ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource();

    try {
      comboPooledDataSource.setDriverClass(env.getRequiredProperty(PROPERTY_NAME_DATA_SOURCE));
      comboPooledDataSource.setJdbcUrl(env.getRequiredProperty(PROPERTY_NAME_URL));
      comboPooledDataSource.setUser(env.getRequiredProperty(PROPERTY_NAME_USERNAME));
      comboPooledDataSource.setPassword(env.getRequiredProperty(PROPERTY_NAME_PASSWORD));
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    } catch (IllegalStateException e) {
      e.printStackTrace();
    }

    return comboPooledDataSource;
  }
Example #20
0
 private void abrirGUICadastroEspeciePagamento(EspeciePagamento especiepagamento) {
   if ((guiCadastroEspeciePagamento == null) || (!guiCadastroEspeciePagamento.isVisible())) {
     guiCadastroEspeciePagamento = new GUICadastroEspeciePagamento();
     OuvinteEspeciePagamento ouvinte = new OuvinteEspeciePagamento(guiCadastroEspeciePagamento);
     this.getParent().add(guiCadastroEspeciePagamento);
     guiCadastroEspeciePagamento.setPosicao();
     guiCadastroEspeciePagamento.setVisible(true);
     guiCadastroEspeciePagamento.setEspeciePagamento(especiepagamento);
   }
   try {
     guiCadastroEspeciePagamento.setSelected(true);
   } catch (PropertyVetoException exc) {
     StringBuffer mensagem = new StringBuffer();
     mensagem.append("Não foi possível selecionar a janela de cadastro de especie pagamento!");
     mensagem.append("\nMotivo: " + exc.getMessage());
     GUIMensagem.exibirMensagem(mensagem.toString(), "DukeClube - Cadastro desócio", true);
   }
 }
Example #21
0
 /**
  * Shows the correct database table, specified by the parameter (0 or 1).
  *
  * @param database a byte value indicating which database table to show
  */
 public void showTable(byte database) {
   if (database == (byte) 0) {
     JInternalFrame i = (JInternalFrame) childFrame();
     desktop.add(i);
     try {
       i.setSelected(true);
     } catch (PropertyVetoException e1) {
       e1.printStackTrace();
     }
   } else {
     JInternalFrame i = (JInternalFrame) employeeFrame();
     desktop.add(i);
     try {
       i.setSelected(true);
     } catch (PropertyVetoException e1) {
       e1.printStackTrace();
     }
   }
 }
Example #22
0
 private void showMonomeDisplay() {
   if (monomeDisplayFrame == null || monomeDisplayFrame.isClosed()) {
     MonomeConfiguration monomeConfiguration =
         MonomeConfigurationFactory.getMonomeConfiguration(index);
     monomeDisplayFrame =
         new MonomeDisplayFrame(monomeConfiguration.sizeX, monomeConfiguration.sizeY);
     MainGUI.getDesktopPane().add(monomeDisplayFrame);
     try {
       monomeDisplayFrame.setSelected(true);
     } catch (PropertyVetoException e) {
       e.printStackTrace();
     }
   } else {
     try {
       monomeDisplayFrame.setSelected(true);
     } catch (PropertyVetoException e) {
       e.printStackTrace();
     }
   }
 }
  // This function returns the timestamp of the advisor to determine whether the link on
  // the mail of the advisor is valid or not
  public Timestamp getAdvisorTimestamp(String advisorId) {

    logger.info("Entered getAdvisorTimestamp method of ForgotPasswordDAO");

    PreparedStatement pstmt;
    ResultSet results = null;
    Timestamp time = null;
    Boolean exist = false;
    try {
      conn = ConnectionFactory.getConnection();
      conn.setAutoCommit(false);
      String query = "SELECT * FROM forgotpassword_admin WHERE ADVISOR_ID = ?";
      pstmt = conn.prepareStatement(query);
      pstmt.setString(1, advisorId);
      results = pstmt.executeQuery();
      exist = results.next();
      if (exist) {
        time = results.getTimestamp("TIME");
      }
      logger.info("Entered getAdvisorTimestamp method of ForgotPasswordDAO");
    } catch (SQLException e) {
      logger.error("getAdvisorTimestamp method of ForgotPasswordDAO threw error:" + e.getMessage());
      e.printStackTrace();
    } catch (IOException e) {
      logger.error("getAdvisorTimestamp method of ForgotPasswordDAO threw error:" + e.getMessage());
      e.printStackTrace();
    } catch (PropertyVetoException e) {
      logger.error("getAdvisorTimestamp method of ForgotPasswordDAO threw error:" + e.getMessage());
      e.printStackTrace();
    } finally {
      try {
        conn.close();
      } catch (SQLException e) {
        logger.error(
            "getAdvisorTimestamp method of ForgotPasswordDAO threw error:" + e.getMessage());
        e.printStackTrace();
      }
    }
    logger.info("Exit checkLinkValid method of ForgotPasswordDAO");
    return time;
  }
Example #24
0
  private void showPageChangeConfiguration() {
    if (pccFrame != null && pccFrame.isShowing()) {
      try {
        pccFrame.setSelected(true);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
      return;
    }

    pccFrame =
        new PageChangeConfigurationFrame(MonomeConfigurationFactory.getMonomeConfiguration(index));
    pccFrame.setSize(new Dimension(212, 370));
    pccFrame.setVisible(true);
    Main.main.mainFrame.add(pccFrame);
    try {
      pccFrame.setSelected(true);
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    }
  }
Example #25
0
  private void showMonomeSetup() {
    if (monomeSetupFrame != null && monomeSetupFrame.isShowing()) {
      try {
        monomeSetupFrame.setSelected(true);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
      return;
    }

    monomeSetupFrame =
        new MonomeSetupFrame(MonomeConfigurationFactory.getMonomeConfiguration(index));
    monomeSetupFrame.setSize(new Dimension(148, 207));
    monomeSetupFrame.setVisible(true);
    Main.main.mainFrame.add(monomeSetupFrame);
    try {
      monomeSetupFrame.setSelected(true);
    } catch (PropertyVetoException e) {
      e.printStackTrace();
    }
  }
Example #26
0
  public JInternalFrame employeeFrame() {
    JInternalFrame f = new JInternalFrame();

    f =
        new JInternalFrame(
            "Employee Database",
            false, // Resizable
            true, // Closable
            true, // Maximizable
            true); // Iconifiable
    f.setLayout(new BorderLayout());

    JScrollPane sp = new JScrollPane(employeeTable());
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sp.setBorder(BorderFactory.createTitledBorder("Employees"));

    f.add(buttonPanel(false), BorderLayout.NORTH);
    f.add(sp);

    //		f.setLocation(loc);
    f.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
    f.setFrameIcon(images.loadImage("Images/menubar/database_icon.png"));
    f.addInternalFrameListener(this);

    if (osp.isLowResolution()) f.setSize(550, 282);
    else if (osp.isMidResolution()) f.setSize(550, 282);
    else f.setSize(850, 500); // Width, Height
    f.setVisible(true);

    try {
      f.setSelected(true);
    } catch (PropertyVetoException e1) {
      e1.printStackTrace();
    }

    return f;
  }
Example #27
0
  public void selectEntityFrame(DustEntity entity, boolean createIfMissing) {
    EntityFrame iFrm = mapEntityFrames.get(entity);

    if (null == iFrm) {
      if (createIfMissing) {
        iFrm = new EntityFrame(entity);

        mapEntityFrames.put(entity, iFrm);
        desktop.add(iFrm);
      }
    }

    if (null != iFrm) {
      iFrm.show();
      iFrm.toFront();
      try {
        iFrm.setSelected(true);
      } catch (PropertyVetoException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
  public void setSelectedTaskJarToSig() {
    String strMethod = "setSelectedTaskJarToSig()";

    IFAbs ifeTarget = null;

    for (int i = 0; i < super.getComponentCount(); i++) {
      Object objCur = super.getComponent(i);

      if (!(objCur instanceof IFAbs)) continue;

      IFAbs ifeCur = (IFAbs) objCur;

      if (ifeCur instanceof IFKstOpenJarVerif) {
        ifeTarget = ifeCur;
        continue;
      }

      if (ifeCur.isVisible()) ifeCur.setVisible(false);
    }

    if (ifeTarget == null) // !! BUG
    return;

    if (ifeTarget.isIcon()) {
      try {
        ifeTarget.setIcon(false);
      } catch (PropertyVetoException ex) {
        ex.printStackTrace();
        MySystem.s_printOutExit(this, strMethod, ex.getMessage() + "\n exiting");
      }
    }

    if (!ifeTarget.isVisible()) ifeTarget.setVisible(true);

    ifeTarget.toFront();
  }
  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jPanel52 = new javax.swing.JPanel();
    jButton152 = new javax.swing.JButton();
    jButton202 = new javax.swing.JButton();
    jButton252 = new javax.swing.JButton();
    jSeparator71 = new javax.swing.JSeparator();
    jButton301 = new javax.swing.JButton();
    jLabel4 = new javax.swing.JLabel();
    jPanel21 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new com.afrisoftech.dbadmin.JTable();
    jButton5 = new javax.swing.JButton();

    getContentPane().setLayout(new java.awt.GridBagLayout());

    setClosable(true);
    setIconifiable(true);
    setMaximizable(true);
    setResizable(true);
    setTitle("Allocate Allowances & Benefits ");
    setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
    setFont(new java.awt.Font("SansSerif", 0, 10));
    setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/ColorPreview.gif")));
    try {
      setSelected(true);
    } catch (java.beans.PropertyVetoException e1) {
      e1.printStackTrace();
    }
    setVisible(true);
    jPanel52.setLayout(new java.awt.GridBagLayout());

    /*int intCheck = 0;

    try {

        java.sql.Statement stmtCheck = connectDB.createStatement();

        java.sql.ResultSet rsetCheck = stmtCheck.executeQuery("SELECT COUNT(*) FROM company_profile");

        while (rsetCheck.next()) {

            intCheck = rsetCheck.getInt(1);

        }

    } catch(java.sql.SQLException sqlExec) {

        javax.swing.JOptionPane.showMessageDialog(this, sqlExec.getMessage());

    }

    if (intCheck > 0) {

        jTextField2.setEditable(false);

        java.awt.Toolkit.getDefaultToolkit().beep();

        javax.swing.JOptionPane.showMessageDialog(this, "MESSAGE : Company already set up!. Contact System Administrator");

    }
    */

    jButton152.setIcon(new javax.swing.ImageIcon(getClass().getResource("/note[1].gif")));
    jButton152.setMnemonic('E');
    jButton152.setText("Edit");
    jButton152.setToolTipText("Click here to edit data");
    jButton152.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton152ActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel52.add(jButton152, gridBagConstraints);

    jButton202.setIcon(new javax.swing.ImageIcon(getClass().getResource("/minusarm.gif")));
    jButton202.setMnemonic('r');
    jButton202.setText("Refresh");
    jButton202.setToolTipText("Click here to clear fields");
    jButton202.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton202ActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel52.add(jButton202, gridBagConstraints);

    jButton252.setIcon(new javax.swing.ImageIcon(getClass().getResource("/BD14753_.GIF")));
    jButton252.setMnemonic('c');
    jButton252.setText("Close");
    jButton252.setToolTipText("Click here to close window");
    jButton252.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton252ActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel52.add(jButton252, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.gridwidth = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    jPanel52.add(jSeparator71, gridBagConstraints);

    jButton301.setIcon(new javax.swing.ImageIcon(getClass().getResource("/check.gif")));
    jButton301.setMnemonic('O');
    jButton301.setText("Ok");
    jButton301.setToolTipText("Click here to enter data");
    jButton301.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton301ActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel52.add(jButton301, gridBagConstraints);

    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.gridwidth = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    jPanel52.add(jLabel4, gridBagConstraints);

    jPanel21.setLayout(new java.awt.GridBagLayout());

    jPanel21.setBorder(
        javax.swing.BorderFactory.createTitledBorder("Enter Benefits Allocated Here"));
    jTable1.setModel(
        new javax.swing.table.DefaultTableModel(
            new Object[][] {
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null},
              {null, null, null, null, null}
            },
            new String[] {"Staff No", "Grade", "Allowance Type", "Previous Amt", "New Amount"}) {
          Class[] types =
              new Class[] {
                java.lang.Object.class,
                java.lang.Object.class,
                java.lang.Object.class,
                java.lang.Double.class,
                java.lang.Double.class
              };
          boolean[] canEdit = new boolean[] {true, true, true, false, true};

          public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
          }

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
          }
        });

    jTable1.setModel(
        com.afrisoftech.dbadmin.TableModel.createTableVectors(
            connectDB,
            "select staff_no,grade,description,amount,null as new_amount from allowances_benefits order by staff_no"));
    jScrollPane1.setViewportView(jTable1);

    jScrollPane1.setViewportView(jTable1);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel21.add(jScrollPane1, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 5;
    gridBagConstraints.gridheight = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 10.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 10);
    jPanel52.add(jPanel21, gridBagConstraints);

    jButton5.setMnemonic('R');
    jButton5.setText("RemoveRow");
    jButton5.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton5ActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.weightx = 1.0;
    jPanel52.add(jButton5, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    getContentPane().add(jPanel52, gridBagConstraints);

    setBounds(0, 0, 750, 449);
  } // </editor-fold>//GEN-END:initComponents
Example #30
0
  public static void init(
      JInternalFrame comp, Thing thing, Container parent, ActionContext actionContext) {
    JComponentCreator.init(comp, thing, parent, actionContext);

    String title = JavaCreator.createText(thing, "title", actionContext);
    if (title != null) {
      comp.setTitle(title);
    }

    Boolean closable = JavaCreator.createBoolean(thing, "closable");
    if (closable != null) {
      comp.setClosable(closable);
    }

    Boolean closed = JavaCreator.createBoolean(thing, "closed");
    if (closed != null) {
      try {
        comp.setClosed(closed);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Cursor cursor = AwtCreator.createCursor(thing, "cursor", actionContext);
    if (cursor != null) {
      comp.setCursor(cursor);
    }

    Integer defaultCloseOperation = null;
    String d = thing.getString("defaultCloseOperation");
    if ("DO_NOTHING_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.DO_NOTHING_ON_CLOSE;
    } else if ("HIDE_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.HIDE_ON_CLOSE;
    } else if ("DISPOSE_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.DISPOSE_ON_CLOSE;
    }
    if (defaultCloseOperation != null) {
      comp.setDefaultCloseOperation(defaultCloseOperation);
    }

    Boolean focusCycleRoot = JavaCreator.createBoolean(thing, "focusCycleRoot");
    if (focusCycleRoot != null) {
      comp.setFocusCycleRoot(focusCycleRoot);
    }

    Icon frameIcon = SwingCreator.createIcon(thing, "frameIcon", actionContext);
    if (frameIcon != null) {
      comp.setFrameIcon(frameIcon);
    }

    Boolean setIcon = JavaCreator.createBoolean(thing, "setIcon");
    if (setIcon != null) {
      try {
        comp.setIcon(setIcon);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Boolean iconifiable = JavaCreator.createBoolean(thing, "iconifiable");
    if (iconifiable != null) {
      comp.setIconifiable(iconifiable);
    }

    Integer layer = JavaCreator.createInteger(thing, "layer");
    if (layer != null) {
      comp.setLayer(layer);
    }

    Boolean maximizable = JavaCreator.createBoolean(thing, "maximizable");
    if (maximizable != null) {
      comp.setMaximizable(maximizable);
    }

    Boolean maximum = JavaCreator.createBoolean(thing, "maximum");
    if (maximum != null) {
      try {
        comp.setMaximum(maximum);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Boolean resizable = JavaCreator.createBoolean(thing, "resizable");
    if (resizable != null) {
      comp.setResizable(resizable);
    }

    Boolean selected = JavaCreator.createBoolean(thing, "selected");
    if (selected != null) {
      try {
        comp.setSelected(selected);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }
  }