Ejemplo n.º 1
0
 public void actionPerformed(ActionEvent e) {
   String com = e.getActionCommand();
   if (com.equals("user")) {
     String user1 = userField.getSelected();
     String view1 = viewField.getSelected();
     viewField.setValues(areas.get(user1));
     if (areas.get(user1).contains(view1)) viewField.setSelected(view1);
     try {
       w = new Wrapper(user1, viewField.getSelected(), toolsetField.getSelected(), mclient);
     } catch (PipelineException e1) {
       e1.printStackTrace();
       System.exit(1);
     }
   } else if (com.equals("wrap")) {
     try {
       w =
           new Wrapper(
               userField.getSelected(),
               viewField.getSelected(),
               toolsetField.getSelected(),
               mclient);
     } catch (PipelineException e1) {
       e1.printStackTrace();
       System.exit(1);
     }
   } else if (com.equals("proj")) {
     project = projectField.getSelected();
   } else if (com.equals("add")) {
     list.add(assetChoiceBox());
     diag.validate();
   } else if (com.equals("type")) {
     JCollectionField eventSrc = (JCollectionField) e.getSource();
     Collection<String> curList = getCorrectList(eventSrc.getSelected());
     Box can = (Box) eventSrc.getParent();
     JCollectionField oldList = ((JCollectionField) can.getComponent(2));
     oldList.setValues(curList);
     JCollectionField newList = (JCollectionField) can.getComponent(4);
     newList.setValues(curList);
   }
 } // end actionPerformed
Ejemplo n.º 2
0
  /**
   * Draws the GUI that allows a user to select assets to be updated.
   *
   * @return true if the user made a valid choice of assets to replace.
   * @throws PipelineException
   */
  private boolean buildUpdateGUI() throws PipelineException {
    Box finalBox = new Box(BoxLayout.Y_AXIS);
    top = new Box(BoxLayout.Y_AXIS);

    JScrollPane scroll;

    {
      scroll = new JScrollPane(finalBox);

      scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
      scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

      Dimension size = new Dimension(sVSize + sVSize + sTSize + 52, 500);
      scroll.setMinimumSize(size);
      scroll.setPreferredSize(size);
      scroll.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
    }

    /* query the user */
    diag = new JToolDialog("Propagate Asset", scroll, "Continue");

    areas = mclient.getWorkingAreas();
    {
      Box hbox = new Box(BoxLayout.X_AXIS);
      Component comps[] = UIFactory.createTitledPanels();
      JPanel tpanel = (JPanel) comps[0];
      JPanel vpanel = (JPanel) comps[1];
      {
        userField =
            UIFactory.createTitledCollectionField(
                tpanel,
                "User:"******"The user whose area the node is being created in.");
        userField.setActionCommand("user");
        userField.setSelected(PackageInfo.sUser);
        userField.addActionListener(this);
      }
      UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
      {
        viewField =
            UIFactory.createTitledCollectionField(
                tpanel,
                "View:",
                sTSize,
                vpanel,
                areas.get(PackageInfo.sUser),
                diag,
                sVSize,
                "The working area to create the nodes in.");
        viewField.setActionCommand("wrap");
        viewField.addActionListener(this);
      }
      UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
      {
        toolsetField =
            UIFactory.createTitledCollectionField(
                tpanel,
                "Toolset:",
                sTSize,
                vpanel,
                mclient.getActiveToolsetNames(),
                diag,
                sVSize,
                "The toolset to set on all the nodes.");
        toolsetField.setSelected(mclient.getDefaultToolsetName());
        toolsetField.setActionCommand("wrap");
        toolsetField.addActionListener(this);
      }
      UIFactory.addVerticalSpacer(tpanel, vpanel, 3);

      w =
          new Wrapper(
              userField.getSelected(),
              viewField.getSelected(),
              toolsetField.getSelected(),
              mclient);

      charList = SonyConstants.getAssetList(w, project, AssetType.CHARACTER);
      setsList = SonyConstants.getAssetList(w, project, AssetType.SET);
      propsList = SonyConstants.getAssetList(w, project, AssetType.PROP);

      {
        projectField =
            UIFactory.createTitledCollectionField(
                tpanel,
                "Project:",
                sTSize,
                vpanel,
                Globals.getChildrenDirs(w, "/projects"),
                diag,
                sVSize,
                "All the projects in pipeline.");
        projectField.setActionCommand("proj");
        projectField.addActionListener(this);
      }
      hbox.add(comps[2]);
      top.add(hbox);
    }

    {
      Box vbox = new Box(BoxLayout.Y_AXIS);
      Box hbox = new Box(BoxLayout.X_AXIS);
      JButton button = new JButton("Propagate Additional Asset");
      button.setName("ValuePanelButton");
      button.setRolloverEnabled(false);
      button.setFocusable(false);
      Dimension d = new Dimension(sVSize, 25);
      button.setPreferredSize(d);
      button.setMinimumSize(d);
      button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 25));

      vbox.add(Box.createRigidArea(new Dimension(0, 5)));
      hbox.add(button);
      hbox.add(Box.createRigidArea(new Dimension(4, 0)));
      vbox.add(hbox);
      vbox.add(Box.createRigidArea(new Dimension(0, 5)));

      button.setActionCommand("add");
      button.addActionListener(this);

      top.add(vbox);
    }

    list = new Box(BoxLayout.Y_AXIS);
    test = new JDrawer("Propagate Additional Asset", list, false);

    top.add(test);
    list.add(assetChoiceBox());

    finalBox.add(top);

    {
      JPanel spanel = new JPanel();
      spanel.setName("Spacer");
      spanel.setMinimumSize(new Dimension(sTSize + sVSize, 7));
      spanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
      spanel.setPreferredSize(new Dimension(sTSize + sVSize, 7));
      finalBox.add(spanel);
    }

    diag.setVisible(true);
    if (diag.wasConfirmed()) {
      // get list of things to change.
      for (Component comp : list.getComponents()) {
        if (comp instanceof Box) {
          Box can = (Box) comp;
          JCollectionField oldOne = (JCollectionField) can.getComponent(2);
          JCollectionField newOne = (JCollectionField) can.getComponent(4);

          TreeMap<String, String> assetList = new TreeMap<String, String>();
          assetList.putAll(charList);
          assetList.putAll(propsList);
          assetList.putAll(setsList);

          String key = assetList.get(oldOne.getSelected()) + lr;
          String value = assetList.get(newOne.getSelected()) + lr;
          if (!key.equals(value)) {
            potentialUpdates.add(key);
            pAssetManager.put(key, new AssetInfo(key, value));
          }
          // System.err.println("bUG: "+pAssetManager.get(key).getHiLoResShots());
        }
      }

      if (!pAssetManager.isEmpty()) return true;
    }
    return false;
  } // end buildReplacementGUI
