Example usage for org.eclipse.jface.viewers ViewerCell setText

List of usage examples for org.eclipse.jface.viewers ViewerCell setText

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ViewerCell setText.

Prototype

public void setText(String text) 

Source Link

Document

Set the text for the cell.

Usage

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: altitude//from   w w  w  . j a  va  2s . c  o m
 */
private void defineColumn_Altitude() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_ALTITUDE.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            final float dbAltitude = wp.getAltitude();

            if (dbAltitude == Float.MIN_VALUE) {
                cell.setText(UI.EMPTY_STRING);
            } else {

                final float altitude = dbAltitude / _unitValueAltitude;

                cell.setText(_nf_1_1.format(altitude));
            }
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: category/*from   w  w  w.j  a v  a2 s. c  o  m*/
 */
private void defineColumn_Category() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_CATEGORY.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            cell.setText(wp.getCategory());
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: comment/*w w  w. ja v  a 2s .c  om*/
 */
private void defineColumn_Comment() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_COMMENT.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            cell.setText(wp.getComment());
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: date/time//from   ww  w.j  ava  2  s  . c om
 */
private void defineColumn_Date() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_DATE.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            final long time = wp.getTime();

            cell.setText(time == 0 //
                    ? UI.EMPTY_STRING
                    : TimeTools.getZonedDateTime(time).format(TimeTools.Formatter_Date_S));
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: description/*from  w w  w.  j  av a 2s .co  m*/
 */
private void defineColumn_Description() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_DESCRIPTION.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            cell.setText(wp.getDescription());
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: id/*from ww w  .ja va2s.  co  m*/
 */
private void defineColumn_Id() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_ID.createColumn(_columnManager, _pc);
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            long wpId = wp.getWayPointId();

            if (wpId == TourDatabase.ENTITY_IS_NOT_SAVED) {
                wpId = wp.getCreateId();
            }

            cell.setText(Long.toString(wpId));
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: latitude//from  w  ww .j  a  va 2 s  .c  o m
 */
private void defineColumn_Latitude() {

    final ColumnDefinition colDef = TableColumnFactory.MOTION_LATITUDE.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            cell.setText(Double.toString(wp.getLatitude()));
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: longitude//from ww w.ja  v a2  s . co m
 */
private void defineColumn_Longitude() {

    final ColumnDefinition colDef = TableColumnFactory.MOTION_LONGITUDE.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setCanModifyVisibility(true);
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            cell.setText(Double.toString(wp.getLongitude()));
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: name// w  w  w .j  ava2  s  . c o  m
 */
private void defineColumn_Name() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_NAME.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            cell.setText(wp.getName());
        }
    });
}

From source file:net.tourbook.ui.views.TourWaypointView.java

License:Open Source License

/**
 * column: symbol/*from   w  ww .j a v  a2 s  . co m*/
 */
private void defineColumn_Symbol() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_SYMBOL.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourWayPoint wp = (TourWayPoint) cell.getElement();
            cell.setText(wp.getSymbol());
        }
    });
}