List of usage examples for javax.swing SwingUtilities getRoot
@SuppressWarnings("deprecation") public static Component getRoot(Component c)
From source file:org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent.java
@Override public void update() { if (!this.numeroUniqueCommande.checkValidation()) { ExceptionHandler.handle("Impossible d'ajouter, numro de commande client existant."); Object root = SwingUtilities.getRoot(this); if (root instanceof EditFrame) { EditFrame frame = (EditFrame) root; frame.getPanel().setAlwaysVisible(true); }//from w ww. ja v a 2s .co m return; } super.update(); final int id = getSelectedID(); this.table.updateField("ID_COMMANDE", id); this.table.createArticle(id, this.getElement()); ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() { @Override public void run() { try { // On efface les anciens mouvements de stocks SQLRow row = getTable().getRow(id); SQLElement eltMvtStock = Configuration.getInstance().getDirectory() .getElement("MOUVEMENT_STOCK"); SQLSelect sel = new SQLSelect(); sel.addSelect(eltMvtStock.getTable().getField("ID")); Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), "=", row.getID()); Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName()); sel.setWhere(w.and(w2)); List l = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler()); if (l != null) { for (int i = 0; i < l.size(); i++) { Object[] tmp = (Object[]) l.get(i); eltMvtStock.archive(((Number) tmp[0]).intValue()); } } // Mise jour du stock updateStock(id); } catch (Exception e) { ExceptionHandler.handle("Update error", e); } } }); // generation du document final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(id)); sheet.createDocumentAsynchronous(); sheet.showPrintAndExportAsynchronous(this.checkVisu.isSelected(), this.checkImpression.isSelected(), true); }
From source file:org.openconcerto.erp.core.supplychain.receipt.component.BonReceptionSQLComponent.java
public int insert(SQLRow order) { int idBon = SQLRow.NONEXISTANT_ID; // on verifie qu'un bon du meme numero n'a pas t insr entre temps if (this.textNumeroUnique.checkValidation()) { idBon = super.insert(order); try {//from w w w . ja va 2s.c o m this.tableBonItem.updateField("ID_BON_RECEPTION", idBon); this.tableBonItem.createArticle(idBon, this.getElement()); // incrmentation du numro auto if (NumerotationAutoSQLElement.getNextNumero(BonReceptionSQLElement.class) .equalsIgnoreCase(this.textNumeroUnique.getText().trim())) { SQLRowValues rowVals = new SQLRowValues(this.tableNum); int val = this.tableNum.getRow(2).getInt("BON_R_START"); val++; rowVals.put("BON_R_START", new Integer(val)); rowVals.update(2); } calculPHaPondere(idBon); final int idBonFinal = idBon; ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() { @Override public void run() { try { updateStock(idBonFinal); } catch (Exception e) { ExceptionHandler.handle("Update error", e); } } }); } catch (Exception e) { throw new IllegalStateException(e); } } else { ExceptionHandler.handle("Impossible d'ajouter, numro de bon de livraison existant."); Object root = SwingUtilities.getRoot(this); if (root instanceof EditFrame) { EditFrame frame = (EditFrame) root; frame.getPanel().setAlwaysVisible(true); } } return idBon; }
From source file:org.openconcerto.erp.core.supplychain.receipt.component.BonReceptionSQLComponent.java
@Override public void update() { if (!this.textNumeroUnique.checkValidation()) { ExceptionHandler.handle("Impossible d'ajouter, numro de bon de livraison existant."); Object root = SwingUtilities.getRoot(this); if (root instanceof EditFrame) { EditFrame frame = (EditFrame) root; frame.getPanel().setAlwaysVisible(true); }//from ww w .j ava2s . co m return; } else { // Mise jour de l'lment super.update(); this.tableBonItem.updateField("ID_BON_RECEPTION", getSelectedID()); this.tableBonItem.createArticle(getSelectedID(), this.getElement()); final int id = getSelectedID(); ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() { @Override public void run() { try { // On efface les anciens mouvements de stocks SQLRow row = getTable().getRow(id); SQLElement eltMvtStock = Configuration.getInstance().getDirectory() .getElement("MOUVEMENT_STOCK"); SQLSelect sel = new SQLSelect(); sel.addSelect(eltMvtStock.getTable().getField("ID")); Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), "=", row.getID()); Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName()); sel.setWhere(w.and(w2)); List l = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler()); if (l != null) { for (int i = 0; i < l.size(); i++) { Object[] tmp = (Object[]) l.get(i); eltMvtStock.archive(((Number) tmp[0]).intValue()); } } // Mise jour du stock updateStock(id); } catch (Exception e) { ExceptionHandler.handle("Update error", e); } } }); } }
From source file:org.opendatakit.appengine.updater.UpdaterWindow.java
@EventSubscriber(eventClass = TokenRequestEvent.class) public void displayTokenInputField(TokenRequestEvent event) { TokenEntryDialog ted = new TokenEntryDialog((JFrame) SwingUtilities.getRoot(txtToken)); int retVal = ted.showDialog(); if (retVal == JFileChooser.APPROVE_OPTION) { String token = ted.getTokenValue(); txtToken.setText(token);//from w w w . j a va 2 s . co m try { event.stream.emitToken(token); } catch (IOException e) { e.printStackTrace(); } } else { abortAction(); try { event.stream.emitToken("\u0003" + System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } } }
From source file:se.trixon.jota.client.ui.TabItem.java
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed MainFrame mainFrame = (MainFrame) SwingUtilities.getRoot(this); mainFrame.showEditor(mJob.getId(), true); }
From source file:se.trixon.jota.client.ui.TabItem.java
private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed try {/*from ww w. j ava 2 s . co m*/ Job job = mManager.getServerCommander().getJob(mJob.getId()); if (job == null) { Message.error(this, Dict.ERROR.toString(), Dict.JOB_NOT_FOUND.toString()); } else { mJob = job; MainFrame mainFrame = (MainFrame) SwingUtilities.getRoot(this); mainFrame.requestStartJob(job); } } catch (RemoteException ex) { Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); } }