Package net.helipilot50.stocktrade.displayproject

Examples of net.helipilot50.stocktrade.displayproject.FixedLengthDocument


        CloneHelper.cloneClientProperties(source, target);
        return target;
    }

    public static JTree cloneJTree(JTree source) {
        DisplayNode root = clone((DisplayNode) source.getModel().getRoot(), true);
        TreeViewModel dtm = new TreeViewModel(root);
        JTree target = new JTree(dtm);
        CloneHelper.cloneComponent(source, target, new String[] {"UI", // class javax.swing.plaf.TreeUI
                "UIClassID", // class java.lang.String
                "accessibleContext", // class javax.accessibility.AccessibleContext
View Full Code Here


        this.editor = new BorderedComboBoxEditor();
        this.setEditor(this.editor);
        this.setRenderer(new BorderedComboBoxRenderer());
        JTextComponent comp = (JTextComponent)this.editor.getEditorComponent();
        comp.setBackground(this.getBackground());
        comp.setDocument(new FixedLengthDocument(0));

        comp.addKeyListener(new ComboBoxKeyHandler());
    }
View Full Code Here

            }
            if (autoComplete) {
                editComponent.setDocument(new FillinManagementDocument(this, showDropdowns, listEntriesOnly, maxCharacters));
            }
            else {
                editComponent.setDocument(new FixedLengthDocument(maxCharacters));
            }
        }
    }
View Full Code Here

      this.dataFieldOriginal = pDataField;
      this.dataFieldCloned = pDataField.cloneComponentForRenderer();
      ArrayFieldCellHelper.setUpCellRenderer(this.dataFieldOriginal, this.dataFieldCloned); // CraigM: 28/03/2008
      // TF:29 Oct 2008:Set this up to handle fixed length documents
      if (this.dataFieldOriginal.getDocument() instanceof FixedLengthDocument) {
        FixedLengthDocument doc = (FixedLengthDocument)this.dataFieldOriginal.getDocument();
        this.dataFieldCloned.setDocument(new FixedLengthDocument(doc.getMaxLength()));
      }
      else {
        this.dataFieldCloned.setDocument(new PlainDocument()); // we can't reuse the document
      }
      this.dataFieldCloned.setFormatterFactory(new DataFieldFormatterFactory()); // we can't reuse the formatter
View Full Code Here

      this.passwordDataFieldCloned = pDataField.cloneComponentForRenderer();
      ArrayFieldCellHelper.setUpCellRenderer(this.passwordDataFieldOriginal, this.passwordDataFieldCloned); // CraigM: 28/03/2008
      // TF:29 Oct 2008:Set this up to handle fixed length documents
     
      if (this.passwordDataFieldOriginal.getDocument() instanceof FixedLengthDocument) {
        FixedLengthDocument doc = (FixedLengthDocument)this.passwordDataFieldOriginal.getDocument();
        this.passwordDataFieldCloned.setDocument(new FixedLengthDocument(doc.getMaxLength()));
      }
      else {
        this.passwordDataFieldCloned.setDocument(new PlainDocument()); // we can't reuse the document
      }
    this.passwordDataFieldCloned.getCaret().setVisible(false);
View Full Code Here

      // CONV:TF:21 Jul 2009:Fixed this to work properly
      if (isEditable() && isEnabled()) {
        int finalCursorPosition = 0;
        boolean didManualPaste = false;
        if (getDocument() instanceof FixedLengthDocument){
          FixedLengthDocument doc = (FixedLengthDocument)getDocument();
          Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
          try {
            if (doc.getMaxLength() > 0 && t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
              String text = (String)t.getTransferData(DataFlavor.stringFlavor);
              // CONV:TF:21 Jul 2009:Insert the text at the correct spot in the current String. The String is truncated
              // to the maximum number of characters, and the cursor is moved to the end of the selection or the
              // end of string, whichever is smaller.
              if (text.length()+doc.getLength() > doc.getMaxLength()) {
                String currentText = doc.getText(0, doc.getLength());
                int caretMark = this.getCaret().getMark();
                int caretDot = this.getCaret().getDot();
                String newText = currentText.substring(0, Math.min(caretMark, caretDot)) + text + currentText.substring(Math.max(caretMark, caretDot));
                this.setText(newText);
                finalCursorPosition = Math.min(caretDot+text.length(), doc.getMaxLength());
                didManualPaste = true;
              }
            }
          } catch (UnsupportedFlavorException e) {
          } catch (IOException e) {
View Full Code Here

     * @return
     */
    public static DataField newDataField() {
        DataField df = new DataField();
        df.setOpaque(true);
        df.setDocument(new FixedLengthDocument(0));
        df.setInputVerifier(new DataFieldVerifier());
        // Install a factory that knows about data value instances
        df.setFormatterFactory(new DataFieldFormatterFactory());
        df.setDisabledTextColor(SystemColor.windowText);
        setFont(df);
View Full Code Here

    public static DataField newDataField(String name, int columns, AbstractFormatter formatter) {
        DataField df = new DataField(formatter);
        df.setName(name);
        df.setColumns(columns);
        df.setOpaque(true);
        df.setDocument(new FixedLengthDocument(0));
        df.setInputVerifier(new DataFieldVerifier());
        df.setDisabledTextColor(SystemColor.windowText);
        setFont(df);
        return df;
    }
View Full Code Here

        target.setPreferredSize(source.isPreferredSizeSet() ? source.getPreferredSize() : null);
        target.setMinimumSize(source.isMinimumSizeSet() ? source.getMinimumSize() : null);
        target.setMaximumSize(source.isMaximumSizeSet() ? source.getMaximumSize() : null);
       
        if (source instanceof JComponent) {
          GridCell orig = GridCell.getExisting((JComponent)source);
          if (orig != null) {
            GridCell cell = GridCell.get((JComponent)target);
            cell.setWidthPolicy(orig.getWidthPolicy());
            cell.setHeightPolicy(orig.getHeightPolicy());
          }
          // TF:03/11/2008:We need to clone specific client properties too, otherwise some things won't work.
          ArrayFieldCellHelper.cloneComponentArrayParts((JComponent)source, (JComponent)target);
        }
    }
View Full Code Here

                    ((TitledBorder) border).setTitle("");
                }
            } else {
                if (pCaption != null) {
                    // TitledBorder tb = BorderFactory.createTitledBorder(border, caption.toString(), TitledBorder.LEFT, TitledBorder.TOP);
                    TitledBorder tb = new GridTitledBorder(border, caption.toString(), TitledBorder.LEFT, TitledBorder.TOP);
                    if (this.captionFont != null) {
                        tb.setTitleFont(this.captionFont);
                    }
                    setBorder(tb);
                }
            }
        } else {
          GridTitledBorder gridBorder;
            if (pCaption != null) {
              gridBorder = new GridTitledBorder(pCaption.toString());
            } else {
              gridBorder = new GridTitledBorder("");
            }
            if (this.captionFont != null) {
              gridBorder.setTitleFont(this.captionFont);
            }
            setBorder(gridBorder);
        }
    }
View Full Code Here

TOP

Related Classes of net.helipilot50.stocktrade.displayproject.FixedLengthDocument

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.