Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Question: Hilites using boolean methods instead of Criteria

    Hi Isomorphic,

    I have a use case where I currently mark some ListGrid entries as non-editable by using a light grey color:
    Code:
    @Override
    protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
    	String color = null;
    
    	// Set gray when not group row and read-only
    	if (!MyList.this.isGroupNode(record) && !getReadWrite(record))
    		color = "color:#888;";
    
    	// Output result
    	return (color == null) ? super.getCellCSSText(record, rowNum, colNum) : color;
    }
    Now I wanted to add some data Hilites, but it seems that Hilite and @Overriding getCellCSSText() do not work together. Is that correct?
    IMO this would be perfectly fine as I assume you use getCellCSSText() as hookpoint for the Hilite-system.

    Of course I could do everything in getCellCSSText(), but I assume you created the more declarative Hilite-system to avoid this, so I'm asking here.

    Generally speaking it should be possible to use these boolean methods with just Hilites and no getCellCSSText(), but as they use more than just record-data, I don't know how to do it.
    Can you suggest a way?

    Would it be possible to have a Criteria constructor taking only a method name with a 1-ListGridRecord-argument signature and pass the record to this method during HiLite-Criteria evaluation?
    I don't know if GWT allows this (the method could be seen as dead code and be removed). Is there an other way I'm not seeing right now?

    Thank you & Best regards,
    Blama
    Last edited by Blama; 12 Nov 2014, 05:34.

    #2
    If you are using Hilites and you override getCellCSSText(), combine any values you want to return with the default return value provided by super, or as you've seen, you will remove the Hilites.

    Comment


      #3
      Hello Isomorphic,

      OK, thanks. I'll do so.

      Regarding the 2nd point:
      Is it somehow possible to call a method acting on the current ListGridRecord in order to determine whether to apply a Hilite?
      Either as part of the Hilite-Criteria system or as new Hilite property or in any other already existing way I might be overlooking right now?

      Best regards,
      Blama

      Comment


        #4
        DataSource.applyFilter() allows you to take criteria and figure out which records match that criteria.

        We don't really see a point in pursuing this, however. Seems like you would just end up re-inventing the hilite system, but probably much slower.

        Comment

        Working...
        X