Ejemplo n.º 3
0
  /**
   * Present a GUI allowing the user to select shots in which each previously selected asset should
   * be updated.
   *
   * @return
   * @throws PipelineException
   */
  private String confirmShotsToUpdate() throws PipelineException {

    /* DO GUI DRAWING STUFF*/
    JScrollPane scroll = null;
    {
      Box ibox = new Box(BoxLayout.Y_AXIS);
      if (pAssetManager.isEmpty()) {
        Component comps[] = UIFactory.createTitledPanels();
        JPanel tpanel = (JPanel) comps[0];
        JPanel vpanel = (JPanel) comps[1];

        tpanel.add(Box.createRigidArea(new Dimension(sTSize - 7, 0)));
        vpanel.add(Box.createHorizontalGlue());

        ibox.add(comps[2]);
      } else {

        for (String assetName : pAssetManager.keySet()) {
          String name = getShortName(assetName);
          AssetInfo info = pAssetManager.get(assetName);

          Component comps[] = UIFactory.createTitledPanels();
          JPanel tpanel = (JPanel) comps[0];
          JPanel vpanel = (JPanel) comps[1];
          String title = "Replace " + name + " with ";
          title += getShortName(info.getNewAsset());

          JDrawer shotList = new JDrawer(title, (JComponent) comps[2], true);
          ibox.add(shotList);

          for (String shot : info.getLoHiResShots().keySet()) {

            String shortShot = getShortName(shot);
            JBooleanField field =
                UIFactory.createTitledBooleanField(
                    tpanel,
                    shortShot,
                    sVSize,
                    vpanel,
                    sTSize,
                    "Whether to replace this asset source for the node.");
            field.setName(shot);
            field.setValue(true);

            if (!pSubstituteFields.containsKey(assetName))
              pSubstituteFields.put(assetName, new LinkedList<JBooleanField>());

            pSubstituteFields.get(assetName).add(field);
            UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
          }
        }
      }

      {
        JPanel spanel = new JPanel();
        spanel.setName("Spacer");

        spanel.setMinimumSize(new Dimension(sTSize + sVSize, 7));
        spanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
        spanel.setPreferredSize(new Dimension(sTSize + sVSize, 7));

        ibox.add(spanel);
      }

      {
        scroll = new JScrollPane(ibox);
        scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        Dimension size = new Dimension(sTSize + sVSize + 52, 300);
        scroll.setMinimumSize(size);
        scroll.setPreferredSize(size);

        scroll.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
      }
    }

    /* query the user */
    JToolDialog diag = new JToolDialog("Update Assets Per Shot", scroll, "Confirm");
    diag.setVisible(true);

    /* Process User Input */
    if (diag.wasConfirmed()) {

      for (String asset : pSubstituteFields.keySet()) {
        for (JBooleanField field : pSubstituteFields.get(asset)) {
          Boolean bUpdate = field.getValue();
          if ((bUpdate == null) || !bUpdate) {
            pAssetManager.get(asset).getLoHiResShots().remove(field.getName());

            // logLine("\tRemoving: "+ getShortName(field.getName())
            // TODO		+" from list for "+ getShortName(asset));
          }
        }
      }
      return ": Modifying Nodes...";
    }
    return null;
  } // end confirmShotsToUpdate