Package net.helipilot50.stocktrade.displayproject.controls

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


     * rows is more than the passed value, the number of rows will be
     * set to the number of rows used. This method is thread-safe and may be
     * called on or off the GUI thread
     */
    public void setRows(final int pRows) {
        ActionMgr.addAction(new PendingAction(null) {
            @Override
            public String toString() {
                return GridField.this.getName() + ".setRows(" + pRows + ")";
            }
            @Override
View Full Code Here


     * columns is more than the passed value, the number of columns will be
     * set to the number of columns used. This method is thread-safe and may be
     * called on or off the GUI thread
     */
    public void setColumns(final int pColumns) {
        ActionMgr.addAction(new PendingAction(null) {
            @Override
            public String toString() {
                return GridField.this.getName() + ".setColumns(" + pColumns + ")";
            }
            @Override
View Full Code Here

        // TF:8/8/07:Made a shallow clone in case there is a really big object attached to the list element
        Array_Of_ListElement<ListElement> clonedList = CloneHelper.clone(les, false);
        Object currentValue = this.list.getValue();
        ListElement valueToReselect = null;
        if (currentValue instanceof ListElement && clonedList != null && this.list.getSelectionHolder() instanceof TypeAwareValueModel) {
          TypeAwareValueModel tavm = (TypeAwareValueModel)this.list.getSelectionHolder();
          // We need to find an item in the new list which is the same as an item in the old list,
          // depending on the type being considered. For example, if the list is mapped to an int,
          // we need to find an element in the new list with the same IntegerValue.
          Class<?> clazz = tavm.getValueType();
          ListElement currentSelection = (ListElement)currentValue;
          for (ListElement item : clonedList) {
            if (clazz.equals(Integer.TYPE) ||
                clazz.equals(Short.TYPE) ||
                NumericData.class.isAssignableFrom(clazz) ||
View Full Code Here

      }
      else if (list.getSelectionHolder() == null) {
        requiresDefault = true;
      }
      else {
        ValueModel model = list.getSelectionHolder();
        if (model instanceof TypeAwareValueModel) {
          if (DataValue.class.isAssignableFrom(((TypeAwareValueModel)model).getValueType())) {
            requiresDefault = false;
          }
          else {
            requiresDefault = true;
          }
        }
        else {
          requiresDefault = (model.getValue() == null);
        }
      }
      if (requiresDefault) {
        // TF:05/11/2008:Fixed this up so it actually sets the underlying model
        getSelectionModel().setSelectionInterval(0, 0);
View Full Code Here

            params.put("column", new ParameterHolder(outlineField.getColumnIndex(X + OutlineField.cCOLUMN_SPACING)+1));
            params.put("sizes", new ParameterHolder(outlineField.getColumnSizes()));
            params.put("spacing", new ParameterHolder(OutlineField.cCOLUMN_SPACING));
        }
        else if (pControl instanceof MultiLineTextField){
            MultiLineTextField field = (MultiLineTextField)pControl;
            try {
                int offset = field.getCaretPosition()-1;
                int lRow = field.getLineOfOffset(offset);
                int lCol = offset - field.getLineStartOffset(lRow);
                params.put("row", new ParameterHolder(lRow));
                params.put("column", new ParameterHolder(lCol));
            }
            catch (BadLocationException ble) {
                Logger.getLogger(ClickListener.class).error("Bad location for text field", ble);
View Full Code Here

    private boolean printingRemoveScrollBars;

    public TextFieldCellRenderer(JScrollPane pScrollPane) {
      // CraigM:25/07/2008 - Force any pending actions on the widget through (like colour changes), so when we clone the widget, we get the latest info
      UIutils.processGUIActions(pScrollPane);
        MultiLineTextField tf = (MultiLineTextField)pScrollPane.getViewport().getComponent(0);

        this.sp = new JScrollPane(tf.cloneComponent());
        ArrayFieldCellHelper.setUpCellRenderer(pScrollPane, this.sp); // CraigM: 28/03/2008
        this.sp.setPreferredSize(pScrollPane.getPreferredSize());
        this.sp.setMinimumSize(pScrollPane.getMinimumSize());
        this.sp.setSize(pScrollPane.getSize());
        this.sp.setHorizontalScrollBarPolicy(pScrollPane.getHorizontalScrollBarPolicy());
View Full Code Here

                this.getMultiLineTextField().setBackgroundTemporarily(SystemColor.window);
            }
        }
       
        if (this.isPrinting && this.sp.getViewport().getComponentCount() > 0) {
          MultiLineTextField tf = this.getMultiLineTextField();
        sp.setSize(tf.getPreferredSize());
        sp.setMinimumSize(tf.getPreferredSize());
        sp.setPreferredSize(tf.getPreferredSize());
       
        if (printingRemoveScrollBars) {
          sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
          sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        }
View Full Code Here

     */
    public BufferedImage getImage(int width) {
    int height = this.sp.getMinimumSize().height;
    // TF:27/11/2009:Changed this to use the passed width
//    int width = this.sp.getMinimumSize().width;
        MultiLineTextField tf = (MultiLineTextField)this.sp.getViewport().getComponent(0);

    if (this.spPainter == null) {
      MultiLineTextField newTF = TextEditFactory.newTextField("painter", tf.getRows(), tf.getColumns());
        this.spPainter = new JScrollPane(newTF);
        this.spPainter.setHorizontalScrollBarPolicy(this.sp.getHorizontalScrollBarPolicy());
        this.spPainter.setVerticalScrollBarPolicy(this.sp.getVerticalScrollBarPolicy());
        newTF.setForeground(tf.getForeground());
        newTF.setBackground(tf.getBackground());
      }
   
    return ArrayFieldCellHelper.createBufferedImage(this.spPainter, width, height);
    }
View Full Code Here

       
        // --------------------------------------------------------------------
        // Expand text fields
        // --------------------------------------------------------------------
        else if (comp instanceof MultiLineTextField) {
          MultiLineTextField tf = (MultiLineTextField)comp;
         
          if (tf.getParent() != null && tf.getParent().getParent() instanceof JScrollPane) {
            JScrollPane sp = (JScrollPane)tf.getParent().getParent();
            sp.setSize(tf.getPreferredSize());
            sp.setMinimumSize(tf.getPreferredSize());
            sp.setPreferredSize(tf.getPreferredSize());

            if (removeScrollBars) {
                    sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
                    sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
                }
          }
            Container parent = tf.getParent();

            while (parent != null) {
                if (parent instanceof JFrame) {
                    ((JFrame)parent).validate();
                    ((JFrame)parent).pack();
View Full Code Here

     */
    public void bind(JComponent control, ValueModel valueModel)
    {
        // Respect the document that already exists on the control, if any
        JTextComponent textControl = (JTextComponent)control;
        MultiLineTextField textArea = null;
        if (textControl instanceof MultiLineTextField) {
            textArea = (MultiLineTextField)textControl;
            // Text area is associated with valueModel so that the former can distinguish between
            // user entered text and model supplied text. Cursor is to be placed at the beginning of model
            // supplied text.
            textArea.setValueModel(valueModel);
            // Register the first PropertyChangeListener on valueModel BEFORE the DocumentAdapter has registered.
            textArea.registerPropertyChangeHandler();
        }
        if (textControl.getDocument() != null) {
          // TF:13/11/2009:LUM-48:Added the parameter to the TextDataToStringConverter to allow the use of identity comparisons when firing property change events
            Bindings.bind((JTextComponent) control,new TextDataToStringConverter(valueModel, textArea != null), textControl.getDocument(), false);
        }
        else {
          // TF:13/11/2009:LUM-48:Added the parameter to the TextDataToStringConverter to allow the use of identity comparisons when firing property change events
            Bindings.bind((JTextComponent) control,new TextDataToStringConverter(valueModel, textArea != null),false);
        }
        if (textArea != null) {
            // Register the second PropertyChangeListener on valueModel AFTER the DocumentAdapter has registered.
            textArea.registerCaratPositionHandler();
        }
    }
View Full Code Here

TOP

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

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.