/** Method to set Metric from the graph. */ public boolean setMetricFromGraph() { if (!saimcytopro.getMetric().isComplete()) { getApplication() .getMainWindow() .showNotification( messages.getString("MetricPanel.settingnotablenotcomplete")); // $NON-NLS-1$ return false; } else { Node node = saimcytopro.getMetric(); String expr = saimcytopro.getMetric().toString(); config.setMetricExpression(expr); System.out.println(node.param1 + " - " + node.param2); // $NON-NLS-1$ if (node.param1 != null && node.param2 != null) { config.setAcceptanceThreshold(node.param1); config.setVerificationThreshold(node.param2); getApplication() .getMainWindow() .showNotification( "Setting: " + expr + "with thresholds " + node.param1 + " / " + node.param2); //$NON-NLS-1$ return checkButtons(); } else { getApplication() .getMainWindow() .showNotification( messages.getString("MetricPanel.settingnotablenothreholds")); // $NON-NLS-1$ return false; } } }
/** * Creates the button is the lower window. * * @return */ public Layout getButtonLayout() { // setMetric = new Button(messages.getString("MetricPanel.setmetricbutton")); // setMetric.setEnabled(true); // setMetric.addListener(new ClickListener() { // /** // * // */ // private static final long serialVersionUID = 2349781868228639555L; // // @Override // public void buttonClick(ClickEvent event) { // setMetricFromGraph(); // } // }); selfConfigButton = new Button(messages.getString("MetricPanel.startselfconfigbutton")); // $NON-NLS-1$ selfConfigButton.setEnabled(false); selfConfigButton.addListener( new SelfConfigClickListener((SAIMApplication) getApplication(), messages)); learnButton = new Button(messages.getString("MetricPanel.learnmetricbutton")); // $NON-NLS-1$ learnButton.setEnabled(false); learnButton.addListener( new LearnClickListener((SAIMApplication) getApplication(), messages, this)); startMapping = new Button(messages.getString("MetricPanel.startmappingbutton")); // $NON-NLS-1$ startMapping.setEnabled(false); startMapping.addListener( new StartMappingListener((SAIMApplication) getApplication(), messages, this)); buttonLayout = new HorizontalLayout(); // buttonLayout.addComponent(setMetric); buttonLayout.addComponent(selfConfigButton); buttonLayout.addComponent(learnButton); buttonLayout.addComponent(startMapping); return buttonLayout; }
@Override public void attach() { if ((SAIMApplication) getApplication() != null) config = ((SAIMApplication) getApplication()).getConfig(); VerticalLayout mainLayout = new VerticalLayout(); final VerticalLayout accordionLayout = new VerticalLayout(); HorizontalLayout layout = new HorizontalLayout(); layout.addComponent(accordionLayout); setContent(mainLayout); mainLayout.addComponent(layout); final ProgressIndicator progress = new ProgressIndicator(); progress.setIndeterminate(false); accordionLayout.addComponent(progress); // buttons mainLayout.addComponent(getButtonLayout()); // accordion panel Panel accordionPanel = new Panel(); accordionLayout.addComponent(accordionPanel); final Accordion accordion = new Accordion(); accordionPanel.addComponent(accordion); accordionPanel.setStyleName("accordionPanel"); VerticalLayout metricsLayout, operatorsLayout; sourceLayout = new VerticalLayout(); targetLayout = new VerticalLayout(); metricsLayout = new VerticalLayout(); operatorsLayout = new VerticalLayout(); accordion.addTab( sourceLayout, messages.getString("MetricPanel.sourceproperties")); // $NON-NLS-1$ accordion.addTab( targetLayout, messages.getString("MetricPanel.targetproperties")); // $NON-NLS-1$ accordion.addTab(metricsLayout, messages.getString("MetricPanel.metrics")); // $NON-NLS-1$ accordion.addTab(operatorsLayout, messages.getString("MetricPanel.operators")); // $NON-NLS-1$ // add Cytographer saimcytopro = makeCytographer(); layout.addComponent(saimcytopro); getAllProps(); for (String s : sourceProps) { sourceLayout.addComponent(new Label(s)); } for (String t : targetProps) { targetLayout.addComponent(new Label(t)); } accordionLayout.removeComponent(progress); progress.setEnabled(false); // metricsLayout.addComponent( new Label(messages.getString("MetricPanel.0"))); // operatorsLayout.addComponent( new Label(messages.getString("MetricPanel.8"))); Set<String> sorted = new TreeSet<String>(); sorted.addAll(Measure.identifiers); for (String label : sorted) { metricsLayout.addComponent(new Label(label)); } sorted.clear(); sorted.addAll(Operator.identifiers); for (String label : sorted) { operatorsLayout.addComponent(new Label(label)); } sourceLayout.addListener( new AccordionLayoutClickListener(saimcytopro, SAIMCytoprocess.NODE_TYPE.SOURCE, config)); targetLayout.addListener( new AccordionLayoutClickListener(saimcytopro, SAIMCytoprocess.NODE_TYPE.TARGET, config)); metricsLayout.addListener( new AccordionLayoutClickListener(saimcytopro, SAIMCytoprocess.NODE_TYPE.MEASURE, config)); operatorsLayout.addListener( new AccordionLayoutClickListener(saimcytopro, SAIMCytoprocess.NODE_TYPE.OPERATOR, config)); checkButtons(); }
@Override public String getCaption() { return messages.getString("selectsparqlendpoints"); }