Examples of PlainDocument


Examples of javax.swing.text.PlainDocument

    public void setModel(CourseModel m) {
        CourseModel oldModel = orgModel.getCourseModel();
        if (oldModel != null) {
            oldModel.removePropertyChangeListener(this);
            quizItemsPerRoundField.setDocument(new PlainDocument());
            quizExcludeFirstField.setDocument(new PlainDocument());
            quizExcludeLastField.setDocument(new PlainDocument());
        }
        orgModel.setCourseModel(m);
        if (m != null) {
            quizItemsPerRoundField.setDocument(m.getQuizItemsPerRoundDocument());
            quizExcludeFirstField.setDocument(m.getQuizExcludeFirstDocument());
View Full Code Here

Examples of javax.swing.text.PlainDocument

    chooser=null;
    getContentPane().setLayout(new BorderLayout());
    JScrollPane scroller = new JScrollPane();
    JViewport port = scroller.getViewport();
   
    doc=new PlainDocument();
    createTextArea();
    port.add(ui);
   
    undoHandler = new UndoHandler(new UndoManager());
    doc.addUndoableEditListener(undoHandler);
View Full Code Here

Examples of javax.swing.text.PlainDocument

    public void setRecentURLsModel(RecentURLsModel recentURLsModel) {
        this.recentURLsModel = recentURLsModel;
    }

    protected Document createDefaultModel() {
        return new PlainDocument() {
            public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
                final String text = this.getText(0, offs) + str;
                List oldSuggestions = suggestions;
                suggestions = recentURLsModel.getURLsStartingWith(text);
                String appendString = "";
View Full Code Here

Examples of javax.swing.text.PlainDocument

    public void guiTestDocumentSwap() throws Exception {
        final JTextField textField = new JTextField();
        final AbstractDocument documentA = (AbstractDocument) textField.getDocument();
        documentA.insertString(0, "documentA", null);
        final AbstractDocument documentB = new PlainDocument();
        documentB.insertString(0, "documentB", null);

        final int originalDocumentAListenerCount = documentA.getDocumentListeners().length;
        final int originalDocumentBListenerCount = documentB.getDocumentListeners().length;

        // using the textField in a TextComponentMatcherEditor will install a DocumentListener
        TextComponentMatcherEditor<String> textMatcherEditor = new TextComponentMatcherEditor<String>(textField, GlazedLists.toStringTextFilterator(), true);
        assertEquals(originalDocumentAListenerCount+1, documentA.getDocumentListeners().length);
        assertEquals(originalDocumentBListenerCount, documentB.getDocumentListeners().length);
        TextMatcher textMatcher = (TextMatcher) textMatcherEditor.getMatcher();
        assertEquals("documentA", textMatcher.getSearchTerms()[0].getText());

        // replace DocumentA with DocumentB, which should update the filter with the text from DocumentB
        textField.setDocument(documentB);
        assertEquals(0, documentA.getDocumentListeners().length);
        assertEquals(originalDocumentBListenerCount+3, documentB.getDocumentListeners().length);
        textMatcher = (TextMatcher) textMatcherEditor.getMatcher();
        assertEquals("documentB", textMatcher.getSearchTerms()[0].getText());

        // changing the text in DocumentB should alter the filter
        documentB.replace(0, documentB.getLength(), "blah", null);
        textMatcher = (TextMatcher) textMatcherEditor.getMatcher();
        assertEquals("blah", textMatcher.getSearchTerms()[0].getText());
    }
View Full Code Here

Examples of javax.swing.text.PlainDocument

            new Thread() {
                public void run() {
                    char [] buffer = new char[4096];

                    try {
                        Document  doc = new PlainDocument();

                        ParsedURL purl = new ParsedURL(svgDocument.getURL());
                        InputStream is
                            = u.openStream(getInputHandler(purl).
                                           getHandledMimeTypes());
                        // u.openStream(MimeTypeConstants.MIME_TYPES_SVG);

                        Reader in = XMLUtilities.createXMLDocumentReader(is);
                        int len;
                        while ((len=in.read(buffer, 0, buffer.length)) != -1) {
                            doc.insertString(doc.getLength(),
                                             new String(buffer, 0, len), null);
                        }

                        ta.setDocument(doc);
                        ta.setEditable(false);
View Full Code Here

Examples of javax.swing.text.PlainDocument

            new Thread() {
                public void run() {
                    char [] buffer = new char[4096];

                    try {
                        Document  doc = new PlainDocument();

                        ParsedURL purl = new ParsedURL(svgDocument.getURL());
                        InputStream is
                            = u.openStream(getInputHandler(purl).
                                           getHandledMimeTypes());
                        // u.openStream(MimeTypeConstants.MIME_TYPES_SVG);

                        Reader in = XMLUtilities.createXMLDocumentReader(is);
                        int len;
                        while ((len=in.read(buffer, 0, buffer.length)) != -1) {
                            doc.insertString(doc.getLength(),
                                             new String(buffer, 0, len), null);
                        }

                        ta.setDocument(doc);
                        ta.setEditable(false);
View Full Code Here

Examples of javax.swing.text.PlainDocument

   * @param h the test harness to use
   */
  private void testIllegalDocumentLocation(TestHarness h)
  {
    h.checkPoint("illegalDocumentLocation");
    PlainDocument doc = new PlainDocument();
    AbstractDocument.LeafElement l = doc.new LeafElement(null, null, 10, 20);
    h.check(doc.getLength(), 0);
    h.check(l.getStartOffset(), 10);
  }
View Full Code Here

Examples of javax.swing.text.PlainDocument

  private void testContentChange(TestHarness h)
  {
    h.checkPoint("contentChange");
    try
      {
        PlainDocument doc = new PlainDocument();
        doc.insertString(0, "hallo", null);
        AbstractDocument.LeafElement l = doc.new LeafElement(null, null, 20, 5);
        h.check(l.getStartOffset(), 20);
        doc.insertString(0, "hiyo", null);
        h.check(l.getStartOffset(), 24);
      }
    catch (BadLocationException ex)
      {
        h.fail("BadLocationException");
View Full Code Here

Examples of javax.swing.text.PlainDocument

        }
    }

    public void testSetParent_View() {
        // Regression test for HARMONY-1767
        PlainDocument doc = new PlainDocument();
        Element e = doc.getDefaultRootElement();
        ComponentView obj = new ComponentView(new TestElement());
        obj.setParent(new PlainView(e));
   
View Full Code Here

Examples of javax.swing.text.PlainDocument

            new Thread() {
                public void run() {
                    char [] buffer = new char[4096];

                    try {
                        Document  doc = new PlainDocument();

                        InputStream is
                            = u.openStream(MimeTypeConstants.MIME_TYPES_SVG);

                        Reader in = XMLUtilities.createXMLDocumentReader(is);
                        int len;
                        while ((len=in.read(buffer, 0, buffer.length)) != -1) {
                            doc.insertString(doc.getLength(),
                                             new String(buffer, 0, len), null);
                        }

                        ta.setDocument(doc);
                        ta.setEditable(false);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.