Package org.aiotrade.lib.securities.dataserver

Examples of org.aiotrade.lib.securities.dataserver.QuoteContract


        while (quoteServers.hasNext()) {
            servers.add(quoteServers.next());
        }
        dataSourceComboBox.setModel(new DefaultComboBoxModel(servers.toArray()));

        QuoteContract quoteContractTemplate = isNewSymbol
                ? UserOptionsManager.currentPreferredQuoteContract()
                : quoteContract;
        if (quoteContractTemplate == null) {
            /** no currentPreferredQuoteContract */
            quoteContractTemplate = quoteContract;
        }
        QuoteServer quoteServerTemplate = quoteContractTemplate.lookupServiceTemplate(QuoteServer.class, "DataServers").get();

        dataSourceComboBox.setSelectedItem(quoteServerTemplate);

        timeUnitField.setModel(new DefaultComboBoxModel(TUnit.values()));
        timeUnitField.setSelectedItem(quoteContractTemplate.freq().unit());
        unitTimesField.setValue(quoteContractTemplate.freq().nUnits());

        refreshable.setSelected(quoteContractTemplate.isRefreshable());
        refreshInterval.setValue(quoteContractTemplate.refreshInterval());

        pathField.setText(quoteContractTemplate.urlString());
        stockSymbolsField.setText(quoteContractTemplate.srcSymbol());
       
        Calendar cal = Calendar.getInstance();
        toDateField.setValue(cal.getTime());
        cal.setTimeInMillis(quoteContractTemplate.fromTime());
        fromDateField.setValue(cal.getTime());
        DateFormat format = DateFormat.getDateInstance(DateFormat.DEFAULT);
        if (format instanceof SimpleDateFormat) {
            String pattern = new StringBuffer("(").append(((SimpleDateFormat) format).toPattern()).append(")").toString();

            jLabel6.setText(pattern);
            jLabel7.setText(pattern);
        }

        String dfPattern = "";
        if (quoteContractTemplate.datePattern().isDefined()) {
            dfPattern = quoteContractTemplate.datePattern().get();
        }
        formatStringField.setText(dfPattern);
        SimpleDateFormat sdf = new SimpleDateFormat(dfPattern, Locale.US);
        dateFormatSample.setText(sdf.format(sampleDate));

View Full Code Here


    private boolean previewPanelInited = false;

    public void initPreviewPanel() {
        String symbol = "Preview";

        QuoteContract quoteContract = new QuoteContract();
        QuoteServer previewQuoteServer = null;
        scala.collection.Iterator<QuoteServer> quoteServers = PersistenceManager$.MODULE$.apply().lookupAllRegisteredServices(QuoteServer.class, "QuoteServices").iterator();
        while (quoteServers.hasNext()) {
            QuoteServer quoteServer = quoteServers.next();
            if (quoteServer.displayName().toUpperCase().contains("CSV ASCII FILE")) {
                previewQuoteServer = quoteServer;
                break;
            }
        }
        if (previewQuoteServer == null) {
            return;
        }
        quoteContract.active_$eq(true);
        quoteContract.serviceClassName_$eq(previewQuoteServer.getClass().getName());
        quoteContract.srcSymbol_$eq(symbol);
        quoteContract.datePattern_$eq(Option.apply(previewQuoteServer.defaultDatePattern()));

        FileObject previewFile = FileUtil.getConfigFile("UserOptions/Template/preview.csv");
        if (previewFile != null) {
            try {
                InputStream is = previewFile.getInputStream();
                //quoteContract.inputStream_$eq(new scala.Some(is));
            } catch (Exception ex) {
                ErrorManager.getDefault().notify(ex);
            }
        }

        Sec sec = new Sec();
        SecInfo info = new SecInfo();
        info.uniSymbol_$eq(symbol);
        sec.secInfo_$eq(info);
        Content content = sec.content();
        content.addDescriptor(quoteContract);
        QuoteSer ser = sec.serOf(quoteContract.freq()).get();
        if (!ser.isLoaded()) {
            sec.loadSer(ser);
        }

        ChartingController controller = ChartingController$.MODULE$.apply(sec, sec.serOf(quoteContract.freq()).get());
        previewContainer = controller.createChartViewContainer(AnalysisChartViewContainer.class, this);

        previewPanel.setLayout(new BorderLayout());
        previewPanel.add(previewContainer, BorderLayout.CENTER);
View Full Code Here

TOP

Related Classes of org.aiotrade.lib.securities.dataserver.QuoteContract

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.