List of usage examples for org.eclipse.jface.viewers ViewerCell setText
public void setText(String text)
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: number of photos which are saved in the tour *//* w w w . j av a 2s. com*/ private void defineColumn_Photo_NumberOfTourPhotos() { final ColumnDefinition colDef = TableColumnFactory.PHOTO_NUMBER_OF_PHOTOS.createColumn(_columnManager, _pc); colDef.setIsDefaultColumn(); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourPhotoLink link = (TourPhotoLink) cell.getElement(); final int numberOfPhotos = link.numberOfTourPhotos; cell.setText(numberOfPhotos == 0 ? UI.EMPTY_STRING : Integer.toString(numberOfPhotos)); setBgColor(cell, link); } }); }
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: number of photos which are saved in the tour *///from w ww . j av a2 s .c o m private void defineColumn_Photo_TimeAdjustment() { final ColumnDefinition colDef = TableColumnFactory.PHOTO_TIME_ADJUSTMENT.createColumn(_columnManager, _pc); colDef.setIsDefaultColumn(); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourPhotoLink link = (TourPhotoLink) cell.getElement(); final int numberOfTourPhotos = link.numberOfTourPhotos; final int timeAdjustment = link.photoTimeAdjustment; cell.setText(numberOfTourPhotos == 0 // ? UI.EMPTY_STRING : UI.formatHhMmSs(timeAdjustment)); setBgColor(cell, link); } }); }
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: tour type text//from ww w. j a v a 2s.c om */ private void defineColumn_Photo_TourCameras() { final ColumnDefinition colDef = TableColumnFactory.PHOTO_TOUR_CAMERA.createColumn(_columnManager, _pc); colDef.setIsDefaultColumn(); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final Object element = cell.getElement(); if (element instanceof TourPhotoLink) { final TourPhotoLink link = (TourPhotoLink) element; cell.setText(link.tourCameras); setBgColor(cell, link); } } }); }
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: duration time//from w ww.j a va 2 s. c om */ private void defineColumn_Time_TourDurationTime() { final ColumnDefinition colDef = TableColumnFactory.TIME_TOUR_DURATION_TIME.createColumn(_columnManager, _pc); colDef.setIsDefaultColumn(); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourPhotoLink link = (TourPhotoLink) cell.getElement(); final Period period = link.tourPeriod; int periodSum = 0; for (final int value : period.getValues()) { periodSum += value; } if (periodSum == 0) { // < 1 h cell.setText(Messages.Photos_AndTours_Label_DurationLess1Hour); } else { // > 1 h cell.setText(period.toString(_durationFormatter)); } setBgColor(cell, link); } }); }
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: tour end date/*from ww w.jav a 2s.c o m*/ */ private void defineColumn_Time_TourEndDate() { final ColumnDefinition colDef = TableColumnFactory.TIME_TOUR_END_DATE.createColumn(_columnManager, _pc); // colDef.setCanModifyVisibility(false); // colDef.setIsDefaultColumn(); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourPhotoLink link = (TourPhotoLink) cell.getElement(); final long historyTime = link.historyEndTime; cell.setText(historyTime == Long.MIN_VALUE // ? TimeTools.getZonedDateTime(link.tourEndTime).format(TimeTools.Formatter_Date_S) : TimeTools.getZonedDateTime(historyTime).format(TimeTools.Formatter_Date_S)); setBgColor(cell, link); } }); }
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: tour end time/*w ww. j a va 2 s . com*/ */ private void defineColumn_Time_TourEndTime() { final ColumnDefinition colDef = TableColumnFactory.TIME_TOUR_END_TIME.createColumn(_columnManager, _pc); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourPhotoLink link = (TourPhotoLink) cell.getElement(); final long historyTime = link.historyEndTime; cell.setText(historyTime == Long.MIN_VALUE // ? TimeTools.getZonedDateTime(link.tourEndTime).format(TimeTools.Formatter_Time_M) : TimeTools.getZonedDateTime(historyTime).format(TimeTools.Formatter_Time_M)); setBgColor(cell, link); } }); }
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: tour start date//w ww. j a va2 s . co m */ private void defineColumn_Time_TourStartDate() { final ColumnDefinition colDef = TableColumnFactory.TIME_TOUR_START_DATE.createColumn(_columnManager, _pc); // colDef.setCanModifyVisibility(false); colDef.setIsDefaultColumn(); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourPhotoLink link = (TourPhotoLink) cell.getElement(); final long historyTime = link.historyStartTime; cell.setText(historyTime == Long.MIN_VALUE // ? TimeTools.getZonedDateTime(link.tourStartTime).format(TimeTools.Formatter_Date_S) : TimeTools.getZonedDateTime(historyTime).format(TimeTools.Formatter_Date_S)); setBgColor(cell, link); } }); }
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: tour start time/*from ww w . j ava 2 s.com*/ */ private void defineColumn_Time_TourStartTime() { final ColumnDefinition colDef = TableColumnFactory.TIME_TOUR_START_TIME.createColumn(_columnManager, _pc); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourPhotoLink link = (TourPhotoLink) cell.getElement(); final long historyTime = link.historyStartTime; cell.setText(historyTime == Long.MIN_VALUE // ? TimeTools.getZonedDateTime(link.tourStartTime).format(TimeTools.Formatter_Time_M) : TimeTools.getZonedDateTime(historyTime).format(TimeTools.Formatter_Time_M)); setBgColor(cell, link); } }); }
From source file:net.tourbook.tour.photo.TourPhotoLinkView.java
License:Open Source License
/** * column: tour type text/*from ww w.ja v a 2 s .com*/ */ private void defineColumn_Tour_TypeText() { final ColumnDefinition colDef = TableColumnFactory.TOUR_TYPE_TEXT.createColumn(_columnManager, _pc); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final Object element = cell.getElement(); if (element instanceof TourPhotoLink) { final TourPhotoLink link = (TourPhotoLink) element; if (link.isHistoryTour) { cell.setText(Messages.Photos_AndTours_Label_HistoryTour); } else { final long tourTypeId = link.tourTypeId; if (tourTypeId == -1) { cell.setText(UI.EMPTY_STRING); } else { cell.setText(net.tourbook.ui.UI.getTourTypeLabel(tourTypeId)); } } setBgColor(cell, link); } } }); }
From source file:net.tourbook.ui.views.collateTours.CollatedToursView.java
License:Open Source License
/** * Tree column: Collate event// w w w .ja va 2 s .c om */ private void defineColumn_1stColumn_CollateEvent() { final TreeColumnDefinition colDef = TreeColumnFactory.TOUR_COLLATE_EVENT.createColumn(_columnManager, _pc); colDef.setIsDefaultColumn(); colDef.setCanModifyVisibility(false); colDef.setLabelProvider(new TourInfoToolTipStyledCellLabelProvider() { @Override public Long getTourId(final ViewerCell cell) { if (_isToolTipInCollation == false) { return null; } return getCellTourId(cell); } @Override public void update(final ViewerCell cell) { final Object element = cell.getElement(); final TVICollatedTour tourItem = (TVICollatedTour) element; if (element instanceof TVICollatedTour_Tour) { // tour item cell.setText(TimeTools// .getZonedDateTime(tourItem.colTourStartTime).format(TimeTools.Formatter_Date_S)); } else if (element instanceof TVICollatedTour_Event) { final TVICollatedTour_Event collatedEvent = (TVICollatedTour_Event) element; // collated event final StyledString styledString = new StyledString(); /* * Event start */ String startText; if (collatedEvent.isFirstEvent) { startText = Messages.Collate_Tours_Label_TimeScale_BeforePresent; } else { startText = collatedEvent.eventStart.format(TimeTools.Formatter_Date_S); } styledString.append(startText, DATE_STYLER); /* * Event end */ styledString.append(UI.DASH_WITH_SPACE); final ZonedDateTime eventEnd = collatedEvent.eventEnd; if (eventEnd == null) { // this can be null when the collation process is canceled by the user styledString.append(UI.SYMBOL_QUESTION_MARK, DATE_STYLER); } else { String endText; if (collatedEvent.isLastEvent) { endText = Messages.Collate_Tours_Label_TimeScale_Today; } else { endText = eventEnd.format(TimeTools.Formatter_Date_S); } styledString.append(endText, DATE_STYLER); } /* * Number of tours for each event */ styledString.append(UI.SPACE3); styledString.append(_nf0.format(tourItem.colCounter), StyledString.QUALIFIER_STYLER); cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); } setCellColor(cell, element); } }); }