setting skin to dirty only has effect if it is set on initial render
--------------------------------------------------------------------

                 Key: TRINIDAD-1776
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1776
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Skinning
    Affects Versions: 2.0.0-alpha, 1.2.13-core 
            Reporter: Jeanne Waldman
            Assignee: Jeanne Waldman


This is a bug in the implementation for TRINIDAD-1687 add a Skin api that will 
clear the skin file(s) and reload at runtime

Overview
An end user should be able to call skin.setDirty(true) at any time and the
next render the skin's css file will be reparsed and reloaded. The bug is
that is the skin.setDirty(true) flag is not set on the initial render,
subsequent skin.setDirty(true) calls will not reparse/reload the skin.

Steps to Reproduce
1. render a page without calling skin.setDirty(true).
2. now call skin.setDirty(true), and re-render. The skin will not be
reparsed.


Details
Open Trinidad's StyleSheetEntry
See the code "return new CheckModifiedEntry(styleSheetName,"
CheckModifiedEntry has checkModified method which reparses the css file if
skin is dirty or if the file has changed.
The problem is that we only call new CheckModifiedEntry if (skin.isDirty() ||
CHECK_FILE_MODIFICATION flag is set).

The fix:
Create CheckModifiedEntry always, not conditional on dirty or
CHECK_FILE_MODIFICATION flag, and in its checkModified method this is where
we check if we need to reparse right away (if skin.isDirty), or check if the
file has been modified (if flag is set)

      // We create a special subclass of StyleSheetEntry that will
recalculate
      // the StyleSheetEntry if the skin is dirty or if the web.xml's
      // CHECK_FILE_MODIFICATION flag is set and there are file
modifications.
      boolean checkStylesModified = context.checkStylesModified();
      return new CheckModifiedEntry(styleSheetName,
                                    skinStyleSheet.getDocument(),
                                    resolver,
                                    checkStylesModified);

...
    public boolean checkModified(StyleContext context)
    {
      // We would synchronize here, but at the moment synchronization
      // is provided by Skin.getStyleSheetDocument().
      if (context.isDirty() ||
          (_checkFileModifiedFlagSet &&
           ((_provider != null) && (_provider.hasSourceChanged())))  )


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to