Exemplo n.º 1
0
 /** 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;
     }
   }
 }
Exemplo n.º 2
0
 @Override
 public boolean onAdvance() {
   Configuration config = app.getConfig();
   if (config.isLocal) return true;
   else if (panel.kbSource.isValid() && panel.kbTarget.isValid()) {
     // Proceed
     KBInfo source = panel.kbSource.getKBInfo();
     source.var = "?src";
     KBInfo target = panel.kbTarget.getKBInfo();
     target.var = "?dest";
     config.setSource(source);
     config.setTarget(target);
     // panel.getWindow().showNotification(source + "\n\n" + target);
     return true;
   }
   return false;
 }
Exemplo n.º 3
0
 /** Checks whether the Buttons (selfconfig, learning and startMapping) could be activated. */
 public boolean checkButtons() {
   if ((SAIMApplication) getApplication() != null) {
     Configuration config = ((SAIMApplication) getApplication()).getConfig();
     if (config.getSource() != null
         && config.getSource().properties != null
         && config.getSource().properties.size() > 0
         && config.getTarget() != null
         && config.getTarget().properties != null
         && config.getTarget().properties.size() > 0) {
       selfConfigButton.setEnabled(true);
       //				if(config.getMetricExpression() != null && config.getMetricExpression().length()>0) {
       learnButton.setEnabled(true);
       startMapping.setEnabled(true);
       return true;
       //				}
     }
   }
   return false;
 }
Exemplo n.º 4
0
    @Override
    public void layoutClick(LayoutClickEvent event) {
      // its left button
      if (event.getButtonName().equalsIgnoreCase("left")
          && event.getClickedComponent() instanceof Label) { // $NON-NLS-1$
        String labelValue = ((Label) event.getClickedComponent()).getValue().toString();

        switch (shape) {
          case SOURCE:
            {
              String pref = config.getSource().var.replaceAll("\\?", ""); // $NON-NLS-1$
              saimcytoprocess.addNode(
                  pref + "." + labelValue, SAIMCytoprocess.NODE_TYPE.SOURCE); // $NON-NLS-1$
              break;
            }
          case TARGET:
            {
              String pref = config.getTarget().var.replaceAll("\\?", ""); // $NON-NLS-1$
              saimcytoprocess.addNode(
                  pref + "." + labelValue, SAIMCytoprocess.NODE_TYPE.TARGET); // $NON-NLS-1$
              break;
            }
          case OPERATOR:
            double t1 =
                Double.parseDouble(
                    SAIMCytoprocessProperties.getProperty(
                        SAIMCytoprocessProperties.OPERATOR_DEFAULT_THRESHOLD_1));
            double t2 =
                Double.parseDouble(
                    SAIMCytoprocessProperties.getProperty(
                        SAIMCytoprocessProperties.OPERATOR_DEFAULT_THRESHOLD_2));
            saimcytoprocess.addNode(labelValue, SAIMCytoprocess.NODE_TYPE.OPERATOR, t1, t2);
            break;

          case MEASURE:
            saimcytoprocess.addNode(labelValue, SAIMCytoprocess.NODE_TYPE.MEASURE);
        }
        // repaint
        saimcytoprocess.repaintGraph();
      }
    }
Exemplo n.º 5
0
  private void getAllProps() {
    sourceProps = new TreeSet<String>();
    targetProps = new TreeSet<String>();
    //		Configuration config = Configuration.getInstance();
    //		if(config.isLocal) {
    //			logger.info("Local data - using specified properties");
    if (config != null)
      if (config.getSource() != null
          && config.getSource().properties != null
          && config.getSource().properties.size() > 0
          && config.getTarget() != null
          && config.getTarget().properties != null
          && config.getTarget().properties.size() > 0) {
        for (String prop : config.getSource().properties) {
          if (prop.trim().length() > 0) {
            String s_abr = PrefixHelper.abbreviate(prop);
            if (!sourceProps.contains(s_abr)) sourceProps.add(s_abr);
          }
        }

        for (String prop : config.getTarget().properties) {
          if (prop.trim().length() > 0) {
            String s_abr = PrefixHelper.abbreviate(prop);
            if (!targetProps.contains(s_abr)) targetProps.add(s_abr);
          }
        }
        selfConfigButton.setEnabled(true);
      }
  }