Package net.helipilot50.stocktrade.displayproject.controls

Examples of net.helipilot50.stocktrade.displayproject.controls.ArrayField


      if (WidgetState.getWorstState(focusOwner) == Constants.FS_UPDATE) {
        // TF:7/4/08: If the component which has focus is currently a table cell editor then
        // we need to ensure that the value has been committed to the underlying model. Otherwise accelerators
        // will still have the wrong value since we haven't processed the focus loss event.
        if (focusOwner instanceof JTextComponent) {
          ArrayField table = ArrayFieldCellHelper.getArrayField(focusOwner);
          if (table != null) {
            if (ArrayFieldCellHelper.getArrayEditorComponent(table) == focusOwner) {
              // TF:08/06/2008:LIB-17:If this is a formatted field, we must use the getValue method,
              // otherwise we will potentially have formatting errors on masked fields.
              if (focusOwner instanceof JFormattedTextField) {
                JFormattedTextField formattedField = (JFormattedTextField)focusOwner;
                try {
                  formattedField.commitEdit();
                  //GK/DK: convert column index to a model index to set value
                  table.setValueAt(formattedField.getValue(), table.getEditingRow(), table.getEditingColumn());
                }
                catch (ParseException e) {
                  _log.error("Unhandled parse exception committing field edit: ", e);
                }
              }
              else if (focusOwner instanceof JPasswordField) {
                table.setValueAt(new String(((JPasswordField)focusOwner).getPassword()), table.getEditingRow(), table.getEditingColumn());
              }
              else {
                table.setValueAt(((JTextComponent)focusOwner).getText(), table.getEditingRow(), table.getEditingColumn());
              }
            }
          }
        }
        if (focusOwner instanceof DataField) {
View Full Code Here


      while (comp != null) {

        /*
         * ArrayField
         */
        ArrayField af = ArrayFieldCellHelper.getArrayField(comp);
        if (af != null) {
          s.push(new ArrayFieldFocus(af));
        }
        /*
         * TabFolder
 
View Full Code Here

            this._component.setSize(width, this._component.getHeight());
            this._component.setMinimumSize(new Dimension(width, minSize.height));
            this._component.setPreferredSize(new Dimension(width, minSize.height));

            // CraigM:16/06/2008 - Update the column model if we are in an array field
            ArrayField af = ArrayFieldCellHelper.getArrayField(this._component);

            if (af != null) {
              int col = ArrayFieldCellHelper.getArrayFieldColumn(this._component);
              ArrayColumn tc = (ArrayColumn)af.getColumnModel().getColumn(col);
              tc.setWidth(width);
              tc.setMinWidth(width);
              tc.setPreferredWidth(width);
              tc.setAssignedWidth(width);
            }
View Full Code Here

            processComponent(c, state);
          }
        }
        else if (comp instanceof ArrayField) {
          // TF:13/10/2009:Get our columns and process them as well
          ArrayField af = (ArrayField)comp;
          ArrayColumnModel model = (ArrayColumnModel)af.getColumnModel();
          for (int i = 0; i < model.getRealColumnCount(); i++) {
            ArrayColumn column = model.getRealColumn(i);
            Component childComp = column.getComponent();
            if (childComp != null) {
              // TF:29/10/2009:DET-123:Changed this to use processComponent to take into account the state of the child component.
View Full Code Here

            }
        }
       
        // CraigM:19/06/2008 - If we are disabling or enabling the component in an array field, we also need to enable/disable the array column
        if (ArrayFieldCellHelper.getArrayField(comp) != null) {
          ArrayField af = ArrayFieldCellHelper.getArrayField(comp);
          int col = ArrayFieldCellHelper.getArrayFieldColumn(comp);

          // CraigM:18/10/2008 - Don't switch the array column if we are modifying components inside a grid field in the array field
          if (ArrayFieldCellHelper.isInGridFieldInArrayField(comp) == false) {
            // TF:13/10/2009:Corrected this to set our column state also based on the state of the array field.
            int worstState = getWorstState(af, state);
            boolean isEditable = (worstState == Constants.FS_UPDATE || worstState == Constants.FS_VIEWONLY || worstState == Constants.FS_SELECTONLY);
            // CraigM:22/08/2008 - Fixed to use real column
            ((ArrayColumn)((ArrayColumnModel)af.getColumnModel()).getRealColumn(col)).setEditable(isEditable);
          }
        }
    }
View Full Code Here

        Parent action = (Parent) ActionMgr.getAction(comp, Parent.class);
        if (action != null)
            return (JComponent) action.parent;
        else {
            Container p;
            ArrayField af = ArrayFieldCellHelper.getArrayField(comp);
           
            // If the component is contained in an ArrayField, then the ArrayField is the parent.  CraigM: 27/03/2008.
            // TF:27/10/2008:Changed this logic to return the array field as the parent only if there is no real
            // parent, to cater for grids within array fields.
            p = comp.getParent();
View Full Code Here

            }
          }
        }
        if (comp instanceof JComponent) {
          JComponent jcomp = (JComponent)comp;
            ArrayField af = ArrayFieldCellHelper.getArrayField(jcomp);
            if (af != null) {
              // CraigM:02/07/2008 - Clean up of code to use helper class
              int col = ArrayFieldCellHelper.getArrayFieldColumn(jcomp);
                ((ArrayColumnModel)af.getColumnModel()).show(col, value);
            }

            if (comp instanceof JTabbedPane) {
                /*
                 * JTabbedPane first three kids are the tab controls and the scroll buttons
View Full Code Here

     * @param name name of the field
     * @param rowHeight height of the rows in pixels
     * @param headerFontStyle the font style of the column header e.g. Font.PLAIN
     */
    public static ArrayField newArrayField(String name, int rowHeight, int headerFontStyle){
        ArrayField jt = new ArrayField(name, rowHeight, headerFontStyle);

        return jt;
    }
View Full Code Here

        if (action != null) {
            value = ((TableRow)action).getRow();
        } else if (comp instanceof ArrayField
            && !SwingUtilities.isEventDispatchThread()) { // DK:31/12/2008:use getRowForEvents() only if we currently not in EDT thread

            ArrayField table = (ArrayField)comp;
            //value = table.getSelectedRow() + 1;
            // TF: 30/9/07: We need to wait for the EDT to become idle... See the comments associated with this method and ArrayField if you don't know why...
            UIutils.waitForEDTToBeIdle();

            // TF:11/10/07:Created a new method to return the real current row at the point in time this code is executing.
            //value = table.getCurrentRow() + 1; // CraigM 24/08/2007
            value = table.getRowForEvents() + 1;

        } else {
            value = comp.getSelectedRow() + 1;
        }
        return value;
View Full Code Here

        }
        Component rootComponent = SwingUtilities.getRoot(component);
       
        // If we are in an ArrayField, then we need to go from there
        if (rootComponent == null) {
          ArrayField af = ArrayFieldCellHelper.getArrayField(component);
          if (af != null) {
            rootComponent = SwingUtilities.getRoot(af);
          }
        }

        // If our frame is not visible, then we can't set the focus yet.  We just flag our form
        // to set the focus once it becomes visible.  CraigM: 26/02/2008.
        if (rootComponent instanceof JFrame && ((JFrame)rootComponent).isVisible() == false) {
          JPanel form = UIutils.getForm((JFrame)rootComponent);

          if (form != null) {
            form.putClientProperty(QQ_INITIAL_FOCUS_COMPONENT, component);
            form.putClientProperty(QQ_INITIAL_FOCUS_ROW, row);
            return;
          }
        }
       
        // TF:10/7/07: Added in the application traversal type for the Forte-style focus manager
        // Since this pending action only ever occurs as the result of the application requesting
        // the focus to change, we set a flag to indicate that this is the case.
        ForteKeyboardFocusManager.setApplicationTraversal();
       
        // TF:11/03/2009:DET-82:In forte, you could try to focus on an array field, and either provide a row
        // in which case the focus would go to the first row or the row'th row if specified.
        if (component instanceof JComponent) {
            ArrayField af;
            if (component instanceof ArrayField) {
              af = (ArrayField)component;
              // Now set the component to the first visible column on the designated row
              component = ArrayFieldCellHelper.getArrayEditorComponent(af, row, 0);
              if (component == null) {
                // We cannot find the first visible component, do nothing
                return;
              }
            }
            else {
              af = ArrayFieldCellHelper.getArrayField(component);
            }
            if (af != null) {
                int col = ArrayFieldCellHelper.getArrayFieldColumn((JComponent)component);
                //PM:23/11/07 correct for invisible columns
                ArrayColumn ac = (ArrayColumn)((ArrayColumnModel)af.getColumnModel()).getRealColumn(col);
                col = ((ArrayColumnModel)af.getColumnModel()).getColumnIndex(ac.getIdentifier());

                // If an explicit focus request occurs on an empty array field that allows append, then create
                // a new row (that's what Forte did).  CraigM 16/10/2007.
                if (af.getRowCount() == 0 && af.isAllowsAppend()) {
                    af.appendRow(col);
                }
                else if (row >= af.getRowCount()) {
                  // TF:11/03/2009:A request has been made to focus to a non-existant row, do nothing
                  return;
                }

                // CraigM:01/05/2008 - Let all other swing event happen before requesting the focus in here
                final ArrayField afFinal = af;
                final int colFinal = col;
               
                // CraigM:25/06/2008 - Switched from SwingUtilities.invokeLater
                UIutils.invokeOnGuiThread(new Runnable() {
                  public void run() {
                    // CraigM:09/07/2008 - Now ArrayField has been fixed, we can just change the selection
                    afFinal.changeSelection(row, colFinal, false, false);
                  }
                });
            } else {
                // TF:27/11/07:(Credit to java almanac...) If we can't set the focus in the window, it's possibly
                // because we're not focusable, such as a grid field. In this case we want to set the focus to our
View Full Code Here

TOP

Related Classes of net.helipilot50.stocktrade.displayproject.controls.ArrayField

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.