/** * 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
public GUI() { // Frame frame = new JFrame("HardwareSwap Notifier"); // Panels panel = new JPanel(); group1 = new JPanel(); group2 = new JPanel(); group3 = new JPanel(); group4 = new JPanel(); group5 = new JPanel(); group6 = new JPanel(); group7 = new JPanel(); group8 = new JPanel(); // Menu Bar menus = new JMenuBar(); fileMenu = new JMenu("File"); clearCurrent = new JMenuItem("Clear"); quitItem = new JMenuItem("Quit"); load = new JMenuItem("Load"); saveCurrent = new JMenuItem("Save All"); clearSaved = new JMenuItem("Clear Saved"); removeItem = new JMenuItem("Remove Item"); removePhone = new JMenuItem("Remove Phone"); saveCurrent = new JMenuItem("Save Current"); helpMenu = new JMenu("Help"); help = new JMenuItem("How To Use"); about = new JMenuItem("About"); // Buttons add1 = new JButton("Add"); add2 = new JButton("Add"); start = new JButton("Start"); stop = new JButton("Stop"); save1 = new JButton("Add/Save"); save2 = new JButton("Add/Save"); show = new JButton("Display Data"); add1.setFocusPainted(false); add2.setFocusPainted(false); start.setFocusPainted(false); stop.setFocusPainted(false); save1.setFocusPainted(false); save2.setFocusPainted(false); show.setFocusPainted(false); stop.setEnabled(false); // CheckBox remove = new JCheckBox("Remove items when found"); remove.setFocusable(false); // Listener ButtonListener listener = new ButtonListener(); add1.addActionListener(listener); add2.addActionListener(listener); start.addActionListener(listener); stop.addActionListener(listener); load.addActionListener(listener); save1.addActionListener(listener); save2.addActionListener(listener); saveCurrent.addActionListener(listener); show.addActionListener(listener); quitItem.addActionListener(listener); clearCurrent.addActionListener(listener); clearSaved.addActionListener(listener); saveCurrent.addActionListener(listener); help.addActionListener(listener); about.addActionListener(listener); removePhone.addActionListener(listener); removeItem.addActionListener(listener); remove.addActionListener(listener); // Carrier Selection options = new String[10]; options[0] = "AT&T"; options[1] = "Boost Mobile"; options[2] = "Cellular One"; options[3] = "Nextel"; options[4] = "T-Mobile"; options[5] = "Tracfone"; options[6] = "US Cellular"; options[7] = "Sprint"; options[8] = "Verizon"; options[9] = "Virgin Mobile"; carriers = new JComboBox<String>(options); // Text Fields searchName = new JTextField(15); item = new JTextField(15); phone = new JTextField(15); interval2 = new JTextField(15); results = new JTextArea(10, 20); JScrollPane scrollPane = new JScrollPane(results); results.setEditable(false); // Interval intOptions = new SpinnerNumberModel(5, 1, 60, 1); interval = new JSpinner(intOptions); JFormattedTextField tf = ((JSpinner.DefaultEditor) interval.getEditor()).getTextField(); tf.setHorizontalAlignment(JFormattedTextField.LEFT); // Background panelBackground = new Color(237, 237, 237); panel.setBackground(panelBackground); searchName.setBackground(panelBackground); item.setBackground(panelBackground); phone.setBackground(panelBackground); interval.setBackground(panelBackground); // Panel Layouts panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); group1.setLayout(new BoxLayout(group1, BoxLayout.PAGE_AXIS)); group2.setLayout(new BoxLayout(group2, BoxLayout.X_AXIS)); group3.setLayout(new BoxLayout(group3, BoxLayout.PAGE_AXIS)); group4.setLayout(new BoxLayout(group4, BoxLayout.X_AXIS)); group5.setLayout(new BoxLayout(group5, BoxLayout.X_AXIS)); group6.setLayout(new BoxLayout(group6, BoxLayout.X_AXIS)); group7.setLayout(new BoxLayout(group7, BoxLayout.X_AXIS)); group8.setLayout(new BoxLayout(group8, BoxLayout.X_AXIS)); // Borders searchName.setBorder( BorderFactory.createTitledBorder( null, "Search Name", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_JUSTIFICATION, null, Color.DARK_GRAY)); item.setBorder( BorderFactory.createTitledBorder( null, "Item", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_JUSTIFICATION, null, Color.DARK_GRAY)); phone.setBorder( BorderFactory.createTitledBorder( null, "Cell Phone", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_JUSTIFICATION, null, Color.DARK_GRAY)); group5.setBorder( BorderFactory.createTitledBorder( null, "Check Interval (mins)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_JUSTIFICATION, null, Color.DARK_GRAY)); // Sizes panel.setPreferredSize(new Dimension(200, 0)); searchName.setMaximumSize(new Dimension(190, 50)); item.setMaximumSize(new Dimension(190, 50)); phone.setMaximumSize(new Dimension(185, 50)); carriers.setMaximumSize(new Dimension(175, 20)); group5.setPreferredSize(new Dimension(190, 47)); group5.setMaximumSize(new Dimension(190, 47)); add1.setMaximumSize(new Dimension(90, 20)); save1.setMaximumSize(new Dimension(90, 20)); add2.setMaximumSize(new Dimension(90, 20)); save2.setMaximumSize(new Dimension(90, 20)); start.setMaximumSize(new Dimension(90, 20)); stop.setMaximumSize(new Dimension(90, 20)); show.setMaximumSize(new Dimension(120, 20)); // Add file menu items fileMenu.add(clearCurrent); fileMenu.add(clearSaved); fileMenu.add(load); fileMenu.add(removeItem); fileMenu.add(removePhone); fileMenu.add(saveCurrent); fileMenu.add(quitItem); // Add help menu items helpMenu.add(help); helpMenu.add(about); // Add to menu bar menus.add(fileMenu); menus.add(helpMenu); // Add items to panel group1.add(searchName); group1.add(item); group2.add(add1); group2.add(Box.createHorizontalStrut(10)); group2.add(save1); group6.add(remove); group3.add(phone); group3.add(Box.createVerticalStrut(10)); group3.add(carriers); group4.add(add2); group4.add(Box.createHorizontalStrut(10)); group4.add(save2); group5.add(interval); group7.add(show); group8.add(start); group8.add(Box.createHorizontalStrut(10)); group8.add(stop); panel.add(Box.createVerticalStrut(10)); panel.add(group1); panel.add(Box.createVerticalStrut(10)); panel.add(group2); panel.add(Box.createVerticalStrut(40)); panel.add(group3); panel.add(Box.createVerticalStrut(10)); panel.add(group4); panel.add(Box.createVerticalStrut(40)); panel.add(group5); panel.add(Box.createVerticalStrut(30)); panel.add(group6); panel.add(Box.createVerticalStrut(40)); panel.add(group7); panel.add(Box.createVerticalStrut(10)); panel.add(group8); panel.add(Box.createVerticalStrut(10)); // Setup frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setJMenuBar(menus); frame.add(scrollPane); frame.add(BorderLayout.EAST, panel); frame.pack(); frame.setSize(new Dimension(670, 620)); frame.setVisible(true); }
public SketchProperties(Editor e, Sketch s) { super(); editor = e; sketch = s; fields = new HashMap<String, JComponent>(); this.setPreferredSize(new Dimension(500, 400)); this.setMinimumSize(new Dimension(500, 400)); this.setMaximumSize(new Dimension(500, 400)); this.setSize(new Dimension(500, 400)); Point eLoc = editor.getLocation(); int x = eLoc.x; int y = eLoc.y; Dimension eSize = editor.getSize(); int w = eSize.width; int h = eSize.height; int cx = x + (w / 2); int cy = y + (h / 2); this.setLocation(new Point(cx - 250, cy - 200)); this.setModal(true); outer = new JPanel(new BorderLayout()); outer.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.add(outer); win = new JPanel(); win.setLayout(new BorderLayout()); outer.add(win, BorderLayout.CENTER); buttonBar = new JPanel(new FlowLayout(FlowLayout.RIGHT)); saveButton = new JButton("OK"); saveButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { save(); SketchProperties.this.dispose(); } }); cancelButton = new JButton("Cancel"); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { SketchProperties.this.dispose(); } }); buttonBar.add(saveButton); buttonBar.add(cancelButton); win.add(buttonBar, BorderLayout.SOUTH); tabs = new JTabbedPane(); overviewPane = new JPanel(); overviewPane.setLayout(new BoxLayout(overviewPane, BoxLayout.PAGE_AXIS)); overviewPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); addTextField(overviewPane, "author", "Sketch author:"); addTextArea(overviewPane, "summary", "Summary:"); addTextArea(overviewPane, "license", "Copyright / License:"); tabs.add("Overview", overviewPane); objectsPane = new JPanel(); objectsPane.setLayout(new BoxLayout(objectsPane, BoxLayout.PAGE_AXIS)); objectsPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); addTextField(objectsPane, "board", "Board:"); addTextField(objectsPane, "core", "Core:"); addTextField(objectsPane, "compiler", "Compiler:"); addTextField(objectsPane, "port", "Serial port:"); addTextField(objectsPane, "programmer", "Programmer:"); JButton setDef = new JButton("Set to current IDE values"); setDef.setMaximumSize(setDef.getPreferredSize()); setDef.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { setObjectValues(); } }); objectsPane.add(Box.createVerticalGlue()); objectsPane.add(setDef); tabs.add("Objects", objectsPane); win.add(tabs, BorderLayout.CENTER); this.setTitle("Sketch Properties"); this.pack(); this.setVisible(true); }
/** Initialize the common user interface components. */ private void initUI() { /* initialize fields */ { pFileSeqPanels = new TreeMap<FileSeq, JFileSeqPanel>(); } /* initialize the popup menus */ { initBasicMenus(true, false); updateMenuToolTips(); } /* initialize the panel components */ { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); /* header */ { pApplyToolTipText = "Replace the working area files with the selected checked-in files."; pUnApplyToolTipText = "There are no unsaved changes to Apply at this time."; JPanel panel = initHeader(true); add(panel); } add(Box.createRigidArea(new Dimension(0, 4))); /* full node name */ { LinkedList<Component> extra = new LinkedList<Component>(); extra.add(Box.createRigidArea(new Dimension(4, 0))); { JButton btn = new JButton(); pSeqLayoutButton = btn; btn.setName(pIsListLayout ? "ListLayoutButton" : "TabbedLayoutButton"); Dimension size = new Dimension(19, 19); btn.setMinimumSize(size); btn.setMaximumSize(size); btn.setPreferredSize(size); btn.setActionCommand("seq-layout-changed"); btn.addActionListener(this); extra.add(btn); } initNameField(this, extra); pNodeNameField.setFocusable(true); pNodeNameField.addKeyListener(this); pNodeNameField.addMouseListener(this); } add(Box.createRigidArea(new Dimension(0, 4))); { JTabbedPane tab = new JTabbedPane(); pFileSeqsTab = tab; tab.setVisible(!pIsListLayout); add(tab); } { Box vbox = new Box(BoxLayout.Y_AXIS); pFileSeqsBox = vbox; { JScrollPane scroll = UIFactory.createVertScrollPane(vbox); pFileSeqsScroll = scroll; scroll.setVisible(!pIsListLayout); add(scroll); } } Dimension size = new Dimension(sSize + 22, 120); setMinimumSize(size); setPreferredSize(size); setFocusable(true); addKeyListener(this); addMouseListener(this); } updateNodeStatus(null, null, null); }
private void initializeComponents() { this.setTitle("Synchro - Kopierassistent"); this.setBounds(0, 0, 550, 600); this.setResizable(true); this.setLayout(null); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(this); mainPanel = new JPanel(); mainPanel.setBounds(0, 0, this.getWidth() - 20, 25); // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); mainPanel.setLayout(null); btnBackup = new JButton("Backup"); btnBackup.setBounds(this.getWidth() / 2, 0, this.getWidth() / 2 - 20, mainPanel.getHeight()); btnBackup.addActionListener(this); mainPanel.add(btnBackup); this.add(mainPanel); fcPanel = new JPanel(); fcPanel.setBounds(10, 40, this.getWidth(), 260); // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); fcPanel.setLayout(null); quellLabel = new JLabel("Bitte Quellverzeichnis auswählen"); quellLabel.setBounds(10, 5, 320, 20); fcPanel.add(quellLabel); quellListModel = new DefaultListModel<>(); quellJList = new JList<ListItem>(quellListModel); quellJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); quellJList.setLayoutOrientation(JList.VERTICAL); quellJList.addListSelectionListener(this); listBoxScroller = new JScrollPane(quellJList); listBoxScroller.setBounds(0, 30, 315, 100); fcPanel.add(listBoxScroller); btnQAuswahl = new JButton("Quellverz. hinzufügen"); btnQAuswahl.setBounds(320, 30, 200, 25); btnQAuswahl.addActionListener(this); fcPanel.add(btnQAuswahl); btnQEntfernen = new JButton("Quellverz. entfernen"); btnQEntfernen.setBounds(320, 60, 200, 25); btnQEntfernen.addActionListener(this); fcPanel.add(btnQEntfernen); zielLabel = new JLabel("Bitte Zielverzeichnis auswählen"); zielLabel.setBounds(10, 135, 320, 20); fcPanel.add(zielLabel); zielListModel = new DefaultListModel<>(); zielJList = new JList<ListItem>(zielListModel); zielJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); zielJList.setLayoutOrientation(JList.VERTICAL); zielJList.addListSelectionListener(this); listBoxScroller2 = new JScrollPane(zielJList); listBoxScroller2.setBounds(0, 160, 315, 100); fcPanel.add(listBoxScroller2); btnZAuswahl = new JButton("Zielverz. hinzufügen"); btnZAuswahl.setBounds(320, 160, 200, 25); btnZAuswahl.addActionListener(this); fcPanel.add(btnZAuswahl); btnZEntfernen = new JButton("Zielverz. entfernen"); btnZEntfernen.setBounds(320, 190, 200, 25); btnZEntfernen.addActionListener(this); fcPanel.add(btnZEntfernen); this.add(fcPanel); ButtonGroup bGrp = new ButtonGroup(); optionPanel = new JPanel(); optionPanel.setBounds(10, 300 + 10, this.getWidth() - 40, 90); optionPanel.setPreferredSize(new Dimension(this.getWidth() - 40, 90)); // optionPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); optionPanel.setLayout(new GridLayout(3, 1)); nUebSchr = new JRadioButton("Keine Dateien überschreiben"); nUebSchr.addItemListener(this); bGrp.add(nUebSchr); optionPanel.add(nUebSchr); ueSchr = new JRadioButton("Neuere Dateien überschreiben"); ueSchr.addItemListener(this); bGrp.add(ueSchr); optionPanel.add(ueSchr); aUeSchr = new JRadioButton("Alle Dateien überschreiben"); aUeSchr.addItemListener(this); bGrp.add(aUeSchr); optionPanel.add(aUeSchr); this.add(optionPanel); syncPanel = new JPanel(); syncPanel.setBounds( 10, optionPanel.getY() + optionPanel.getHeight() + 10, this.getWidth() - 30, 25); // syncPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); syncPanel.setLayout(new BorderLayout()); btnSync = new JButton("Sync it!"); btnSync.setBounds(0, 0, 150, (syncPanel.getHeight() / 3)); btnSync.addActionListener(this); btnSync.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnSync.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3))); syncPanel.add(btnSync, BorderLayout.LINE_START); btnAbbruch = new JButton("Abbrechen"); btnAbbruch.setBounds(0, 0, 150, (syncPanel.getHeight() / 3)); btnAbbruch.addActionListener(this); btnAbbruch.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnAbbruch.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnAbbruch.setVisible(false); syncPanel.add(btnAbbruch, BorderLayout.LINE_END); progressBar = new JProgressBar(JProgressBar.HORIZONTAL); progressBar.setBorderPainted(true); progressBar.setPreferredSize(new Dimension(300, (syncPanel.getHeight() / 3))); progressBar.setForeground(Color.RED); progressBar.setStringPainted(true); progressBar.setVisible(true); syncPanel.add(progressBar, BorderLayout.CENTER); this.add(syncPanel); logPanel = new JPanel(); logPanel.setBounds( 10, syncPanel.getY() + syncPanel.getHeight() + 10, this.getWidth() - 30, 105); logPanel.setLayout(new BorderLayout()); textArea = new JTextArea(); textArea.setMargin(new Insets(3, 3, 3, 3)); textArea.setBackground(Color.black); textArea.setForeground(Color.LIGHT_GRAY); textArea.setAutoscrolls(true); textArea.setFocusable(false); textAreaScroller = new JScrollPane(textArea); DefaultCaret caret = (DefaultCaret) textArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); textAreaScroller.setBounds(0, 0, syncPanel.getWidth(), 50); logPanel.add(textAreaScroller, BorderLayout.CENTER); this.add(logPanel, BorderLayout.SOUTH); }