Package net.helipilot50.stocktrade.framework

Examples of net.helipilot50.stocktrade.framework.ParameterHolder


    }
    parameters.set(parameterIndex, new SQLXMLParameter(parameterIndex, xmlObject));   
  }

  public boolean isWrapperFor(final Class<?> iface) throws SQLException {
    final ParameterHolder isWrapperHolder = new ParameterHolder();
    useRealStatement(new StatementWorker() {
      public void doWork(PreparedStatement arg0) throws SQLException {
        isWrapperHolder.setBoolean(arg0.isWrapperFor(iface));
      }
    });
    return isWrapperHolder.getBoolean();
  }
View Full Code Here


    return isWrapperHolder.getBoolean();
  }

  @SuppressWarnings("unchecked")
  public <T> T unwrap(final Class<T> iface) throws SQLException {
    final ParameterHolder THolder = new ParameterHolder();
    useRealStatement(new StatementWorker() {
      public void doWork(PreparedStatement arg0) throws SQLException {
        THolder.setObject(arg0.unwrap(iface));
      }
    });
    return (T)THolder.getObject();
  }
View Full Code Here

        Hashtable<String, Object> params = pParams;
        if (params == null) {
            params = new Hashtable<String, Object>();
        }
        params.put("child", new ParameterHolder(pChild));

        // TF:27/9/07:Revamped this logic as our renderers are now in panels.
        ArrayField owningArray = ArrayFieldCellHelper.getArrayField(pChild);
        int row = 0;
        int column = 0;
        // Extract the X and Y co-ordinate from the event which may be in array coordinates
        ParameterHolder pX = (ParameterHolder)params.get("x");
        ParameterHolder pY = (ParameterHolder)params.get("y");

        /*
         * There are 2 cases when considering children events of array fields:
         * 1) The component cell renderer/editor is attached to the array field as a child. This is typically when the
         *     editor is active. In this case the click we get is in the coordinate space of the child, but the row
         *     and column are not set properly. We can map the coordinate space of the child to the coordinate space
         *     of the array and then determine the row and column from there.
         *
         * 2) The component cell renderer/editor is not attached to the array field. In this case, the component will
         *     have a client property set which refers to the array and the location is in the coordinate space of the
         *     array. We can use this to determine the row and column and then map the coordinate down to the
         *     coordinate space of the child.
         */
        while (mum != null){
            if (mum == owningArray) {
                if (pX != null && pY != null) {
                    // We are a direct child of the table, remap the coordinate space to the array to get the row and column
                    Point p = new Point(UIutils.milsToPixels(pX.getInt()), UIutils.milsToPixels(pY.getInt()));
                    Point arrayPoint = SwingUtilities.convertPoint(pChild, p, mum);
                    row = owningArray.rowAtPoint(arrayPoint);
                    column = owningArray.columnAtPoint(arrayPoint);
                    // Store the real row and column in the array. This isn't actually done in Forte, but makes life
                    // much easier if we want to determine which cell generated the click.
                    params.put( "row", new ParameterHolder(row+1) );
                    params.put( "column", new ParameterHolder(column+1) );
                }
                owningArray = null;
            }
            pList.add(new EventHandle(mum, pEventName, params));
            // TF:18/06/2008:Fixed this so menus work properly
            if (mum instanceof JPopupMenu)
                mum = (Container)((JPopupMenu)mum).getInvoker();
            else
                mum = mum.getParent();
        }

        if (owningArray != null) {
            // Now the X and Y coordinates are in the array space, we need to translate them to the child coordinate space and get
            // the correct row and column
            if (pX != null && pY != null) {
                Point p = new Point(UIutils.milsToPixels(pX.getInt()), UIutils.milsToPixels(pY.getInt()));
                row = owningArray.rowAtPoint(p);
                column = owningArray.columnAtPoint(p);
                // Store the real row and column in the array. This isn't actually done in Forte, but makes life
                // much easier if we want to determine which cell generated the click.
                params.put( "row", new ParameterHolder(row+1) );
                params.put( "column", new ParameterHolder(column+1) );

                Rectangle r = owningArray.getCellRect(row, column, false);
                p.x -= r.x;
                p.y -= r.y;
                // Now X and Y are in owningArray coordinate space, need to translate them into pChild's
//              Point childLoc = SwingUtilities.convertPoint(owningArray, p, pChild);
                Point childLoc = p;
                pX.setInt(UIutils.pixelsToMils(childLoc.x));
                pY.setInt(UIutils.pixelsToMils(childLoc.y));
            }
            // Go through and post this to the parent of the array also.
            mum = owningArray;
            while (mum != null){
                pList.add(new EventHandle(mum, pEventName, params));
View Full Code Here

        if (postTarget instanceof OutlineFieldJTree) {
            postTarget = ((OutlineFieldJTree)postTarget).getOutlineField();
        }
        Hashtable<String, ParameterHolder> qq_Params = new Hashtable<String, ParameterHolder>();
        if (e.getOldLeadSelectionPath() != null)
            qq_Params.put( "OldNode", new ParameterHolder(e.getOldLeadSelectionPath().getLastPathComponent()) );
        else
            qq_Params.put( "OldNode", new ParameterHolder() ); // Always have a value for "OldNode" to stop any null errors.
        if (e.getNewLeadSelectionPath() != null
            qq_Params.put( "NewNode", new ParameterHolder(e.getNewLeadSelectionPath().getLastPathComponent() ));
        else
            qq_Params.put( "NewNode", new ParameterHolder() ); // Always have a value for "OldNode" to stop any null errors.
       
        qq_Params.put( "OldRowNumber", new ParameterHolder(0) );
       
        if (e.getPath() != null)
            qq_Params.put( "NewRowNumber", new ParameterHolder(selectedRow) );
        else
            qq_Params.put( "NewRowNumber", new ParameterHolder(0) );
        ClientEventManager.postEvent( postTarget, "AfterCurrentNodeChange", qq_Params );
    }
View Full Code Here

 
          if (losingFocusField instanceof JComponent) {
              Object table = ArrayFieldCellHelper.getArrayField(losingFocusField);
 
              if (table != null && table instanceof JTable) {
                  params.put( "ArrayField", new ParameterHolder(table) );
              }
          }
          params.put("reason", new ParameterHolder(realReason));
          while (losingFocusField != null) {
            if (gainingFocusField != null && losingFocusField instanceof Container && ((Container)losingFocusField).isAncestorOf(gainingFocusField)) {
              // This component is the parent of the other component too, so it's not really losing focus. Nor are it's parents
              return;
            }
View Full Code Here

 
          if (gainingFocusField instanceof JComponent) {
              Object table = ArrayFieldCellHelper.getArrayField(gainingFocusField);
 
              if (table != null && table instanceof JTable) {
                  params.put( "ArrayField", new ParameterHolder(table) );
              }
          }
          params.put("reason", new ParameterHolder(realReason));
          while (gainingFocusField != null) {
            if (losingFocusField != null && gainingFocusField instanceof Container && ((Container)gainingFocusField).isAncestorOf(losingFocusField)) {
              // This component is the parent of the other component too, so it's not really losing focus. Nor are it's parents
              return;
            }
View Full Code Here

     */
    public static void postEvent(EventHandle handle) {
      // TF:Also ensured that all events posted via this method (ie client events) have associated
      // with them a DisplayEvent parameter. This prevents runtime errors from people who use this.
      if (handle.getParameters() != null && handle.getParameter("eventInfo") == null) {
        handle.getParameters().put("eventInfo", new ParameterHolder(new DisplayEvent()));
      }
      if (SwingUtilities.isEventDispatchThread()) {
        handle.setPriority(EventHandle.PRIORITY_EDT);
      }
      EventManager.postEvent(handle);
View Full Code Here

     * @param pTree -
     *            The tree whose root node is to be returned
     * @return the root node of the tree
     */
    public static DisplayNode getRootNode(final JTree pTree) {
        final ParameterHolder rootNode = new ParameterHolder();
        UIutils.invokeOnGuiThread(new Runnable() {
            public void run() {
                TreeModel aModel = pTree.getModel();
                if (aModel != null) {
                    rootNode.setObject(aModel.getRoot());
                }
            }
        });
        Object anObj = rootNode.getObject();
        if (anObj != null && anObj instanceof DisplayNode) {
            return (DisplayNode) anObj;
        }
        else {
            return null;
View Full Code Here

      // CraigM:25/06/2008 - If we are already on the EDT, we can't wait for it to be idle.
      if (SwingUtilities.isEventDispatchThread()) {
        return;
      }
     
        final ParameterHolder holder = new ParameterHolder();
        do {
            try {
                Thread.sleep(20);
            } catch (InterruptedException e) {}
            UIutils.invokeOnGuiThread(new Runnable() {
                public void run() {
                    AWTEvent e = Toolkit.getDefaultToolkit().getSystemEventQueue().peekEvent();
                    holder.setBoolean(e != null);
                }
            });
        } while (holder.getBoolean());

    }
View Full Code Here

   * @param pClassType
   * @return
   */
  @SuppressWarnings("unchecked")
  public <T extends JFrame> T instantiateWindow(final Class<T> pClassType) {
    final ParameterHolder ph = new ParameterHolder();
    UIutils.invokeOnGuiThread(new Runnable()  {
      public void run() {
        try {
          ph.setObject(FrameworkUtils.newInstance(pClassType));
        }
        catch (Exception e) {
          ph.setObject(e);
        }
      }
    });
    if (ph.getObject() instanceof RuntimeException) {
      throw (RuntimeException)ph.getObject();
    }
    else {
      return (T)ph.getObject();
    }
  }
View Full Code Here

TOP

Related Classes of net.helipilot50.stocktrade.framework.ParameterHolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.