Search in sources :

Example 16 with ArchiveDataSource

use of org.csstudio.trends.databrowser3.model.ArchiveDataSource in project org.csstudio.display.builder by kasemir.

the class ArchivesTableHandler method createColumns.

/**
 * Create table columns: Auto-sizable, with label provider and editor
 *  @param table_layout
 *  @param operations_manager
 *  @param archives_table
 */
public void createColumns(TableColumnLayout table_layout, final UndoableActionManager operations_manager, final TableViewer archives_table) {
    table_viewer = archives_table;
    TableViewerColumn col;
    // Archive Name Column ----------
    col = TableHelper.createColumn(table_layout, archives_table, Messages.ArchiveName, 100, 20);
    col.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(final ViewerCell cell) {
            final ArchiveDataSource archive = (ArchiveDataSource) cell.getElement();
            cell.setText(archive.getName());
        }
    });
    // Archive Key Column ----------
    col = TableHelper.createColumn(table_layout, archives_table, Messages.ArchiveKey, 20, 5);
    col.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(final ViewerCell cell) {
            final ArchiveDataSource archive = (ArchiveDataSource) cell.getElement();
            cell.setText(Integer.toString(archive.getKey()));
        }
    });
    // Archive Server URL Column ----------
    col = TableHelper.createColumn(table_layout, archives_table, Messages.URL, 50, 100);
    col.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(final ViewerCell cell) {
            final ArchiveDataSource archive = (ArchiveDataSource) cell.getElement();
            cell.setText(archive.getUrl());
        }
    });
}
Also used : ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) ViewerCell(org.eclipse.jface.viewers.ViewerCell) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) CellLabelProvider(org.eclipse.jface.viewers.CellLabelProvider)

Example 17 with ArchiveDataSource

use of org.csstudio.trends.databrowser3.model.ArchiveDataSource in project org.csstudio.display.builder by kasemir.

the class ArchiveFetchJobTest method testMultipleArchives.

/**
 * Start ArchiveFetchJob for multiple data sources, one that fails, wait for its completion
 */
@Test(timeout = 60000)
public void testMultipleArchives() throws Exception {
    final TestProperties settings = new TestProperties();
    String url = settings.getString("archive_rdb_url");
    if (url == null) {
        System.out.println("Skipped");
        return;
    }
    item = new PVItem("DTL_LLRF:IOC1:Load", 1.0);
    // First URL is expected to fail
    item.addArchiveDataSource(new ArchiveDataSource("Broken_URL", 1, "failed_test"));
    // Second URL should return data
    item.addArchiveDataSource(new ArchiveDataSource(url, 1, "test"));
    runFetchJob();
}
Also used : TestProperties(org.csstudio.apputil.test.TestProperties) ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) PVItem(org.csstudio.trends.databrowser3.model.PVItem) Test(org.junit.Test)

Example 18 with ArchiveDataSource

use of org.csstudio.trends.databrowser3.model.ArchiveDataSource in project org.csstudio.display.builder by kasemir.

the class ArchiveFetchJobTest method testArchiveFetchJob.

/**
 * Start ArchiveFetchJob, wait for its completion
 */
@Test(timeout = 60000)
public void testArchiveFetchJob() throws Exception {
    final TestProperties settings = new TestProperties();
    String url = settings.getString("archive_rdb_url");
    if (url == null) {
        System.out.println("Skipped");
        return;
    }
    item = new PVItem("DTL_LLRF:IOC1:Load", 1.0);
    item.addArchiveDataSource(new ArchiveDataSource(url, 1, "test"));
    runFetchJob();
}
Also used : TestProperties(org.csstudio.apputil.test.TestProperties) ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) PVItem(org.csstudio.trends.databrowser3.model.PVItem) Test(org.junit.Test)

Example 19 with ArchiveDataSource

use of org.csstudio.trends.databrowser3.model.ArchiveDataSource in project org.csstudio.display.builder by kasemir.

the class ExportTest method createPVItem.

/**
 * @return PV with some archive data source
 */
private PVItem createPVItem(final String name) throws Exception {
    final PVItem item = new PVItem(name, 1.0);
    item.addArchiveDataSource(new ArchiveDataSource(URL, KEY, "test"));
    return item;
}
Also used : ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) PVItem(org.csstudio.trends.databrowser3.model.PVItem)

Example 20 with ArchiveDataSource

use of org.csstudio.trends.databrowser3.model.ArchiveDataSource in project org.csstudio.display.builder by kasemir.

the class AddArchiveDialogDemo method demoArchiveGUI.

public void demoArchiveGUI() throws Exception {
    final Shell shell = new Shell();
    final AddArchiveDialog dlg = new AddArchiveDialog(shell);
    if (dlg.open() == Window.OK)
        for (ArchiveDataSource arch : dlg.getArchives()) System.out.println(arch);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource)

Aggregations

ArchiveDataSource (org.csstudio.trends.databrowser3.model.ArchiveDataSource)17 PVItem (org.csstudio.trends.databrowser3.model.PVItem)8 ArrayList (java.util.ArrayList)6 ChannelInfo (org.csstudio.trends.databrowser3.model.ChannelInfo)4 TestProperties (org.csstudio.apputil.test.TestProperties)3 Test (org.junit.Test)3 ArchiveReader (org.csstudio.archive.reader.ArchiveReader)2 AxisConfig (org.csstudio.trends.databrowser3.model.AxisConfig)2 FormulaItem (org.csstudio.trends.databrowser3.model.FormulaItem)2 ModelItem (org.csstudio.trends.databrowser3.model.ModelItem)2 AddAxisCommand (org.csstudio.trends.databrowser3.propsheet.AddAxisCommand)2 CellLabelProvider (org.eclipse.jface.viewers.CellLabelProvider)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)2 ViewerCell (org.eclipse.jface.viewers.ViewerCell)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 PartInitException (org.eclipse.ui.PartInitException)2 PrintWriter (java.io.PrintWriter)1