Java Code Examples for org.pentaho.reporting.engine.classic.core.Element#notifyNodePropertiesChanged()
The following examples show how to use
org.pentaho.reporting.engine.classic.core.Element#notifyNodePropertiesChanged() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PasteFormatAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void undo( final ReportDocumentContext renderContext ) { final Element target = (Element) ModelUtility.findElementById( renderContext.getReportDefinition(), element ); final ElementStyleSheet styleSheet = target.getStyle(); final StyleKey[] keys = StyleKey.getDefinedStyleKeys(); for ( int i = 0; i < oldStyleData.length; i++ ) { final Object o = oldStyleData[ i ]; if ( o != null ) { styleSheet.setStyleProperty( keys[ i ], o ); } } final String[] namespaces = oldAttributes.getNameSpaces(); for ( int i = 0; i < namespaces.length; i++ ) { final String namespace = namespaces[ i ]; final String[] names = oldAttributes.getNames( namespace ); for ( int j = 0; j < names.length; j++ ) { final String name = names[ j ]; target.setAttribute( namespace, name, oldAttributes.getAttribute( namespace, name ), false ); } } target.notifyNodePropertiesChanged(); }
Example 2
Source File: PasteFormatAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void redo( final ReportDocumentContext renderContext ) { final Element target = (Element) ModelUtility.findElementById( renderContext.getReportDefinition(), element ); final ElementStyleSheet styleSheet = target.getStyle(); final StyleKey[] keys = StyleKey.getDefinedStyleKeys(); for ( int i = 0; i < newStyleData.length; i++ ) { final Object o = newStyleData[ i ]; if ( o != null ) { styleSheet.setStyleProperty( keys[ i ], o ); } } final String[] namespaces = newAttributes.getNameSpaces(); for ( int i = 0; i < namespaces.length; i++ ) { final String namespace = namespaces[ i ]; final String[] names = newAttributes.getNames( namespace ); for ( int j = 0; j < names.length; j++ ) { final String name = names[ j ]; target.setAttribute( namespace, name, newAttributes.getAttribute( namespace, name ), false ); } } target.notifyNodePropertiesChanged(); }
Example 3
Source File: UnderlineAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); Boolean value = null; final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element element : visualElements ) { final ElementStyleSheet styleSheet = element.getStyle(); if ( value == null ) { if ( styleSheet.getBooleanStyleProperty( TextStyleKeys.UNDERLINED ) ) { value = Boolean.FALSE; } else { value = Boolean.TRUE; } } undos.add( StyleEditUndoEntry.createConditional( element, TextStyleKeys.UNDERLINED, value ) ); styleSheet.setStyleProperty( TextStyleKeys.UNDERLINED, value ); element.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "UnderlineAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 4
Source File: TextAlignmentLeftAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element element : visualElements ) { final ElementStyleSheet styleSheet = element.getStyle(); undos.add( StyleEditUndoEntry.createConditional( element, ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT ) ); styleSheet.setStyleProperty( ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT ); element.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "TextAlignmentLeftAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 5
Source File: TextAlignmentJustifyAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element element : visualElements ) { final ElementStyleSheet styleSheet = element.getStyle(); undos .add( StyleEditUndoEntry.createConditional( element, ElementStyleKeys.ALIGNMENT, ElementAlignment.JUSTIFY ) ); styleSheet.setStyleProperty( ElementStyleKeys.ALIGNMENT, ElementAlignment.JUSTIFY ); element.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "TextAlignmentJustifyAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 6
Source File: TextAlignmentRightAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element element : visualElements ) { final ElementStyleSheet styleSheet = element.getStyle(); undos.add( StyleEditUndoEntry.createConditional( element, ElementStyleKeys.ALIGNMENT, ElementAlignment.RIGHT ) ); styleSheet.setStyleProperty( ElementStyleKeys.ALIGNMENT, ElementAlignment.RIGHT ); element.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "TextAlignmentRightAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 7
Source File: StrikethroughAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); Boolean value = null; for ( Element element : visualElements ) { final ElementStyleSheet styleSheet = element.getStyle(); if ( value == null ) { if ( styleSheet.getBooleanStyleProperty( TextStyleKeys.STRIKETHROUGH ) ) { value = Boolean.FALSE; } else { value = Boolean.TRUE; } } undos.add( StyleEditUndoEntry.createConditional( element, TextStyleKeys.STRIKETHROUGH, value ) ); styleSheet.setStyleProperty( TextStyleKeys.STRIKETHROUGH, value ); element.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "StrikethroughAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 8
Source File: TextAlignmentCenterAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element element : visualElements ) { final ElementStyleSheet styleSheet = element.getStyle(); undos.add( StyleEditUndoEntry.createConditional( element, ElementStyleKeys.ALIGNMENT, ElementAlignment.CENTER ) ); styleSheet.setStyleProperty( ElementStyleKeys.ALIGNMENT, ElementAlignment.CENTER ); element.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "TextAlignmentCenterAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 9
Source File: ApplyFontFamilyAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final Object o = comboBox.getSelectedItem(); if ( o != null && o instanceof String == false ) { return; } final String font = (String) o; final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element visualElement : visualElements ) { undos.add( StyleEditUndoEntry.createConditional( visualElement, TextStyleKeys.FONT, font ) ); visualElement.getStyle().setStyleProperty( TextStyleKeys.FONT, font ); visualElement.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "ApplyFontFamilyAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 10
Source File: ApplyFontSizeAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final Object o = comboBox.getSelectedItem(); if ( o instanceof Integer == false ) { return; } final Integer fontSize = (Integer) o; final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element visualElement : visualElements ) { final ElementStyleSheet styleSheet = visualElement.getStyle(); undos.add( StyleEditUndoEntry.createConditional( visualElement, TextStyleKeys.FONTSIZE, fontSize ) ); styleSheet.setStyleProperty( TextStyleKeys.FONTSIZE, fontSize ); visualElement.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "ApplyFontSizeAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 11
Source File: ApplyFontColorAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final Object o = comboBox.getSelectedItem(); if ( o != null && o instanceof Color == false ) { return; } final Color color = (Color) o; final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element visualElement : visualElements ) { final ElementStyleSheet styleSheet = visualElement.getStyle(); undos.add( StyleEditUndoEntry.createConditional( visualElement, ElementStyleKeys.PAINT, color ) ); styleSheet.setStyleProperty( ElementStyleKeys.PAINT, color ); visualElement.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "ApplyFontColorAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }
Example 12
Source File: ItalicsAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { final DocumentContextSelectionModel model = getSelectionModel(); if ( model == null ) { return; } final List<Element> visualElements = model.getSelectedElementsOfType( Element.class ); Boolean value = null; final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>(); for ( Element element : visualElements ) { final ElementStyleSheet styleSheet = element.getStyle(); if ( value == null ) { if ( styleSheet.getBooleanStyleProperty( TextStyleKeys.ITALIC ) ) { value = Boolean.FALSE; } else { value = Boolean.TRUE; } } undos.add( StyleEditUndoEntry.createConditional( element, TextStyleKeys.ITALIC, value ) ); styleSheet.setStyleProperty( TextStyleKeys.ITALIC, value ); element.notifyNodePropertiesChanged(); } getActiveContext().getUndo().addChange( ActionMessages.getString( "ItalicsAction.UndoName" ), new CompoundUndoEntry( undos.toArray( new UndoEntry[ undos.size() ] ) ) ); }