Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ColumnLabelProvider


        Column column = new NameColumn("0", Messages.ColumnName, SWT.None, 100); //$NON-NLS-1$
        column.getEditingSupport().addListener(this);
        support.addColumn(column);

        column = new Column(Messages.ColumnSecurity, SWT.NONE, 250);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                return ((InvestmentPlan) e).getSecurity().getName();
            }

            @Override
            public Image getImage(Object element)
            {
                return PortfolioPlugin.image(PortfolioPlugin.IMG_SECURITY);
            }
        });
        ColumnViewerSorter.create(Security.class, "name").attachTo(column); //$NON-NLS-1$
        List<Security> securities = new ArrayList<Security>(getClient().getSecurities());
        Collections.sort(securities, new Security.ByName());
        new ListEditingSupport(InvestmentPlan.class, "security", securities).addListener(this).attachTo(column); //$NON-NLS-1$
        support.addColumn(column);

        column = new Column(Messages.ColumnPortfolio, SWT.None, 120);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                return ((InvestmentPlan) e).getPortfolio().getName();
            }

            @Override
            public Image getImage(Object element)
            {
                return PortfolioPlugin.image(PortfolioPlugin.IMG_PORTFOLIO);
            }
        });
        ColumnViewerSorter.create(InvestmentPlan.class, "portfolio").attachTo(column); //$NON-NLS-1$
        new ListEditingSupport(InvestmentPlan.class, "portfolio", getClient().getActivePortfolios()).addListener(this).attachTo(column); //$NON-NLS-1$
        support.addColumn(column);

        column = new Column(Messages.ColumnAccount, SWT.None, 120);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                InvestmentPlan plan = (InvestmentPlan) e;
                return plan.getAccount() != null ? plan.getAccount().getName() : Messages.InvestmentPlanOptionDelivery;
            }

            @Override
            public Image getImage(Object e)
            {
                InvestmentPlan plan = (InvestmentPlan) e;
                return plan.getAccount() != null ? PortfolioPlugin.image(PortfolioPlugin.IMG_ACCOUNT) : null;
            }
        });
        ColumnViewerSorter.create(Account.class, "name").attachTo(column); //$NON-NLS-1$
        List<Account> accounts = new ArrayList<Account>();
        accounts.add(NewPlanDialog.DELIVERY);
        accounts.addAll(getClient().getAccounts());
        new ListEditingSupport(InvestmentPlan.class, "account", accounts).addListener(this).attachTo(column); //$NON-NLS-1$
        support.addColumn(column);

        column = new Column(Messages.ColumnStartDate, SWT.None, 80);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                return Values.Date.format(((InvestmentPlan) e).getStart());
            }
        });
        ColumnViewerSorter.create(InvestmentPlan.class, "start").attachTo(column); //$NON-NLS-1$
        new DateEditingSupport(InvestmentPlan.class, "start").addListener(this).attachTo(column); //$NON-NLS-1$
        support.addColumn(column);

        column = new Column(Messages.ColumnInterval, SWT.None, 80);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                return MessageFormat.format(Messages.InvestmentPlanIntervalLabel, ((InvestmentPlan) e).getInterval());
            }
        });
        ColumnViewerSorter.create(InvestmentPlan.class, "interval").attachTo(column); //$NON-NLS-1$
        List<Integer> available = new ArrayList<Integer>();
        for (int ii = 1; ii <= 12; ii++)
            available.add(ii);
        new ListEditingSupport(InvestmentPlan.class, "interval", available).addListener(this).attachTo(column); //$NON-NLS-1$
        support.addColumn(column);

        column = new Column(Messages.ColumnAmount, SWT.RIGHT, 80);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                return Values.Amount.format(((InvestmentPlan) e).getAmount());
            }
        });
        ColumnViewerSorter.create(InvestmentPlan.class, "amount").attachTo(column); //$NON-NLS-1$
        new ValueEditingSupport(InvestmentPlan.class, "amount", Values.Amount).addListener(this).attachTo(column); //$NON-NLS-1$
        support.addColumn(column);

        column = new Column(Messages.ColumnFees, SWT.RIGHT, 80);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                return Values.Amount.format(((InvestmentPlan) e).getFees());
