Search in sources :

Example 16 with PVItem

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

the class DataBrowserPropertySheetPage method updateTracesTabDetailPanel.

/**
 * Update the lower 'detail' section of the "Traces" tab
 *  based on the currently selected item
 */
private void updateTracesTabDetailPanel() {
    // Show PV or Formula Panel depending on selection
    final IStructuredSelection sel = (IStructuredSelection) trace_table.getSelection();
    if (sel.size() == 1) {
        final Object item = sel.getFirstElement();
        if (item instanceof PVItem) {
            formula_panel.setVisible(false);
            archive_panel.setVisible(true);
            archive_table.setInput(item);
            return;
        }
        if (item instanceof FormulaItem) {
            final FormulaItem formula = (FormulaItem) item;
            formula_txt.setText(formula.getExpression());
            archive_table.setInput(null);
            archive_panel.setVisible(false);
            formula_panel.setVisible(true);
            return;
        }
    }
    // else: Neither PV nor formula, or multiple items selected
    archive_table.setInput(null);
    archive_panel.setVisible(false);
    formula_panel.setVisible(false);
}
Also used : FormulaItem(org.csstudio.trends.databrowser3.model.FormulaItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PVItem(org.csstudio.trends.databrowser3.model.PVItem)

Example 17 with PVItem

use of org.csstudio.trends.databrowser3.model.PVItem 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 PVItem

use of org.csstudio.trends.databrowser3.model.PVItem 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 PVItem

use of org.csstudio.trends.databrowser3.model.PVItem 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 PVItem

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

the class ControllerDemo method createModel.

private void createModel() throws Exception {
    model = new Model();
    model.setMacros(new TestMacros());
    ModelItem item;
    item = new PVItem("$(simu)", 1);
    item.setDisplayName("$(name)");
    item.setAxis(model.addAxis());
    model.addItem(item);
    item = new FormulaItem("math", "sine*0.5+2", new FormulaInput[] { new FormulaInput(item, "sine") });
    item = new PVItem("sim://ramp", 0);
    item.setDisplayName("Ramp (monitored)");
    item.setAxis(model.addAxis());
    model.addItem(item);
    final ArchiveDataSource archive = new ArchiveDataSource("jdbc:oracle:thin:sns_reports/sns@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=172.31.75.138)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=172.31.75.141)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ics_prod_lba)))", 1, "rdb");
    item = new PVItem("CCL_LLRF:IOC1:Load", 0);
    ((PVItem) item).addArchiveDataSource(archive);
    item.setDisplayName("CCL 1 CPU Load (monitored)");
    item.setAxis(model.addAxis());
    model.addItem(item);
    item = new PVItem("DTL_LLRF:IOC1:Load", 1.0);
    ((PVItem) item).addArchiveDataSource(archive);
    item.setDisplayName("DTL 1 CPU Load (1 sec)");
    item.setAxis(model.addAxis());
    model.addItem(item);
    item = new FormulaItem("calc", "dtl-10", new FormulaInput[] { new FormulaInput(item, "dtl") });
    item.setDisplayName("Lessened Load");
    item.setAxis(model.getAxis(2));
    model.addItem(item);
}
Also used : FormulaItem(org.csstudio.trends.databrowser3.model.FormulaItem) Model(org.csstudio.trends.databrowser3.model.Model) ModelItem(org.csstudio.trends.databrowser3.model.ModelItem) FormulaInput(org.csstudio.trends.databrowser3.model.FormulaInput) ArchiveDataSource(org.csstudio.trends.databrowser3.model.ArchiveDataSource) PVItem(org.csstudio.trends.databrowser3.model.PVItem)

Aggregations

PVItem (org.csstudio.trends.databrowser3.model.PVItem)19 ModelItem (org.csstudio.trends.databrowser3.model.ModelItem)7 ArchiveDataSource (org.csstudio.trends.databrowser3.model.ArchiveDataSource)6 ArrayList (java.util.ArrayList)5 AxisConfig (org.csstudio.trends.databrowser3.model.AxisConfig)4 Model (org.csstudio.trends.databrowser3.model.Model)4 Instant (java.time.Instant)3 FormulaItem (org.csstudio.trends.databrowser3.model.FormulaItem)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 Shell (org.eclipse.swt.widgets.Shell)3 TestProperties (org.csstudio.apputil.test.TestProperties)2 TraceType (org.csstudio.javafx.rtplot.TraceType)2 FormulaInput (org.csstudio.trends.databrowser3.model.FormulaInput)2 PlotSample (org.csstudio.trends.databrowser3.model.PlotSample)2 RequestType (org.csstudio.trends.databrowser3.model.RequestType)2 XMLPersistence (org.csstudio.trends.databrowser3.persistence.XMLPersistence)2 Test (org.junit.Test)2 InputStream (java.io.InputStream)1 List (java.util.List)1 Optional (java.util.Optional)1