Package com.quantcomponents.core.calendar

Examples of com.quantcomponents.core.calendar.ITradingCalendar


   
    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();
     
    });
    TableColumn columnDesc = viewColDesc.getColumn();
    columnDesc.setText("Description");
    columnDesc.setWidth(200);
    columnDesc.setResizable(true);
   
    Table table = calendarViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
   
    calendarViewer.setContentProvider(new ArrayContentProvider());
    calendarViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      @Override
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        if (selection != null) {
          Object firstElement = selection.getFirstElement();
          if (firstElement != null && firstElement instanceof ITradingCalendar) {
            tradingCalendar = (ITradingCalendar) firstElement;
          }
        }
      }});
    calendarViewer.setInput(tradingCalendars);
    String currentCaledarName = chartModel.getTradingCalendar().getName();
    for (int i = 0; i < tradingCalendars.size(); i++) {
      ITradingCalendar calendar = tradingCalendars.get(i);
      if (calendar != null && calendar.getName().equals(currentCaledarName)) {
        table.setSelection(i);
        break;
      }
    }
    return tabFolder;
View Full Code Here


  }
 
  private void setupFromStockDatabase() {
    timeSeries = stockDatabase.getVirtualTimeSeries();
    List<ITradingCalendar> tradingCalendars = tradingCalendarManager.findTradingCalendars(timeSeries.getContract(), timeSeries.isIncludeAfterHours());
    ITradingCalendar tradingCalendar = tradingCalendars.get(0);
    chartModel = new TimeSeriesChartModel<IOHLCPoint>(timeSeries, tradingCalendar);
    chartModel.addListener(this);
    chartModel.setFixedDurationWindow(DEFAULT_INITIAL_NUMBER_OF_BARS, tradingCalendar);
    chart.setSeries(chartModel.data());
    chart.setTradingCalendar(tradingCalendar);
View Full Code Here

TOP

Related Classes of com.quantcomponents.core.calendar.ITradingCalendar

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.