Examples of ModelGraph


Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

    public void actionPerformed(ActionEvent e) {
      this.createNewGraph(e.getActionCommand());
    }

    private void createNewGraph(String actionCommand) {
      ModelGraph newGraph = null;
      if (actionCommand.equals(NEW_TASK_ITEM_NAME)) {
        newGraph = new ModelGraph(new ModelNode(state.getFile(),
            GuiUtils.createUniqueName()));
      } else if (actionCommand.equals(NEW_PARALLEL_ITEM_NAME)) {
        ModelNode node = new ModelNode(state.getFile(),
            GuiUtils.createUniqueName());
        node.setExecutionType("parallel");
        newGraph = new ModelGraph(node);
      } else if (actionCommand.equals(NEW_SEQUENTIAL_ITEM_NAME)) {
        ModelNode node = new ModelNode(state.getFile(),
            GuiUtils.createUniqueName());
        node.setExecutionType("sequential");
        newGraph = new ModelGraph(node);
      } else {
        return;
      }
      Object cell = GraphView.this.jgraph.getSelectionCell();
      if (cell != null) {
        if (cell instanceof DefaultGraphCell) {
          ModelGraph graph = GuiUtils.find(state.getGraphs(),
              ((ModelNode) ((DefaultGraphCell) cell).getUserObject()).getId());
          if (graph != null)
            graph.addChild(newGraph);
        }
      } else {
        state.addGraph(newGraph);
        GraphView.this.setShift(state, newGraph, curPoint);
      }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

    this.setLayout(new BorderLayout());
  }

  private JTable createTable(final ViewState state) {
    JTable table = null;
    final ModelGraph selected = state.getSelected();
    if (selected != null) {
      final Vector<Vector<String>> rows = new Vector<Vector<String>>();
      HashMap<String, String> keyToGroupMap = new HashMap<String, String>();
      Metadata staticMet = selected.getModel().getStaticMetadata();
      Metadata inheritedMet = selected.getInheritedStaticMetadata(state);
      Metadata completeMet = new Metadata();
      if (staticMet != null) {
        completeMet.replaceMetadata(staticMet.getSubMetadata(state
            .getCurrentMetGroup()));
      }
      if (selected.getModel().getExtendsConfig() != null) {
        for (String configGroup : selected.getModel().getExtendsConfig()) {
          Metadata extendsMetadata = state.getGlobalConfigGroups()
              .get(configGroup).getMetadata()
              .getSubMetadata(state.getCurrentMetGroup());
          for (String key : extendsMetadata.getAllKeys()) {
            if (!completeMet.containsKey(key)) {
              keyToGroupMap.put(key, configGroup);
              completeMet.replaceMetadata(key,
                  extendsMetadata.getAllMetadata(key));
            }
          }
        }
      }
      if (inheritedMet != null) {
        Metadata inheritedMetadata = inheritedMet.getSubMetadata(state
            .getCurrentMetGroup());
        for (String key : inheritedMetadata.getAllKeys()) {
          if (!completeMet.containsKey(key)) {
            keyToGroupMap.put(key, "__inherited__");
            completeMet.replaceMetadata(key,
                inheritedMetadata.getAllMetadata(key));
          }
        }
      }
      List<String> keys = completeMet.getAllKeys();
      Collections.sort(keys);
      for (String key : keys) {
        if (key.endsWith("/envReplace"))
          continue;
        String values = StringUtils.join(completeMet.getAllMetadata(key), ",");
        Vector<String> row = new Vector<String>();
        row.add(keyToGroupMap.get(key));
        row.add(key);
        row.add(values);
        row.add(Boolean.toString(Boolean.parseBoolean(completeMet
            .getMetadata(key + "/envReplace"))));
        rows.add(row);
      }
      table = new JTable();// rows, new Vector<String>(Arrays.asList(new
                           // String[] { "key", "values", "envReplace" })));
      table.setModel(new AbstractTableModel() {
        public String getColumnName(int col) {
          switch (col) {
          case 0:
            return "group";
          case 1:
            return "key";
          case 2:
            return "values";
          case 3:
            return "envReplace";
          default:
            return null;
          }
        }

        public int getRowCount() {
          return rows.size() + 1;
        }

        public int getColumnCount() {
          return 4;
        }

        public Object getValueAt(int row, int col) {
          if (row >= rows.size())
            return null;
          String value = rows.get(row).get(col);
          if (value == null && col == 3)
            return "false";
          if (value == null && col == 0)
            return "__local__";
          return value;
        }

        public boolean isCellEditable(int row, int col) {
          if (row >= rows.size()) {
            if (selected.getModel().getStaticMetadata()
                .containsGroup(state.getCurrentMetGroup()))
              return true;
            else
              return false;
          }
          if (col == 0)
            return false;
          String key = rows.get(row).get(1);
          if (key == null
              || (selected.getModel().getStaticMetadata() != null && selected
                  .getModel().getStaticMetadata()
                  .containsKey(getKey(key, state))))
            return true;
          return false;
        }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

    this.mode = state.mode;
  }

  public ViewState clone() {
    List<ModelGraph> cloneGraphs = null;
    ModelGraph selected = null;
    if (this.graphs != null) {
      cloneGraphs = new Vector<ModelGraph>();
      for (ModelGraph graph : this.graphs)
        cloneGraphs.add(graph.clone());
      if (this.selected != null)
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

      this.refresh();
    } else if (change instanceof ViewChange.VIEW_MODEL) {
      String modelId = ((ViewChange.VIEW_MODEL) change).getObject();
      for (ViewState state : this.stateViews.keySet()) {
        for (ModelGraph graph : state.getGraphs()) {
          ModelGraph found = graph.recursiveFindByModelId(modelId);
          if (found != null && !found.getModel().isRef()) {
            this.activeState = state;
            this.activeState.setSelected(found);
            break;
          }
        }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

      if (this.getActiveView() != null) {
        ViewState viewState = null;
        if (this.state.getSelected() != null && findSelectedInTab) {
          TOP: for (Entry<View, ViewState> entry : this.mainViews.entrySet()) {
            for (ModelGraph graph : entry.getValue().getGraphs()) {
              ModelGraph found = graph.recursiveFindByModelId(this.state
                  .getSelected().getModel().getModelId());
              if (found != null && !found.getModel().isRef()) {
                viewState = entry.getValue();
                viewState.setSelected(found);
                this.tabbedPane.setSelectedComponent(entry.getKey());
                break TOP;
              }
View Full Code Here

Examples of org.openengsb.core.ekb.api.ModelGraph

public class Activator implements BundleActivator {
    private BundleTracker tracker;

    @Override
    public void start(BundleContext context) throws Exception {
        ModelGraph graph = context.getService(context.getServiceReference(ModelGraph.class));
        ModelRegistryService service = new ModelRegistryService(context);
        service.setGraphDb(graph);
        service.setEkbClassLoader(new EKBClassLoaderService(context));
        tracker = service;
        tracker.open();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.