View Full Code Here


        });
        column.getEditingSupport().addListener(this);
        accountColumns.addColumn(column);

        column = new Column(Messages.ColumnBalance, SWT.RIGHT, 80);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                return Values.Amount.format(((Account) e).getCurrentAmount());
View Full Code Here

        transactionsColumns = new ShowHideColumnHelper(AccountListView.class.getSimpleName() + "@bottom5", //$NON-NLS-1$
                        getPreferenceStore(), transactions, layout);

        Column column = new Column(Messages.ColumnDate, SWT.None, 80);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                AccountTransaction t = (AccountTransaction) e;
                return Values.Date.format(t.getDate());
            }

            @Override
            public Color getForeground(Object element)
            {
                return colorFor((AccountTransaction) element);
            }
        });
        ColumnViewerSorter.create(AccountTransaction.class, "date").attachTo(column, SWT.DOWN); //$NON-NLS-1$
        new DateEditingSupport(AccountTransaction.class, "date").addListener(this).attachTo(column); //$NON-NLS-1$
        transactionsColumns.addColumn(column);

        column = new Column(Messages.ColumnTransactionType, SWT.None, 100);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                AccountTransaction t = (AccountTransaction) e;
                return t.getType().toString();
            }

            @Override
            public Color getForeground(Object element)
            {
                return colorFor((AccountTransaction) element);
            }
        });
        column.setSorter(ColumnViewerSorter.create(AccountTransaction.class, "type")); //$NON-NLS-1$
        transactionsColumns.addColumn(column);

        column = new Column(Messages.ColumnAmount, SWT.RIGHT, 80);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                AccountTransaction t = (AccountTransaction) e;
                long v = t.getAmount();
                if (EnumSet.of(Type.REMOVAL, Type.FEES, Type.TAXES, Type.BUY, Type.TRANSFER_OUT).contains(t.getType()))
                    v = -v;
                return Values.Amount.format(v);
            }

            @Override
            public Color getForeground(Object element)
            {
                return colorFor((AccountTransaction) element);
            }
        });
        column.setSorter(ColumnViewerSorter.create(AccountTransaction.class, "amount")); //$NON-NLS-1$
        new ValueEditingSupport(AccountTransaction.class, "amount", Values.Amount).addListener(this).attachTo(column); //$NON-NLS-1$
        transactionsColumns.addColumn(column);

        column = new Column(Messages.ColumnSecurity, SWT.None, 250);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                AccountTransaction t = (AccountTransaction) e;
                return t.getSecurity() != null ? String.valueOf(t.getSecurity()) : null;
            }

            @Override
            public Color getForeground(Object element)
            {
                return colorFor((AccountTransaction) element);
            }
        });
        column.setSorter(ColumnViewerSorter.create(AccountTransaction.class, "security")); //$NON-NLS-1$
        List<Security> securities = new ArrayList<Security>(getClient().getSecurities());
        Collections.sort(securities, new Security.ByName());
        new ListEditingSupport(AccountTransaction.class, "security", securities) //$NON-NLS-1$
        {
            @Override
            public boolean canEdit(Object element)
            {
                AccountTransaction t = (AccountTransaction) element;

                return t.getType() == AccountTransaction.Type.BUY //
                                || t.getType() == AccountTransaction.Type.SELL //
                                || t.getType() == AccountTransaction.Type.DIVIDENDS;
            }
        }.addListener(this).attachTo(column);
        transactionsColumns.addColumn(column);

        column = new Column(Messages.ColumnShares, SWT.RIGHT, 80);
        column.setLabelProvider(new SharesLabelProvider()
        {
            @Override
            public Long getValue(Object e)
            {
                AccountTransaction t = (AccountTransaction) e;
                if (t.getCrossEntry() instanceof BuySellEntry)
                {
                    return ((BuySellEntry) t.getCrossEntry()).getPortfolioTransaction().getShares();
                }
                else if (t.getType() == Type.DIVIDENDS && t.getShares() != 0)
                {
                    return t.getShares();
                }
                else
                {
                    return null;
                }
            }

            @Override
            public Color getForeground(Object element)
            {
                return colorFor((AccountTransaction) element);
            }
        });
        new ValueEditingSupport(AccountTransaction.class, "shares", Values.Share) //$NON-NLS-1$
        {
            @Override
            public boolean canEdit(Object element)
            {
                AccountTransaction t = (AccountTransaction) element;
                return t.getType() == AccountTransaction.Type.DIVIDENDS;
            }
        }.addListener(this).attachTo(column);
        transactionsColumns.addColumn(column);

        column = new Column(Messages.ColumnPurchasePrice, SWT.RIGHT, 80);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                AccountTransaction t = (AccountTransaction) e;
                if (t.getCrossEntry() instanceof BuySellEntry)
                {
                    PortfolioTransaction portfolioTransaction = ((BuySellEntry) t.getCrossEntry())
                                    .getPortfolioTransaction();
                    return Values.Amount.format(portfolioTransaction.getActualPurchasePrice());
                }
                else if (t.getType() == Type.DIVIDENDS && t.getShares() != 0)
                {
                    return Values.Amount.format(Math.round(t.getAmount() * Values.Share.divider() / t.getShares()));
                }
                else
                {
                    return null;
                }
            }

            @Override
            public Color getForeground(Object element)
            {
                return colorFor((AccountTransaction) element);
            }
        });
        transactionsColumns.addColumn(column);

        column = new Column(Messages.ColumnOffsetAccount, SWT.None, 120);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                AccountTransaction t = (AccountTransaction) e;
                return t.getCrossEntry() != null ? t.getCrossEntry().getCrossEntity(t).toString() : null;
            }

            @Override
            public Color getForeground(Object element)
            {
                return colorFor((AccountTransaction) element);
            }
        });
        transactionsColumns.addColumn(column);

        column = new Column(Messages.ColumnNote, SWT.None, 200);
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                return ((AccountTransaction) e).getNote();
View Full Code Here

    TableViewerColumn column = new TableViewerColumn(v, SWT.NONE);
    column.getColumn().setWidth(200);
    column.getColumn().setMoveable(true);
    column.getColumn().setText("Column 1");
    column.setLabelProvider(new ColumnLabelProvider());

    column = new TableViewerColumn(v, SWT.NONE);
    column.getColumn().setWidth(200);
    column.getColumn().setMoveable(true);
    column.getColumn().setText("Column 2");
    column.setLabelProvider(new ColumnLabelProvider());

    column = new TableViewerColumn(v, SWT.NONE);
    column.getColumn().setWidth(200);
    column.getColumn().setMoveable(true);
    column.getColumn().setText("Column 3");
    column.setLabelProvider(new ColumnLabelProvider());

    MyModel[] model = createModel();
    v.setInput(model);
    v.getTable().setLinesVisible(true);
    v.getTable().setHeaderVisible(true);
