コード例 #1
0
ファイル: MetricPanel.java プロジェクト: AKSW/SAIM
  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);
      }
  }
コード例 #2
0
ファイル: MetricPanel.java プロジェクト: AKSW/SAIM
 /** 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;
 }
コード例 #3
0
ファイル: MetricPanel.java プロジェクト: AKSW/SAIM
    @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();
      }
    }