doc.putProperty(EndOfLineStringProperty, "\r\n"); doc.putProperty(EndOfLineStringProperty, "\r"); doc.putProperty(EndOfLineStringProperty, "\n");
RTextAreaEditorKit.EndOfLineStringProperty); if (!separator.equals(old)) { doc.putProperty(RTextAreaEditorKit.EndOfLineStringProperty, separator); if (setDirty) {
public static void setHTMLEditorKit (JEditorPane editorPane) { editorPane.getDocument().putProperty("imageCache", imageCache); // Read internally by ImageView, but never written.
doc.putProperty(Document.StreamDescriptionProperty, null);
/** * We override this method because the super version gives us an entirely * new <code>Document</code>, thus requiring us to re-attach our Undo * manager. With this version we just replace the text. */ @Override public void read(Reader in, Object desc) throws IOException { RTextAreaEditorKit kit = (RTextAreaEditorKit)getUI().getEditorKit(this); setText(null); Document doc = getDocument(); if (desc != null) { doc.putProperty(Document.StreamDescriptionProperty, desc); } try { // NOTE: Resets the "line separator" property. kit.read(in, doc, 0); } catch (BadLocationException e) { throw new IOException(e.getMessage()); } }
/** * {@inheritDoc} */ @Override public void putProperty(Object key, Object value) { delegate.putProperty(key, value); }
/** * Perform additional initialization of document by this content (set properties). * * @param doc non-null document */ public void init(Document doc) { doc.putProperty(CharSequence.class, (CharSequence)charContent); }
private static void setFoldingProperty(Document document, Map<String, List<OffsetRange>> folds) { if (document != null) { document.putProperty(LAST_CORRECT_FOLDING_PROPERTY, folds); } }
jEditorPaneXML.getDocument().putProperty( PlainDocument.tabSizeAttribute, new Integer(2));
private void onWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_onWindowClosed doc.removeDocumentListener(this); doc.putProperty(HTMLPreviewAction.HTML_PREVIEW_WINDOW, null); doc = null; }//GEN-LAST:event_onWindowClosed
public void putProperty(Object key, Object value) { if (key == DocumentFilter.class && original instanceof AbstractDocument) { ((AbstractDocument)original).setDocumentFilter((DocumentFilter)value); } else { original.putProperty(key, value); } }
/** * Set whether to allow linebrekas in the value. Otherwise linebreaks are * filtered out when editing and replaced by a space. Default is false. * * @param allow true to allow linebreaks */ public final void setAllowLinebreaks(boolean allow) { input.getDocument().putProperty("filterNewlines", !allow); }
public XmlView(Element element) { super(element); // Set tabsize to 4 (instead of the default 8) getDocument().putProperty(PlainDocument.tabSizeAttribute, 4); }
public ModRootElement(Document doc) { super(doc); docText = DocumentUtilities.getText(doc); doc.putProperty(NAME, this); }
public static String htmlToText(String html) { EditorKit kit = new HTMLEditorKit(); Document doc = kit.createDefaultDocument(); doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE); try { kit.read(new ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8)), doc, 0); return doc.getText(0, doc.getLength()); } catch (IOException | BadLocationException e) { throw new RuntimeException(e); } } }
/** Sets the correct properties of the given StyledDocument */ void setDocumentProperties(Document doc) { DataObject obj = getServlet(); if (obj != null) { //set document name property doc.putProperty(javax.swing.text.Document.TitleProperty, obj.getPrimaryFile().getPath()); //set dataobject to stream desc property doc.putProperty(javax.swing.text.Document.StreamDescriptionProperty, obj); } }
/** * Reloads the current page and jumps to the same position. This is only * used for testing purposes, because usually the pages shouldn't change * while the program is running. */ private void reload() { Document doc = textPane.getDocument(); doc.putProperty(Document.StreamDescriptionProperty, null); scrollPositionAfterLoad = scrollbar.getValue(); loadPage(currentPage); }
public void setEditorKit(StyledEditorKit editorKit) { textPane.setEditorKit(editorKit); textPane.getDocument().addDocumentListener(textPaneListener = new TextPaneListener()); // Set by default the end of line property in order to always use the Unix style textPane.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, unixEndOfLine); }
public void visit(LinkModel link) { try { // make sure to reload editorPane.getDocument().putProperty(Document.StreamDescriptionProperty, null); // JW: editorPane defaults to asynchronous loading // no need to explicitly start a thread - really? editorPane.setPage(link.getURL()); link.setVisited(true); } catch (IOException e1) { editorPane.setText("<html>Error 404: couldn't show " + link.getURL() + " </html>"); } }
private void initCodeStyle(Document doc) { InputAttributes lexerAttrs = (InputAttributes) doc.getProperty(InputAttributes.class); if (lexerAttrs == null) { lexerAttrs = new InputAttributes(); doc.putProperty(InputAttributes.class, lexerAttrs); } FortranCodeStyle codeStyle = FortranCodeStyle.get(doc); lexerAttrs.setValue(getLanguage(), CndLexerUtilities.LEXER_FILTER, CndLexerUtilities.getFortranFilter(), true); lexerAttrs.setValue(getLanguage(), CndLexerUtilities.FORTRAN_MAXIMUM_TEXT_WIDTH, codeStyle.getRrightMargin(), true); lexerAttrs.setValue(getLanguage(), CndLexerUtilities.FORTRAN_FREE_FORMAT, codeStyle.getFormatFortran(), true); }