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.importdata.DialogEasyImportConfig.java

License:Open Source License

/**
 * Column: Set last marker//from  w  ww  .j  a  v a  2 s.  co m
 */
private void defineColumnIL_30_LastMarkerDistance() {

    final TableColumnDefinition colDef = new TableColumnDefinition(_ilColumnManager, "isSetLastMarker", //$NON-NLS-1$
            SWT.TRAIL);

    colDef.setColumnLabel(Messages.Dialog_ImportConfig_Column_LastMarker_Label);
    colDef.setColumnHeaderText(Messages.Dialog_ImportConfig_Column_LastMarker_Header);
    colDef.setColumnHeaderToolTipText(Messages.Dialog_ImportConfig_Column_LastMarker_Tooltip);

    colDef.setDefaultColumnWidth(_pc.convertWidthInCharsToPixels(7));
    colDef.setColumnWeightData(new ColumnWeightData(7));

    colDef.setIsDefaultColumn();

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final ImportLauncher importLauncher = (ImportLauncher) cell.getElement();

            if (importLauncher.isSetLastMarker) {

                final double distance = getMarkerDistanceValue(importLauncher);

                cell.setText(_nf1.format(distance));

            } else {

                cell.setText(UI.EMPTY_STRING);
            }
        }
    });
}

From source file:net.tourbook.importdata.DialogEasyImportConfig.java

License:Open Source License

/**
 * Column: Adjust temperature/*from   w  ww .j av a  2  s  . c  o  m*/
 */
private void defineColumnIL_40_AdjustTemperature() {

    final TableColumnDefinition colDef = new TableColumnDefinition(_ilColumnManager, //
            "isAdjustTemperature", //$NON-NLS-1$
            SWT.CENTER);

    colDef.setColumnLabel(Messages.Dialog_ImportConfig_Column_AdjustTemperature_Label);
    colDef.setColumnHeaderText(Messages.Dialog_ImportConfig_Column_AdjustTemperature_Header);
    colDef.setColumnHeaderToolTipText(Messages.Dialog_ImportConfig_Column_AdjustTemperature_Tooltip);

    colDef.setDefaultColumnWidth(_pc.convertWidthInCharsToPixels(15));
    colDef.setColumnWeightData(new ColumnWeightData(7));

    colDef.setIsDefaultColumn();

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final ImportLauncher importLauncher = (ImportLauncher) cell.getElement();

            if (importLauncher.isAdjustTemperature) {

                final float temperature = importLauncher.tourAvgTemperature;

                final String logText = NLS.bind(COLUMN_ADJUST_TEMPERATURE,
                        new Object[] { importLauncher.temperatureAdjustmentDuration,
                                (int) (UI.convertTemperatureFromMetric(temperature) + 0.5),
                                UI.UNIT_LABEL_TEMPERATURE });

                cell.setText(logText);

            } else {

                cell.setText(UI.EMPTY_STRING);
            }
        }
    });
}

From source file:net.tourbook.importdata.DialogEasyImportConfig.java

License:Open Source License

/**
 * Column: Is save tour//from  w w  w. ja  va2 s.  c o m
 */
private void defineColumnIL_88_IsSaveTour() {

    final TableColumnDefinition colDef = new TableColumnDefinition(_ilColumnManager, "isSaveTour", SWT.CENTER); //$NON-NLS-1$

    colDef.setColumnLabel(Messages.Dialog_ImportConfig_Column_Save_Label);
    colDef.setColumnHeaderText(Messages.Dialog_ImportConfig_Column_Save_Header);
    colDef.setColumnHeaderToolTipText(Messages.Dialog_ImportConfig_Checkbox_SaveTour_Tooltip);

    colDef.setDefaultColumnWidth(_pc.convertWidthInCharsToPixels(7));
    colDef.setColumnWeightData(new ColumnWeightData(7));

    colDef.setIsDefaultColumn();

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final ImportLauncher importLauncher = (ImportLauncher) cell.getElement();
            cell.setText(importLauncher.isSaveTour //
                    ? Messages.App_Label_BooleanYes
                    : UI.EMPTY_STRING);
        }
    });
}

From source file:net.tourbook.importdata.DialogEasyImportConfig.java

License:Open Source License

/**
 * Column: Show in dashboard/* w w w . j  a v  a 2s .c  om*/
 */
private void defineColumnIL_90_ShowInDashboard() {

    final TableColumnDefinition colDef = new TableColumnDefinition(_ilColumnManager, "showInDash", SWT.CENTER); //$NON-NLS-1$

    colDef.setColumnLabel(Messages.Dialog_ImportConfig_Column_ShowInDash_Label);
    colDef.setColumnHeaderText(Messages.Dialog_ImportConfig_Column_ShowInDash_Header);

    colDef.setDefaultColumnWidth(_pc.convertWidthInCharsToPixels(8));
    colDef.setColumnWeightData(new ColumnWeightData(8));

    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            cell.setText(((ImportLauncher) cell.getElement()).isShowInDashboard ? Messages.App_Label_BooleanYes
                    : Messages.App_Label_BooleanNo);
        }
    });
}

From source file:net.tourbook.importdata.DialogEasyImportConfig.java

