Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » An AbstractBooleanColumn does never display the icon AbstractIcons.StatusError?
An AbstractBooleanColumn does never display the icon AbstractIcons.StatusError? [message #1271180] Fri, 14 March 2014 08:48 Go to next message
Fredrik Möller is currently offline Fredrik Möller
Messages: 11
Registered: April 2013
Junior Member
Hello

The following code from the class: org.eclipse.scout.rt.ui.swt.basic.table.SwtScoutTableModel

 @Override
  public Image getColumnImage(Object element, int columnIndex) {
    int[] columnOrder = m_swtTable.getSwtField().getColumnOrder();
    if (columnOrder.length > 1) {
      String iconId = null;
      ICell cell = getCell(element, columnIndex);
      IColumn col = m_columnManager.getColumnByModelIndex(columnIndex - 1);
      if (columnOrder[1] == columnIndex && m_swtTable.getScoutObject() != null && m_swtTable.getScoutObject().isCheckable()) {
        if (((ITableRow) element).isChecked()) {
          iconId = SwtIcons.CheckboxYes;
        }
        else {
          iconId = SwtIcons.CheckboxNo;
        }
      }
      else if (col != null && cell != null && col.getDataType() == Boolean.class && (!(col instanceof ISmartColumn) || ((ISmartColumn) col).getLookupCall() == null)) {
        Boolean b = (Boolean) cell.getValue();
        if (b != null && b.booleanValue()) {
          iconId = SwtIcons.CheckboxYes;
        }
        else {
          iconId = SwtIcons.CheckboxNo;
        }
      }
      else if (cell != null && cell.getErrorStatus() != null && cell.getErrorStatus().getSeverity() == IStatus.ERROR) {
        iconId = AbstractIcons.StatusError;
      }
      else if (cell != null && cell.getIconId() != null) {
        iconId = cell.getIconId();
      }
      else if (columnOrder[1] == columnIndex) {
        ITableRow row = (ITableRow) element;
        iconId = row.getIconId();
      }
      return m_environment.getIcon(iconId);
    }
    return null;
  }


Seems to make it hard to display an error icon for an AbstractBooleanColumn with an error status.

Would it make sense to change the order of the if - else if statements to have the section which tests the error status first instead of the current position, or what is the reason to have it in this current order?

Kind regards
Fredrik Möller

[Updated on: Fri, 14 March 2014 08:50]

Report message to a moderator

Re: An AbstractBooleanColumn does never display the icon AbstractIcons.StatusError? [message #1271193 is a reply to message #1271180] Fri, 14 March 2014 09:22 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 626
Registered: October 2011
Senior Member
I think the problem is that the representation of a boolean table is represented in SWT with an icon.
* False value -> unchecked checkbox icon
* True value -> checked checkbox icon

The error status is also represented with an icon.

I have in mind, that you can not have 2 icons in the same swt column...


If I understood you comment correctly, you suggest changing the logic to:
...
else if(<has error status>) {
//display error status icon
} else if (<is Boolean Column>) {
//display the checked or unchecked checkbox icon depending on the Boolean value
}
...

But in this case, when you have an error on a boolean column, you will not see that it is a boolean column anymore... Or maybe I missed something.

Re: An AbstractBooleanColumn does never display the icon AbstractIcons.StatusError? [message #1272142 is a reply to message #1271193] Mon, 17 March 2014 03:04 Go to previous message
Fredrik Möller is currently offline Fredrik Möller
Messages: 11
Registered: April 2013
Junior Member
Hello Jeremie

You have understood my suggestion correct. And I can see the problem with my suggestion, but I can also see my initial problem that it is impossible to set an Boolean column as erroneus. As an developer I find that very strange that all column types except the Boolean one can display that something is problematic with the column.

I would call it a Bug?
Previous Topic:Proposal: ToolButtons in a form
Next Topic:Wrong error message when form is validated
Goto Forum:
  


Current Time: Thu Jul 24 11:26:06 EDT 2014

Powered by FUDForum. Page generated in 0.01751 seconds