public int getLength() { return backend.getLength(); }
public int getLength() { return backend.getLength(); }
public int getLength() { return backend.getLength(); }
@Override public void insertString( int offs, String str, AttributeSet a ) throws BadLocationException { if ( str == null ) return; boolean proceed = true; if ( pattern != null ) { String tmp = super.getText( 0, offs ) + str + (super.getLength()>offs ? super.getText( offs, super.getLength()-offs ) : ""); Matcher m = pattern.matcher( tmp ); proceed = m.matches(); } if ( proceed == true ) super.insertString( offs, str, a ); }
@Override public void remove( int offs, int len ) throws BadLocationException { boolean proceed = true; if ( pattern != null ) { try { String tmp = super.getText( 0, offs ) + (super.getLength()>(offs+len) ? super.getText( offs+len, super.getLength()-(offs+len) ) : ""); Matcher m = pattern.matcher( tmp ); proceed = m.matches(); } catch ( BadLocationException e ) {} } if ( proceed == true ) super.remove( offs, len ); } }
@Override public String convert(final PlainDocument plainDocument) throws RuntimeException { try { final String text = plainDocument.getText(0, plainDocument.getLength()); final StringBuilder builder = new StringBuilder(); for (final char character : text.toCharArray()) { if (!FieldValueController.this.characterFilter.accept(character)) { continue; } builder.append(character); } return text; } catch (final BadLocationException exception) { return ""; //$NON-NLS-1$ } } };
public synchronized void setText(final String textValue) { try { if (this.isDocumentUpdateEnabled) { try { this.isDocumentListenerEnabled = false; this.document.remove(0, this.document.getLength()); } finally { this.isDocumentListenerEnabled = true; } this.document.insertString(0, textValue, null); } } catch (final BadLocationException exception) { throw new UnreachableCodeReachedException(exception); } }
public static void setTextToDocument(final PlainDocument document, final String text) { GuiUtilities.invokeLater(() -> { try { ((AbstractDocument) document).replace(0, document.getLength(), text, null); } catch (final BadLocationException exception) { logger.log(ILevel.FATAL, exception.getLocalizedMessage(), exception); } }); }
private void doSetMessage(final IMessage message) { try { this.messageTitleLabel.setForeground(MessageUI.getColor(message)); this.messageTitleLabel.setText(message.getText()); this.messageTypeLabel.setIcon(MessageUI.getIcon(message, getIcon())); this.messageTextArea.setForeground(MessageUI.getColor(message)); this.messageDocument.replace(0, this.messageDocument.getLength(), message.getDescription(), null); } catch (final Exception exception) { // TODO_NOW: handle exception } }
PlainDocument pd = (PlainDocument) model; try { vals.put(name, encode(pd.getText(0, pd.getLength()))); } catch (BadLocationException e1) { LOGGER.error(e1.getStackTrace()); PlainDocument pd = (PlainDocument) model; try { vals.put(name, encode(pd.getText(0, pd.getLength()))); } catch (BadLocationException e1) { LOGGER.error(e1.getStackTrace()); PlainDocument pd = (PlainDocument) model; try { vals.put(name, encode(pd.getText(0, pd.getLength()))); } catch (BadLocationException e1) { LOGGER.error(e1.getStackTrace());