Issue with showing invisible attributes in info panel.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with showing invisible attributes in info panel.

puneetbaijal

Hi All,

My requirement was to display selected attributes of a feature on Mouse Over.

It was know to me that if I set the visibility of attributes only those attributes show up which are visible in the info tool.

I was trying to open the Feature Info Dialog window on mouse over and was programmatically  setting the visibility of some predefined attributes to false so that they are not visible on mouse over but the attributes which are marked to be invisible are also being displayed.

If I set the Configuration of the Info panel to "Info as a form" and then try to view attributes, then also the attributes which are marked to be invisible are shown to the user.

Could any one please guide me as to how I can proceed in fixing this issue.

Regards

Puneet






"Disclaimer: This message and any attachments contain information that may be RMSI Private Limited. confidential and/or privileged. If you are not the intended recipient (or authorized to receive for the intended recipient), and have received this message in error, any use, disclosure or distribution is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to the e-mail and permanently deleting the message from your computer and/or storage system"


http://www.rmsi.com



_______________________________________________
Kosmo_int mailing list
[hidden email]
http://lists.saig.es/mailman/listinfo/kosmo_int
Reply | Threaded
Open this post in threaded view
|

Re: Issue with showing invisible attributes in info panel.

Sergio Baños Calvo
Good morning Puneet.

As you have stated, in the info tool only visible attributes should be shown (and the attribute names should be the public ones). This isn't the current behaviour for:
  • Info tool, when it has been configured to show the information as a form
  • Show attributes tool (present under the menu entry View when activating the extension Advanced Tools)
These two bugs (three, if we count also that the Show attributes tool doesn't show the public attribute name, but only the internal one) have been already solved for the next Kosmo Desktop version.

If you want to solve it for v.2.0.1, you have to change the next:

  • Info tool (information as a form)

- Class org.saig.jump.widgets.info.FeatureInfoDialog, method getTablePanel()

      /**
     * @return
     */
    protected JScrollPane getTablePane() {
        JScrollPane pane = new JScrollPane();
        tableModel = new FeatureTableModel();
        table = new JTable(tableModel);
        pane.setViewportView(table);
        pane.setMinimumSize(new Dimension(450, 300));
        pane.setPreferredSize(new Dimension(450, 300));

        // Create the row sorter
        TableRowSorter<FeatureTableModel> sorter =
            new TableRowSorter<FeatureTableModel>((FeatureTableModel) table.getModel());

        RowFilter<FeatureTableModel, Integer> visibleFilter =
            new RowFilter<FeatureTableModel, Integer>(){

                @Override
                public boolean include(
                        javax.swing.RowFilter.Entry< ? extends FeatureTableModel, ? extends Integer> entry ) {
                    FeatureTableModel featModel = entry.getModel();
                    return featModel.isVisible(entry.getIdentifier());
                }

            };
        sorter.setRowFilter(visibleFilter);

        table.setRowSorter(sorter);

        return pane;
    }


- Class org.saig.jump.widgets.info.FeatureInfoDialog, inner class FeatureTableModel, add method isVisible:

         /**
     * Check if the attribute for the given row is visible
     *
     * @param row
     * @return
     */
    public boolean isVisible( int row ) {
        if (feature == null || feature.getSchema() == null) {
            return false;
        }
        return feature.getSchema().getVisibility(row);
    }

- Class org.saig.jump.widgets.info.FeatureInfoDialog, inner class FeatureTableModel, change method getColumnClass:

    @Override
    public Class< ? > getColumnClass( int c ) {
        if (c == 0) {
            Object value = getValueAt(0, c);
            return value != null ? value.getClass() : Object.class;
        } else {
            return Object.class;
        }
    }



  • Show attributes tool
- Class com.vividsolutions.jump.workbench.ui.TooltipWriter, change method writeDefaultTooltip:

String toolTip = "<HTML>"; //$NON-NLS-1$
toolTip += "<I>" + GUIUtil.escapeHTML(layerable.getName(), true) + "</I><BR>"; //$NON-NLS-1$ //$NON-NLS-2$
FeatureSchema schema = feature.getSchema();
toolTip += format(schema.getPrimaryKeyName(), feature.getPrimaryKey());
for( int i = 0; i < Math.min(10, feature.getSchema().getAttributeCount()); i++ ) {
    Attribute attr = schema.getAttribute(i);
    if (!attr.isVisibility()) {
        continue;
    }

    AttributeType attrType = attr.getType();
    if (attrType == AttributeType.GEOMETRY || schema.getPrimaryKeyIndex() == i) {
        continue;
    }

    Object value = feature.getAttribute(i);
    if (value != null) {
        if (AttributeType.isDate(attrType)) {
            value = DateFormatManager.getDateTimeFormat().format((Date) value);
        } else if (AttributeType.isNumeric(attrType)) {
            value = NumberFormatManager.getFormattedValue((Number) value);
        }
    }
    toolTip += "<BR>" //$NON-NLS-1$
        + format(schema.getPublicName(i), value);
}



I think that the Show attributes tool acomplishes the requirement that you have (it displays a tooltip for the feature that you place the cursor over, as shown in the attached image):




You can set up a different template for the tooltip programmatically if you want to show the tooltip with a specific style (the example shows the default template if none has been setup).

If you have any doubt about the changes or the tools, just request more help ;).

Regards,

El 04/01/2013 16:32, Puneet Baijal escribió:

Hi All,

My requirement was to display selected attributes of a feature on Mouse Over.

It was know to me that if I set the visibility of attributes only those attributes show up which are visible in the info tool.

I was trying to open the Feature Info Dialog window on mouse over and was programmatically  setting the visibility of some predefined attributes to false so that they are not visible on mouse over but the attributes which are marked to be invisible are also being displayed.

If I set the Configuration of the Info panel to "Info as a form" and then try to view attributes, then also the attributes which are marked to be invisible are shown to the user.

Could any one please guide me as to how I can proceed in fixing this issue.

Regards

Puneet






"Disclaimer: This message and any attachments contain information that may be RMSI Private Limited. confidential and/or privileged. If you are not the intended recipient (or authorized to receive for the intended recipient), and have received this message in error, any use, disclosure or distribution is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to the e-mail and permanently deleting the message from your computer and/or storage system"


http://www.rmsi.com




_______________________________________________
Kosmo_int mailing list
[hidden email]
http://lists.saig.es/mailman/listinfo/kosmo_int

--

Sergio Baños Calvo

Jefe de desarrollos
Sistemas Abiertos de Información Geográfica, S.L. (SAIG S.L.)
Tlfno. móvil: 685005960
Tlfno. fijo: (+34) 954788876

E-mail: [hidden email]


_______________________________________________
Kosmo_int mailing list
[hidden email]
http://lists.saig.es/mailman/listinfo/kosmo_int