License:Open Source License

/**
 * Column: Item description//  w ww  . j a  v  a 2s  . c o  m
 */
private void defineColumnIL_99_Description() {

    final TableColumnDefinition colDef = new TableColumnDefinition(_ilColumnManager, "configDescription", //$NON-NLS-1$
            SWT.LEAD);

    colDef.setColumnLabel(Messages.Dialog_ImportConfig_Column_Description);
    colDef.setColumnHeaderText(Messages.Dialog_ImportConfig_Column_Description);

    colDef.setDefaultColumnWidth(_pc.convertWidthInCharsToPixels(25));
    colDef.setColumnWeightData(new ColumnWeightData(25));

    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {
            cell.setText(((ImportLauncher) cell.getElement()).description);
        }
    });
}

From source file:net.tourbook.map3.ui.DialogSelectMap3Color.java

License:Open Source License

/**
 * Column: Show only the checkbox//  w ww  . j a va2s . c om
 */
private void defineColumn_10_Checkbox() {

    final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.LEAD);

    final TableColumn tc = tvc.getColumn();
    tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_NAME));

    tvc.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();

            if (element instanceof Map3GradientColorProvider) {

                final Map3ColorProfile colorProfile = ((Map3GradientColorProvider) (element))
                        .getMap3ColorProfile();

                cell.setText(colorProfile.getProfileName());
            }
        }
    });
}

From source file:net.tourbook.map3.ui.DialogSelectMap3Color.java

License:Open Source License

/**
 * Column: Min value//from  w  w  w .j  a v  a2 s  .co m
 */
private void defineColumn_20_MinValue() {

    final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.TRAIL);

    final TableColumn tc = tvc.getColumn();
    tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_VALUE));

    tvc.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();

            if (element instanceof Map3GradientColorProvider) {

                final Map3ColorProfile colorProfile = ((Map3GradientColorProvider) (element))
                        .getMap3ColorProfile();

                final ProfileImage profileImage = colorProfile.getProfileImage();

                final ArrayList<RGBVertex> vertices = profileImage.getRgbVertices();
                final RGBVertex firstVertex = vertices.get(0);

                final String minValueText = Integer.toString(firstVertex.getValue());

                cell.setText(minValueText);

            } else {

                cell.setText(UI.EMPTY_STRING);
            }
        }
    });
}

From source file:net.tourbook.map3.ui.DialogSelectMap3Color.java

License:Open Source License

/**
 * Column: Max value//  w w w. java  2  s . co m
 */
private void defineColumn_40_MaxValue() {

    final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.LEAD);

    final TableColumn tc = tvc.getColumn();
    tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_VALUE));

    tvc.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();

            if (element instanceof Map3GradientColorProvider) {

                final String maxValueText;
                final Map3ColorProfile colorProfile = ((Map3GradientColorProvider) (element))
                        .getMap3ColorProfile();

                final ProfileImage profileImage = colorProfile.getProfileImage();

                final ArrayList<RGBVertex> vertices = profileImage.getRgbVertices();
                final RGBVertex lastVertex = vertices.get(vertices.size() - 1);

                maxValueText = Integer.toString(lastVertex.getValue());

                cell.setText(maxValueText);

            } else {

                cell.setText(UI.EMPTY_STRING);
            }
        }
    });
}

From source file:net.tourbook.map3.ui.DialogSelectMap3Color.java

License:Open Source License

/**
 * Column: Relative/absolute values/*from w  w  w .j av  a 2  s .  co m*/
 */
private void defineColumn_50_RelativeAbsolute() {

    final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.TRAIL);

    final TableColumn tc = tvc.getColumn();
    tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_ABSOLUTE_RELATIVE));

    tvc.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();

            if (element instanceof Map3GradientColorProvider) {

                final Map3ColorProfile colorProfile = ((Map3GradientColorProvider) (element))
                        .getMap3ColorProfile();

                if (colorProfile.isAbsoluteValues()) {
                    cell.setText(Messages.Pref_Map3Color_Column_ValueMarker_Absolute);
                } else {
                    cell.setText(Messages.Pref_Map3Color_Column_ValueMarker_Relative);
                }

            } else {

                cell.setText(UI.EMPTY_STRING);
            }
        }
    });
}

From source file:net.tourbook.map3.ui.DialogSelectMap3Color.java

License:Open Source License

/**
 * Column: Legend overwrite marker//from  w  w w.j av a 2s.c  o  m
 */
private void defineColumn_52_OverwriteLegendMinMax() {

    final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.TRAIL);

    final TableColumn tc = tvc.getColumn();
    tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_ABSOLUTE_RELATIVE));

    tvc.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();

            if (element instanceof Map3GradientColorProvider) {

                final Map3ColorProfile colorProfile = ((Map3GradientColorProvider) (element))
                        .getMap3ColorProfile();

                if (colorProfile.isAbsoluteValues() && colorProfile.isOverwriteLegendValues()) {
                    cell.setText(Messages.Pref_Map3Color_Column_Legend_Marker);
                } else {
                    cell.setText(UI.EMPTY_STRING);
                }

            } else {

                cell.setText(UI.EMPTY_STRING);
            }
        }
    });
}