View Full Code Here

        TableViewerColumn col = null;
        int columnCount = 0;
        for ( final String column : titles )
        {
            col = createTableViewerColumn( tableViewer, column, columnCount++ );
            col.setLabelProvider( new ColumnLabelProvider()
            {
                @Override
                public String getText( Object element )
                {
                    Map<String, Object> rs = (Map<String, Object>) element;
View Full Code Here

      });
      ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);

      TableViewerColumn nameCol = new TableViewerColumn(tableViewer, SWT.NONE);
      nameCol.getColumn().setText(UIPlugin.getLocalString("_UI_Name_label"));
      nameCol.setLabelProvider(new ColumnLabelProvider() {
        @Override
        public Image getImage(Object element) {
          String fullName = getText(element);
          int row = getRowNumber(element);
          int severity = validateDependencyName(fullName, "n" + row); //$NON-NLS-1$

          MetadataModel.Dependency dep = (MetadataModel.Dependency) element;
          if(!dep.isResolved()) {
            IMessageManager msgManager = getManagedForm().getMessageManager();
            msgManager.addMessage(
              "d" + row, MetadataModel.getUnresolvedMessage(dep), null, IMessageProvider.ERROR);
            severity = IMessage.ERROR;
          }

          if(severity == IMessage.ERROR)
            return error;
          if(severity == IMessage.WARNING)
            return warning;
          return null;
        }

        @Override
        public String getText(Object element) {
          return ((MetadataModel.Dependency) element).getModuleName();
        }

        @Override
        public Point getToolTipShift(Object object) {
          return new Point(0, 15);
        }

        @Override
        public String getToolTipText(Object element) {
          StringBuilder bld = new StringBuilder();
          String fullName = getText(element);
          try {
            ModuleName.create(fullName, true);
          }
          catch(IllegalArgumentException e) {
            bld.append("- ");
            bld.append(MetadataModel.getBadNameMessage(e, true));
          }
          MetadataModel.Dependency dep = (MetadataModel.Dependency) element;
          if(!dep.isResolved()) {
            if(bld.length() > 0)
              bld.append('\n');
            bld.append("- ");
            bld.append(MetadataModel.getUnresolvedMessage(dep));
          }
          return bld.length() == 0
              ? null
              : bld.toString();
        }
      });
      tableColumnLayout.setColumnData(nameCol.getColumn(), new ColumnWeightData(5));

      TableViewerColumn vrCol = new TableViewerColumn(tableViewer, SWT.NONE);
      vrCol.getColumn().setText(UIPlugin.getLocalString("_UI_Version_label"));
      vrCol.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public Image getImage(Object element) {
          String versionRequirement = emptyIfNull(getText(element));
          int vs = validateVersionRequirement(versionRequirement, "v" + getRowNumber(element));
View Full Code Here

    final CompareConfiguration config = new CompareConfiguration();

    TreeViewerColumn resourceColumn = new TreeViewerColumn(viewer, SWT.LEAD);
    resourceColumn.getColumn().setText("Changes");
    resourceColumn.getColumn().setWidth(100);
    resourceColumn.setLabelProvider(new ColumnLabelProvider() {
      public String getText(Object element) {
        if (element instanceof BatchModelChange) {
          StringBuffer buffer = new StringBuffer();
          BatchModelChange batchChange = (BatchModelChange) element;
          buffer.append(batchChange.isOutgoing() ? "Outgoing"
              : "Incoming");
          buffer.append(" (");
          buffer.append(formatter.format(new Date(batchChange
              .getTime())));
          buffer.append(')');
          return buffer.toString();
        } else {
          return new Path(((ResourceChangeMessage) element).getPath())
              .lastSegment();
        }
      }

      public Image getImage(Object element) {
        if (element instanceof BatchModelChange) {
          Image image = PlatformUI.getWorkbench().getSharedImages()
              .getImage(ISharedImages.IMG_OBJ_FOLDER);
          int kind = 0;
          if (((BatchModelChange) element).isOutgoing()) {
            kind = (kind & ~SyncInfo.OUTGOING)
                | SyncInfo.INCOMING | SyncInfo.CHANGE;
          } else {
            kind = (kind & ~SyncInfo.OUTGOING)
                | SyncInfo.OUTGOING | SyncInfo.CHANGE;
          }
          return config.getImage(image, kind);
        } else {
          ResourceChangeMessage message = (ResourceChangeMessage) element;
          int type = message.getType();
          IPath path = new Path(message.getPath());

          Image image = null;
          if (type == IResource.FILE) {
            image = labelProvider.getImage(ResourcesPlugin
                .getWorkspace().getRoot().getFile(path));
          } else {
            image = labelProvider.getImage(ResourcesPlugin
                .getWorkspace().getRoot().getFolder(path));
          }

          if (message.isConflicted()) {
            return config.getImage(image, SyncInfo.CHANGE
                | SyncInfo.CONFLICTING);
          }

          int imageKind = 0;
          switch (message.getKind()) {
          case IResourceDelta.ADDED:
            imageKind = (imageKind & ~SyncInfo.CHANGE)
                | SyncInfo.DELETION;
            break;
          case IResourceDelta.CHANGED:
            imageKind = (imageKind & ~SyncInfo.CHANGE)
                | SyncInfo.CHANGE;
            break;
          case IResourceDelta.REMOVED:
            imageKind = (imageKind & ~SyncInfo.CHANGE)
                | SyncInfo.ADDITION;
            break;
          default:
            return null;
          }
          return config.getImage(image, imageKind);
        }
      }
    });

    TreeViewerColumn pathColumn = new TreeViewerColumn(viewer, SWT.LEAD);
    pathColumn.getColumn().setText("Path");
    pathColumn.getColumn().setWidth(200);
    pathColumn.setLabelProvider(new ColumnLabelProvider() {
      public String getText(Object element) {
        if (element instanceof BatchModelChange) {
          return null;
        } else {
          return ((ResourceChangeMessage) element).getPath();
        }
      }
    });

    TreeViewerColumn typeColumn = new TreeViewerColumn(viewer, SWT.LEAD);
    typeColumn.getColumn().setText("Type");
    typeColumn.getColumn().setWidth(75);
    typeColumn.setLabelProvider(new ColumnLabelProvider() {
      public String getText(Object element) {
        if (element instanceof BatchModelChange) {
          return null;
        } else {
          switch (((ResourceChangeMessage) element).getKind()) {
          case IResourceDelta.ADDED:
            return "Added";
          case IResourceDelta.CHANGED:
            return "Changed";
          case IResourceDelta.REMOVED:
            return "Removed";
          default:
            return null;
          }
        }
      }
    });

    TreeViewerColumn resolutionColumn = new TreeViewerColumn(viewer,
        SWT.LEAD);
    resolutionColumn.getColumn().setText("Resolution");
    resolutionColumn.getColumn().setWidth(100);
    resolutionColumn.setLabelProvider(new ColumnLabelProvider() {
      public String getText(Object element) {
        if (element instanceof BatchModelChange) {
          return null;
        } else {
          return ((ResourceChangeMessage) element).isIgnored() ? "Ignored"
View Full Code Here

    TableViewerColumn nameColumn = new TableViewerColumn(tableViewer, SWT.FILL);
    TableColumn swtNameColumn = nameColumn.getColumn();
    swtNameColumn.setText("name");
    swtNameColumn.setWidth(50);
    nameColumn.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        org.springframework.ide.eclipse.wizard.template.util.NameUrlPair nameUrlPair = (NameUrlPair) element;
        return nameUrlPair.getName();
      }
    });

    nameColumn.getColumn().addSelectionListener(new SelectionListener() {
      public void widgetSelected(SelectionEvent e) {
        tableViewer.setSorter(new NameUrlViewerSorter(true));
        removeButton.setEnabled(false);
        editButton.setEnabled(false);
      }

      public void widgetDefaultSelected(SelectionEvent e) {
        widgetSelected(e);
      }
    });

    TableViewerColumn urlColumn = new TableViewerColumn(tableViewer, SWT.FILL);
    urlColumn.getColumn().setText("URL");
    urlColumn.getColumn().setWidth(160);

    urlColumn.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        org.springframework.ide.eclipse.wizard.template.util.NameUrlPair nameUrlPair = (NameUrlPair) element;
        return nameUrlPair.getUrlString();
      }
View Full Code Here

    listContainer.setLayout(new FillLayout());
   
    tradesTableViewer = new TableViewer(listContainer, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
   
    TableViewerColumn viewColDateTime = new TableViewerColumn(tradesTableViewer, SWT.NONE);
    viewColDateTime.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradeStatsPoint t = (ITradeStatsPoint) element;
        return sdf.format(t.getIndex());
      }
    });
    TableColumn columnDateTime = viewColDateTime.getColumn();
    columnDateTime.setText("Time");
    columnDateTime.setWidth(140);
    columnDateTime.setResizable(true);
   
    TableViewerColumn viewColSide = new TableViewerColumn(tradesTableViewer, SWT.NONE);
    viewColSide.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradeStatsPoint t = (ITradeStatsPoint) element;
        return t.getTrade().getOrder() != null ? t.getTrade().getOrder().getSide().name() : "";
      }
    });
    TableColumn columnSide = viewColSide.getColumn();
    columnSide.setText("Side");
    columnSide.setWidth(40);
    columnSide.setResizable(true);
   
    TableViewerColumn viewColSize = new TableViewerColumn(tradesTableViewer, SWT.NONE);
    viewColSize.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradeStatsPoint t = (ITradeStatsPoint) element;
        return t.getTrade().getOrder() != null ? Integer.toString(t.getTrade().getOrder().getAmount()) : "";
      }
    });
    TableColumn columnSize = viewColSize.getColumn();
    columnSize.setText("Size");
    columnSize.setWidth(40);
    columnSize.setResizable(true);
   
    TableViewerColumn viewColExPrice = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
    viewColExPrice.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradeStatsPoint t = (ITradeStatsPoint) element;
        return df.format(t.getTrade().getExecutionPrice());
      }
    });
    TableColumn columnExPrice = viewColExPrice.getColumn();
    columnExPrice.setText("Ex.Price");
    columnExPrice.setWidth(80);
    columnExPrice.setResizable(true);
   
    TableViewerColumn viewColAvgPrice = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
    viewColAvgPrice.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradeStatsPoint t = (ITradeStatsPoint) element;
        return df.format(t.getTrade().getAveragePrice());
      }
    });
    TableColumn columnAvgPrice = viewColAvgPrice.getColumn();
    columnAvgPrice.setText("Avg.Price");
    columnAvgPrice.setWidth(80);
    columnAvgPrice.setResizable(true);
   
    TableViewerColumn viewColTradePnl = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
    viewColTradePnl.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradeStatsPoint t = (ITradeStatsPoint) element;
        return df.format(t.getTradePnl());
      }
    });
    TableColumn columnTradePnl = viewColTradePnl.getColumn();
    columnTradePnl.setText("Trade P&&L");
    columnTradePnl.setWidth(80);
    columnTradePnl.setResizable(true);
   
    TableViewerColumn viewColMaxFavExc = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
    viewColMaxFavExc.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradeStatsPoint t = (ITradeStatsPoint) element;
        return df.format(t.getMaxFavorableExcursion());
      }
    });
    TableColumn columnMaxFavExc = viewColMaxFavExc.getColumn();
    columnMaxFavExc.setText("Fav.Chg.");
    columnMaxFavExc.setWidth(80);
    columnMaxFavExc.setResizable(true);
   
    TableViewerColumn viewColMaxAdvExc = new TableViewerColumn(tradesTableViewer, SWT.RIGHT);
    viewColMaxAdvExc.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradeStatsPoint t = (ITradeStatsPoint) element;
        return df.format(t.getMaxAdverseExcursion());
      }
View Full Code Here

    calendarTab.setControl(calendarViewerContainer);
   
    calendarViewer = new TableViewer(calendarViewerContainer, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
   
    TableViewerColumn viewColName = new TableViewerColumn(calendarViewer, SWT.NONE);
    viewColName.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradingCalendar calendar = (ITradingCalendar) element;
        return calendar.getName();
     
    });
    TableColumn columnName = viewColName.getColumn();
    columnName.setText("Name");
    columnName.setWidth(150);
    columnName.setResizable(true);
   
    TableViewerColumn viewColDesc = new TableViewerColumn(calendarViewer, SWT.NONE);
    viewColDesc.setLabelProvider(new ColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        ITradingCalendar calendar = (ITradingCalendar) element;
        return calendar.getDescription();
     
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.ColumnLabelProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.