void install() { Vector components = new Vector(); Vector indicies = new Vector(); int size = 0; JPanel comp = selectComponents.comp; Vector ids = selectComponents.filesets; for (int i = 0; i < comp.getComponentCount(); i++) { if (((JCheckBox) comp.getComponent(i)).getModel().isSelected()) { size += installer.getIntegerProperty("comp." + ids.elementAt(i) + ".real-size"); components.addElement(installer.getProperty("comp." + ids.elementAt(i) + ".fileset")); indicies.addElement(new Integer(i)); } } String installDir = chooseDirectory.installDir.getText(); Map osTaskDirs = chooseDirectory.osTaskDirs; Iterator keys = osTaskDirs.keySet().iterator(); while (keys.hasNext()) { OperatingSystem.OSTask osTask = (OperatingSystem.OSTask) keys.next(); String dir = ((JTextField) osTaskDirs.get(osTask)).getText(); if (dir != null && dir.length() != 0) { osTask.setEnabled(true); osTask.setDirectory(dir); } else osTask.setEnabled(false); } InstallThread thread = new InstallThread(installer, progress, installDir, osTasks, size, components, indicies); progress.setThread(thread); thread.start(); }
private void _setUpResources() { DefaultComboBoxModel dlm = new DefaultComboBoxModel(); Set<String> keys = HEADING_LIST.keySet(); for (String key : keys) { dlm.addElement(key); } mHeadingComboBox.setModel(dlm); }
public NewBotDialog(DarkBotMCUI ui) { super(ui); this.ui = ui; optionsUIs = new HashMap<String, BotOptionsUI>(); optionsUIs.put("Regular", new RegularBotOptionsUI()); optionsUIs.put("Spambot", new SpamBotOptionsUI()); initComponents(); updateSelectedBotType(); typeComboBox.setModel(new DefaultComboBoxModel(optionsUIs.keySet().toArray())); setVisible(true); }
/** * Loads the list of enabled and disabled encryption protocols with their priority. * * @param enabledEncryptionProtocols The list of enabled encryption protocol available for this * account. * @param disabledEncryptionProtocols The list of disabled encryption protocol available for this * account. */ private void loadEncryptionProtocols( Map<String, Integer> encryptionProtocols, Map<String, Boolean> encryptionProtocolStatus) { int nbEncryptionProtocols = ENCRYPTION_PROTOCOLS.length; String[] encryptions = new String[nbEncryptionProtocols]; boolean[] selectedEncryptions = new boolean[nbEncryptionProtocols]; // Load stored values. int prefixeLength = ProtocolProviderFactory.ENCRYPTION_PROTOCOL.length() + 1; String encryptionProtocolPropertyName; String name; int index; boolean enabled; Iterator<String> encryptionProtocolNames = encryptionProtocols.keySet().iterator(); while (encryptionProtocolNames.hasNext()) { encryptionProtocolPropertyName = encryptionProtocolNames.next(); index = encryptionProtocols.get(encryptionProtocolPropertyName); // If the property is set. if (index != -1) { name = encryptionProtocolPropertyName.substring(prefixeLength); if (isExistingEncryptionProtocol(name)) { enabled = encryptionProtocolStatus.get( ProtocolProviderFactory.ENCRYPTION_PROTOCOL_STATUS + "." + name); encryptions[index] = name; selectedEncryptions[index] = enabled; } } } // Load default values. String encryptionProtocol; boolean set; int j = 0; for (int i = 0; i < ENCRYPTION_PROTOCOLS.length; ++i) { encryptionProtocol = ENCRYPTION_PROTOCOLS[i]; // Specify a default value only if there is no specific value set. if (!encryptionProtocols.containsKey( ProtocolProviderFactory.ENCRYPTION_PROTOCOL + "." + encryptionProtocol)) { set = false; // Search for the first empty element. while (j < encryptions.length && !set) { if (encryptions[j] == null) { encryptions[j] = encryptionProtocol; // By default only ZRTP is set to true. selectedEncryptions[j] = encryptionProtocol.equals("ZRTP"); set = true; } ++j; } } } this.encryptionConfigurationTableModel.init(encryptions, selectedEncryptions); }
/** * Send State (content on WhiteBoard) to all members of Group * * @param copy */ protected void sendOwnState(final Map<Point, Color> copy) { if (copy == null) return; for (Point point : copy.keySet()) { // we don't need the color: it is our draw_color anyway DrawCommand comm = new DrawCommand(DrawCommand.DRAW, point.x, point.y, drawColor.getRGB()); try { byte[] buf = Util.streamableToByteBuffer(comm); if (use_unicasts) sendToAll(buf); else channel.send(new Message(null, buf)); } catch (Exception ex) { System.err.println(ex); } } }
public synchronized void actionPerformed(ActionEvent e) { java.util.List<JComponent> componentsToRemove = null; java.util.List<Part> partsToRemove = null; for (JComponent component : animationStateMap.keySet()) { component.repaint(); if (partsToRemove != null) { partsToRemove.clear(); } Map<Part, AnimationState> map = animationStateMap.get(component); if (!component.isShowing() || map == null || map.size() == 0) { if (componentsToRemove == null) { componentsToRemove = new ArrayList<JComponent>(); } componentsToRemove.add(component); continue; } for (Part part : map.keySet()) { if (map.get(part).isDone()) { if (partsToRemove == null) { partsToRemove = new ArrayList<Part>(); } partsToRemove.add(part); } } if (partsToRemove != null) { if (partsToRemove.size() == map.size()) { // animation is done for the component if (componentsToRemove == null) { componentsToRemove = new ArrayList<JComponent>(); } componentsToRemove.add(component); } else { for (Part part : partsToRemove) { map.remove(part); } } } } if (componentsToRemove != null) { for (JComponent component : componentsToRemove) { animationStateMap.remove(component); } } if (animationStateMap.size() == 0) { timer.stop(); } }
private void addMacroPaths(final CompletionResult result, final String typedText) { result.myMacros = new ArrayList<LookupFile>(); final Iterator<String> macros = myMacroMap.keySet().iterator(); while (macros.hasNext()) { String eachMacro = macros.next(); if (eachMacro.toUpperCase().startsWith(typedText.toUpperCase())) { final String eachPath = myMacroMap.get(eachMacro); if (eachPath != null) { final LookupFile macroFile = myFinder.find(eachPath); if (macroFile != null && macroFile.exists()) { result.myMacros.add(macroFile); result.myToComplete.add(macroFile); macroFile.setMacro(eachMacro); } } } } }
public Animation() { String[] keys = {"no Animator found"}; if (tryDir(".")) // || tryDir("BLM305") || tryDir("CSE470")) keys = map.keySet().toArray(keys); System.out.println(map.size() + " classes loaded"); menu = new JComboBox(keys); pan.setLayout(new BorderLayout(GAP, GAP - 4)); pan.setBorder(new javax.swing.border.EmptyBorder(GAP, GAP, GAP, GAP)); pan.setBackground(COLOR); last = new JPanel(); last.setPreferredSize(DIM); pan.add(last, "Center"); ref.setFont(NORM); ref.setEditable(false); ref.setColumns(35); ref.setDragEnabled(true); pan.add(ref, "North"); pan.add(bottomPanel(), "South"); pan.setToolTipText("A collective project for BLM320"); menu.setToolTipText("Animator classes"); who.setToolTipText("author()"); ref.setToolTipText("description()"); Closer ear = new Closer(); menu.addActionListener(ear); stop.addActionListener(ear); frm.addWindowListener(ear); if (map.size() > 0) setItem(0); frm.setContentPane(pan); frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frm.setLocation(scaled(120), scaled(90)); frm.pack(); // setSize() is called here frm.setVisible(true); start(); }
private void rulesChanged() { ApplicationManager.getApplication().assertIsDispatchThread(); final ArrayList<UsageState> states = new ArrayList<UsageState>(); captureUsagesExpandState(new TreePath(myTree.getModel().getRoot()), states); final List<Usage> allUsages = new ArrayList<Usage>(myUsageNodes.keySet()); Collections.sort(allUsages, USAGE_COMPARATOR); final Set<Usage> excludedUsages = getExcludedUsages(); reset(); myBuilder.setGroupingRules(getActiveGroupingRules(myProject)); myBuilder.setFilteringRules(getActiveFilteringRules(myProject)); ApplicationManager.getApplication() .runReadAction( new Runnable() { @Override public void run() { for (Usage usage : allUsages) { if (!usage.isValid()) { continue; } if (usage instanceof MergeableUsage) { ((MergeableUsage) usage).reset(); } appendUsage(usage); } } }); excludeUsages(excludedUsages.toArray(new Usage[excludedUsages.size()])); if (myCentralPanel != null) { setupCentralPanel(); } SwingUtilities.invokeLater( new Runnable() { @Override public void run() { if (isDisposed) return; restoreUsageExpandState(states); updateImmediately(); } }); }
private void refresh(int index) { GridBagConstraints c = new GridBagConstraints(); // No connector ................ if (acs.size() == 0) { add(new JLabel(bundle.getString("CTL_No_Connector")), c); return; } // Connector switch ................ if (acs.size() > 1) { c.insets = new Insets(0, 0, 3, 3); add(new JLabel(bundle.getString("CTL_Connector")), c); cbConnectors = new JComboBox(); int i, k = acs.size(); for (i = 0; i < k; i++) { AttachingConnector ac = (AttachingConnector) acs.get(i); int jj = ac.name().lastIndexOf('.'); String s = (jj < 0) ? ac.name() : ac.name().substring(jj + 1); cbConnectors.addItem(s + " (" + ac.description() + ")"); } c = new GridBagConstraints(); c.insets = new Insets(0, 3, 3, 0); c.weightx = 1.0; c.fill = java.awt.GridBagConstraints.HORIZONTAL; c.gridwidth = 0; cbConnectors.setSelectedIndex(index); cbConnectors.setActionCommand("SwitchMe!"); cbConnectors.addActionListener(this); add(cbConnectors, c); } ac = (AttachingConnector) acs.get(index); // Transport ................ c = new GridBagConstraints(); c.insets = new Insets(3, 0, 0, 3); add(new JLabel(bundle.getString("CTL_Transport")), c); JTextField tfTransport = new JTextField(ac.transport().name()); tfTransport.setEnabled(false); c = new GridBagConstraints(); c.gridwidth = 0; c.insets = new Insets(3, 3, 0, 0); c.fill = java.awt.GridBagConstraints.HORIZONTAL; c.weightx = 1.0; add(tfTransport, c); // Other params ................ args = ac.defaultArguments(); tfParams = new JTextField[args.size()]; Iterator it = args.keySet().iterator(); int i = 0; while (it.hasNext()) { String name = (String) it.next(); Argument a = (Argument) args.get(name); c = new GridBagConstraints(); c.insets = new Insets(6, 0, 0, 3); c.anchor = GridBagConstraints.WEST; add(new JLabel(a.label() + ": "), c); JTextField tfParam = new JTextField(a.value()); tfParams[i++] = tfParam; tfParam.setName(name); c = new GridBagConstraints(); c.gridwidth = 0; c.insets = new Insets(6, 3, 0, 0); c.fill = java.awt.GridBagConstraints.HORIZONTAL; c.weightx = 1.0; add(tfParam, c); } c = new GridBagConstraints(); c.weighty = 1.0; JPanel p = new JPanel(); p.setPreferredSize(new Dimension(1, 1)); add(p, c); }
private void installTabs() { for (String s : panels.keySet()) mainPane.addTab(s, panels.get(s)); }
@Override @NotNull public Set<Usage> getUsages() { return myUsageNodes.keySet(); }