/** * Update the dialog contents. * * @param jheader The job portion of the dialog header. * @param job The queue job. * @param info The current job status information. */ public void updateContents( String jheader, QueueJob job, QueueJobInfo info, SubProcessExecDetails details) { ActionAgenda agenda = job.getActionAgenda(); QueueJobResults results = info.getResults(); String dir = "-"; if ((agenda != null) && (info.getOsType() != null)) dir = agenda.getTargetPath(info.getOsType()).toString(); String hostname = ""; if (info.getHostname() != null) hostname = (" [" + info.getHostname() + "]"); String command = "-"; if (details != null) command = details.getCommand(); TreeMap<String, String> env = new TreeMap<String, String>(); if (details != null) env = details.getEnvironment(); setHeader("Execution Details -" + jheader + hostname); pWorkingDirField.setText(dir); BaseAction action = job.getAction(); pCommandLineLabel.setText( "Action Command: " + action.getName() + " (v" + action.getVersionID() + ")"); pCommandLineArea.setText(command); { Component comps[] = UIFactory.createTitledPanels(); { JPanel tpanel = (JPanel) comps[0]; JPanel vpanel = (JPanel) comps[1]; if (!env.isEmpty()) { String last = env.lastKey(); for (String key : env.keySet()) { String value = env.get(key); JTextField field = UIFactory.createTitledTextField(tpanel, key + ":", sTSize, vpanel, value, sVSize); field.setHorizontalAlignment(JLabel.LEFT); if (!key.equals(last)) UIFactory.addVerticalSpacer(tpanel, vpanel, 3); } } else { tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0))); vpanel.add(Box.createHorizontalGlue()); } } pEnvLabel.setText("Toolset Environment: " + agenda.getToolset()); pEnvScroll.setViewportView(comps[2]); } }
/** * 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
/** * 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
/** Construct a new dialog. */ public JExecDetailsDialog() { super("Execution Details"); /* create dialog body components */ { JPanel body = new JPanel(); body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS)); { JPanel panel = new JPanel(); panel.setName("MainDialogPanel"); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); /* working directory */ { panel.add(UIFactory.createPanelLabel("Working Directory:")); panel.add(Box.createRigidArea(new Dimension(0, 4))); JTextField field = UIFactory.createTextField(null, 100, JLabel.LEFT); pWorkingDirField = field; panel.add(field); } body.add(panel); } { JPanel panel = new JPanel(); panel.setName("HorizontalBar"); Dimension size = new Dimension(100, 7); panel.setPreferredSize(size); panel.setMinimumSize(size); panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 7)); body.add(panel); } /* command line */ JPanel above = new JPanel(); { above.setName("MainDialogPanel"); above.setLayout(new BoxLayout(above, BoxLayout.Y_AXIS)); { Box hbox = new Box(BoxLayout.X_AXIS); hbox.add(Box.createRigidArea(new Dimension(4, 0))); { JLabel label = new JLabel("X"); pCommandLineLabel = label; label.setName("PanelLabel"); hbox.add(label); } hbox.add(Box.createHorizontalGlue()); above.add(hbox); } above.add(Box.createRigidArea(new Dimension(0, 4))); { JTextArea area = new JTextArea(null, 5, 70); pCommandLineArea = area; area.setName("CodeTextArea"); area.setLineWrap(true); area.setWrapStyleWord(true); area.setEditable(false); } { JScrollPane scroll = UIFactory.createScrollPane( pCommandLineArea, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, new Dimension(100, 27), null, null); above.add(scroll); } } /* environment */ JPanel below = new JPanel(); { below.setName("MainDialogPanel"); below.setLayout(new BoxLayout(below, BoxLayout.Y_AXIS)); { Box hbox = new Box(BoxLayout.X_AXIS); hbox.add(Box.createRigidArea(new Dimension(4, 0))); { JLabel label = new JLabel("X"); pEnvLabel = label; label.setName("PanelLabel"); hbox.add(label); } hbox.add(Box.createHorizontalGlue()); below.add(hbox); } below.add(Box.createRigidArea(new Dimension(0, 4))); Component comps[] = UIFactory.createTitledPanels(); { JPanel tpanel = (JPanel) comps[0]; JPanel vpanel = (JPanel) comps[1]; tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0))); vpanel.add(Box.createHorizontalGlue()); } { pEnvScroll = UIFactory.createScrollPane( comps[2], ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, new Dimension(100, 50), new Dimension(100, 300), null); below.add(pEnvScroll); } } { JVertSplitPanel split = new JVertSplitPanel(above, below); split.setResizeWeight(0.0); split.setAlignmentX(0.5f); body.add(split); } super.initUI("X", body, null, null, null, "Close", null); } }