Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Table and Disable Specific Cells if needed
Table and Disable Specific Cells if needed [message #1751534] Wed, 11 January 2017 09:15 Go to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 189
Registered: November 2014
Senior Member

Hello there,

if a certain value is set to a SmartColumn in my Table I'd like to disable it and set a static text instead of the stored value.

Is this somehow possible or can I only either enable or disable all cells at once?

Thanks

Peter

[Updated on: Wed, 11 January 2017 09:18]

Report message to a moderator

Re: Table and Disable Specific Cells if needed [message #1751541 is a reply to message #1751534] Wed, 11 January 2017 10:27 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 123
Registered: March 2010
Senior Member
You can control what text is in the table cell using this callback. This example has a smart column of Locales.
When choosing "Deutsch" then it shows the cell text "Foo Bar" and the cell is not editable anymore.

Does that help?

          @Order(10)
          public class LanguageColumn extends AbstractSmartColumn<Locale> {

            @Override
            protected boolean getConfiguredEditable() {
              return true;
            }

            @Override
            protected String getConfiguredHeaderText() {
              return TEXTS.get("Language");
            }

            @Override
            protected int getConfiguredWidth() {
              return 80;
            }

            @Override
            protected Class<? extends ILookupCall<Locale>> getConfiguredLookupCall() {
              return (Class<? extends ILookupCall<Locale>>) LocaleLookupCall.class;
            }

            @Override
            protected ILookupCall<Locale> prepareLookupCall(ITableRow row, final Locale key) {
              //'de' is special
              if (key != null && key.getLanguage().equals("de")) {
                //use special fixed text override, so emulate a single lookup row with the desired values
                ILookupCall<Locale> lookupCall = new LocalLookupCall<Locale>() {
                  @Override
                  protected List<? extends ILookupRow<Locale>> execCreateLookupRows() {
                    return Collections.singletonList(new LookupRow<Locale>(key, "Foo Bar"));
                  }
                };
                lookupCall.setKey(key);
                return lookupCall;
              }
              else {
                return super.prepareLookupCall(row, key);
              }
            }

            @Override
            protected void execDecorateCell(Cell cell, ITableRow row) {
              final Locale key = this.getValue(row);
              //'de' is special, disable cell
              if (key != null && key.getLanguage().equals("de")) {
                cell.setEditable(false);
              }
            }
          }
Re: Table and Disable Specific Cells if needed [message #1751546 is a reply to message #1751541] Wed, 11 January 2017 10:42 Go to previous message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 189
Registered: November 2014
Senior Member

Great thanks, that looks very promising. I'll give that a try at the evening
Previous Topic:[NEON] Demo project
Next Topic:Download file
Goto Forum:
  


Current Time: Wed Jul 26 17:09:34 GMT 2017

Powered by FUDForum. Page generated in 0.02002 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software