public String getValueForVisualization() { if (typeSelection.getSelectedItem().equals(MappingTypes.DATA_FIELD)) { return fieldSelection.getSelectedItem().toString(); } else { return literalEntry.getText() + " (literal)"; } }
public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src == add) { // Selection has been made, or add button pressed: if ((sel != null) && (sel.getSelectedItem() != null)) { String s = sel.getSelectedItem().toString(); addField(s); } else if ((input != null) && !input.getText().equals("")) { addField(input.getText()); } } else if (src == input) { addField(input.getText()); } else if (src == remove) { // Remove button pressed: removeSelected(); } else if (src == sel) { if (e.getActionCommand().equals("comboBoxChanged") && (e.getModifiers() == 0)) // These conditions signify arrow key navigation in the dropdown list, so we should // not react to it. I'm not sure if this is well defined enough to be guaranteed to work // everywhere. return; String s = sel.getSelectedItem().toString(); addField(s); sel.getEditor().selectAll(); } else if (src == up) { move(-1); } else if (src == down) { move(1); } }
/** * Method performed when button clicked. * * @param event event that triggers action, here clicking of the button. */ public void actionPerformed(ActionEvent event) { if (choiceBox.getSelectedItem().equals(CUSTOM)) { JFileChooser chooser = new JFileChooser(System.getProperty("user.home")); int returnVal = chooser.showOpenDialog(settingsPanel); if (returnVal == JFileChooser.APPROVE_OPTION) { specifiedOntology = CUSTOM; openFile = chooser.getSelectedFile(); choiceBox.setEditable(true); choiceBox.setSelectedItem(openFile.toString()); choiceBox.setEditable(false); def = false; if (((String) choiceBox.getSelectedItem()).endsWith(".obo")) { settingsPanel.getNamespacePanel().choiceBox.setEnabled(true); } else { settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } } if (returnVal == JFileChooser.CANCEL_OPTION) { choiceBox.setSelectedItem(NONE); specifiedOntology = NONE; def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } } else if (choiceBox.getSelectedItem().equals(NONE)) { specifiedOntology = NONE; def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } else { specifiedOntology = (String) choiceBox.getSelectedItem(); def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } }
private void resetFromFile(@NotNull VirtualFile file, @NotNull Project project) { final Module moduleForFile = ModuleUtilCore.findModuleForFile(file, project); if (moduleForFile == null) { return; } final VirtualFile parent = file.getParent(); if (parent == null) { return; } if (myModule == null) { final Object prev = myModuleCombo.getSelectedItem(); myModuleCombo.setSelectedItem(moduleForFile); if (!moduleForFile.equals(myModuleCombo.getSelectedItem())) { myModuleCombo.setSelectedItem(prev); return; } } else if (!myModule.equals(moduleForFile)) { return; } final JCheckBox checkBox = myCheckBoxes.get(parent.getName()); if (checkBox == null) { return; } for (JCheckBox checkBox1 : myCheckBoxes.values()) { checkBox1.setSelected(false); } checkBox.setSelected(true); myFileNameCombo.getEditor().setItem(file.getName()); }
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub Object source = e.getSource(); if (source == ok) { response = APPLY_OPTION; this.setVisible(false); } else if (source == cancel) { response = CANCEL_OPTION; this.setVisible(false); } else if (source == sizeCombo) { // get the number from the source JComboBox number = (JComboBox) source; String numberItem = (String) number.getSelectedItem(); Font temp = example.getFont(); // then set the font int newSize = Integer.parseInt(numberItem); example.setFont(new Font(temp.getFamily(), temp.getStyle(), newSize)); } else if (source == fontCombo) { JComboBox font = (JComboBox) source; String s = (String) font.getSelectedItem(); Font tmp = example.getFont(); example.setFont(new Font(s, tmp.getStyle(), tmp.getSize())); } else if (source == foreground) { Color tmp = JColorChooser.showDialog(this, "Choose text color", example.getForeground()); MenuBar.shapeLBG.setBackground(tmp); if (tmp != null) example.setForeground(tmp); } }
/** * This method sets the status of debug option based on the user input.If user checks the debug * check box first time then it will add a debugging end point otherwise it will prompt the user * for removal of associated end point for debugging if user already has some debug end point * associated and unchecked the debug check box. */ private void debugOptionStatus() { if (debugCheck.isSelected()) { makeDebugEnable(); try { waRole.setDebuggingEndpoint(dbgSelEndpoint); waRole.setStartSuspended(jvmCheck.isSelected()); } catch (WindowsAzureInvalidProjectOperationException e1) { PluginUtil.displayErrorDialogAndLog(message("adRolErrTitle"), message("dlgDbgErr"), e1); } } else { if (isDebugChecked && !"".equals(comboEndPoint.getSelectedItem())) { String msg = String.format("%s%s", message("dlgDbgEdPtAscMsg"), comboEndPoint.getSelectedItem()); int choice = Messages.showOkCancelDialog( msg, message("dlgDbgEndPtErrTtl"), Messages.getQuestionIcon()); if (choice == Messages.OK) { removeDebugAssociatedEndpoint(); } else { makeAllDisable(); try { waRole.setDebuggingEndpoint(null); } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(message("adRolErrTitle"), message("dlgDbgErr"), e); } } } else { removeDebugAssociatedEndpoint(); } } }
/** * return the String id of the chosen server name * * @return the server name */ public String getServer() { Object selected = serverSelector.getSelectedItem(); if (selected == null) { return null; } AddeServer server; if (selected instanceof AddeServer) { server = (AddeServer) selected; return server.getName(); } String serverName = selected.toString(); server = getIdv().getIdvChooserManager().addAddeServer(serverName); addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType()); Object selectedGroup = groupSelector.getSelectedItem(); AddeServer.Group group = null; if (selectedGroup != null) { group = getIdv() .getIdvChooserManager() .addAddeServerGroup(server, selectedGroup.toString(), getGroupType()); } boolean old = ignoreStateChangedEvents; ignoreStateChangedEvents = true; GuiUtils.setListData(serverSelector, addeServers); serverSelector.setSelectedItem(server); setGroups(); if (group != null) { groupSelector.setSelectedItem(group); } ignoreStateChangedEvents = old; return server.getName(); }
/* * Gets the user choice for font, style and size and redraws the text * accordingly. */ public void setSampleFont() { // Get the font name from the JComboBox fontName = (String) facenameCombo.getSelectedItem(); sampleField.setText(textField.getText()); // Get the font style from the JCheckBoxes fontStyle = 0; if (italicCheckBox.isSelected()) fontStyle += Font.ITALIC; if (boldCheckBox.isSelected()) fontStyle += Font.BOLD; // Get the font size fontSize = 0; fontSize = Integer.parseInt((String) sizeCombo.getSelectedItem()); // THE FOLLOWING IS NO LONGER NEEDED // if(smallButton.isSelected()) // fontSize=SMALL; // else if(mediumButton.isSelected()) // fontSize=MEDIUM; // else if(largeButton.isSelected()) // fontSize=LARGE; // Set the font of the text field sampleField.setFont(new Font(fontName, fontStyle, fontSize)); sampleField.setForeground(fontColor); sampleField.repaint(); pack(); } // end setSampleFont method
public void bind() { viewModel.setAddMode(addCheckBox.isSelected()); viewModel.fromUnitText = fromUnit.getSelectedItem().toString(); viewModel.toUnitText = toUnit.getSelectedItem().toString(); viewModel.fromValueText = fromValue.getText(); viewModel.toValueText = toValue.getText(); }
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub Object source = e.getSource(); if (source == ok) { userResponse = APPLY_OPTION; this.setVisible(false); } else if (source == cancel) { userResponse = CANCEL_OPTION; this.setVisible(false); } else if (source == fontCombo) { @SuppressWarnings("unchecked") JComboBox<String> cb = (JComboBox<String>) source; String s = (String) cb.getSelectedItem(); Font tmp = example.getFont(); example.setFont(new Font(s, tmp.getStyle(), tmp.getSize())); } else if (source == sizeCombo) { @SuppressWarnings("unchecked") JComboBox<String> cb = (JComboBox<String>) source; String s = (String) cb.getSelectedItem(); int newSize = Integer.parseInt(s); Font tmp = example.getFont(); example.setFont(new Font(tmp.getFamily(), tmp.getStyle(), newSize)); } else if (source == foreground) { Color tmp = JColorChooser.showDialog(this, "Choose text color", example.getForeground()); if (tmp != null) example.setForeground(tmp); } }
private SettingConfig generateSetting() { SettingConfig s = new SettingConfig(); s.dir = TEXT_dir.getText(); s.logBuffer = SizeType.get((String) SELECT_logBuffer.getSelectedItem()).getSize(); try { s.delay = Integer.parseInt((String) SELECT_delay.getSelectedItem()); if (s.delay < 100) s.delay = 100; } catch (Exception e) { } s.seek = CHK_seek.isSelected(); if (s.seek) { try { s.seekType = SeekType.get((String) SELECT_seekType.getSelectedItem()); } catch (Exception e) { } try { s.seekPos = Long.parseLong(TEXT_seekPos.getText()); } catch (Exception e) { } } s.charset = CharsetType.get((String) SELECT_charset.getSelectedItem()); try { s.overflowNum = Integer.parseInt(TEXT_limit.getText()); } catch (Exception e) { } s.showLineNumber = CHK_showLineNumber.isSelected(); s.softWrap = CHK_softWrap.isSelected(); return s; }
public String[] getPuolustaja() { String[] pelaajat = new String[3]; pelaajat[0] = (String) puolustaja1.getSelectedItem(); pelaajat[1] = (String) puolustaja2.getSelectedItem(); pelaajat[2] = (String) puolustaja3.getSelectedItem(); return pelaajat; }
public void actionPerformed(ActionEvent e) { if (cyear.getSelectedItem() != null) { String b = cyear.getSelectedItem().toString(); currentYear = Integer.parseInt(b); refreshCalendar(currentMonth, currentYear); } }
/** * submit * * @param a * @param b * @return boolean */ public boolean submit(String a, String b) { int selected[]; int i; StringBuffer extra = new StringBuffer(); waitCursor(); for (int j = 0; j < nSection; j++) { selected = lk[j].getSelectedIndices(); for (i = 0; i < selected.length; i++) CDSMethods.append( extra, (String) vq.getNameKey().elementAt(j), (String) lk[j].getModel().getElementAt(selected[i])); } boolean res = vq.submit( a, b, (String) unit.getSelectedItem(), (String) coordinate.getSelectedItem(), tauthor.getText(), extra.toString(), outputMode, resList.getList()); defaultCursor(); return res; }
/** * Disables the debugging if debug endpoint's type is changed to 'Internal', and if private port * is modified then assigns the new debugging port by setting the modified endpoint as a debugging * endpoint. * * @param oldType : old type of the endpoint. * @return retVal : false if any error occurs. * @throws WindowsAzureInvalidProjectOperationException */ private boolean handleChangeForDebugEndpt(WindowsAzureEndpointType oldType, String privatePort) throws WindowsAzureInvalidProjectOperationException { boolean retVal = true; if (oldType.equals(WindowsAzureEndpointType.Input) && comboType.getSelectedItem().equals(WindowsAzureEndpointType.Internal.toString())) { int choice = Messages.showYesNoDialog( String.format( "%s%s%s", message("dlgEPDel"), message("dlgEPChangeType"), message("dlgEPDel2")), message("dlgTypeTitle"), Messages.getQuestionIcon()); if (choice == Messages.YES) { waEndpt.setEndPointType((WindowsAzureEndpointType) comboType.getSelectedItem()); waRole.setDebuggingEndpoint(null); } else { retVal = false; } } else if (privatePort == null) { PluginUtil.displayErrorDialog(message("dlgInvldPort"), message("dbgPort")); retVal = false; } else if (!waEndpt.getPrivatePort().equalsIgnoreCase(privatePort)) { boolean isSuspended = waRole.getStartSuspended(); waRole.setDebuggingEndpoint(null); waEndpt.setPrivatePort(privatePort); waRole.setDebuggingEndpoint(waEndpt); waRole.setStartSuspended(isSuspended); } return retVal; }
@Override public void actionPerformed(ActionEvent e) { ID = (Integer) hashRoomType.get(boxRoomTypeID.getSelectedItem().toString()); IDSTATUS = (Integer) hashRoomStatus.get(boxRoomStatusID.getSelectedItem().toString()); if (e.getSource() == buttonInsert) { try { Rooms rooms = new Rooms(txtRoomNumber.getText(), txtDescription.getText(), ID, IDSTATUS); RoomsController.roomsController.save(rooms); int c = model.getRowCount(); for (int i = c - 1; i >= 0; i--) { model.removeRow(i); jRoom.revalidate(); } all(); JOptionPane.showMessageDialog(this, "ok"); } catch (Exception ex) { ex.printStackTrace(); } } if (e.getSource() == buttonUpdate) { try { Rooms rooms = new Rooms(txtRoomNumber.getText(), txtDescription.getText(), ID, IDSTATUS); rooms.setRoomID(IDROOM); RoomsController.roomsController.update(rooms); int c = model.getRowCount(); for (int i = c - 1; i >= 0; i--) { model.removeRow(i); jRoom.revalidate(); } all(); JOptionPane.showMessageDialog(this, "Update to succeed !"); } catch (Exception ex) { ex.printStackTrace(); } } if (e.getSource() == buttonDelete) { try { List<CheckIn> temp = CheckInController.checkInController.all(); for (int i = 0; i < temp.size(); i++) { if (IDROOM == temp.get(i).getRoomID()) { this.error = 0; } else { this.error = 0; RoomsController.roomsController.delete(IDROOM); int c = model.getRowCount(); for (int ii = c - 1; ii >= 0; ii--) { model.removeRow(ii); jRoom.revalidate(); } all(); } } JOptionPane.showMessageDialog(this, "Delete to succeed !"); } catch (Exception ex) { JOptionPane.showMessageDialog(this, "can't delete row bcause check still !"); } } if (e.getSource() == buttonRefresh) {} }
public String[] getKeskikentta() { String[] pelaajat = new String[4]; pelaajat[0] = (String) keskikentta1.getSelectedItem(); pelaajat[1] = (String) keskikentta2.getSelectedItem(); pelaajat[2] = (String) keskikentta3.getSelectedItem(); pelaajat[3] = (String) keskikentta4.getSelectedItem(); return pelaajat; }
public Renderer renderer() { if (renderers.getSelectedItem().equals("Serial")) { return new SerialRenderer(); } else if (renderers.getSelectedItem().equals("Parallel")) { return new ForkJoinRenderer(); } else { throw new RuntimeException("Unknown renderer selected: " + renderers.getSelectedItem()); } }
/** * Create a default filename given the current date selection. If custom dates are selected, use * those dates; otherwise, use year and week numbers. * * @return The default filename. */ private String getDefaultFilename() { if (yearCB.getSelectedIndex() == 0 || weekCB.getSelectedIndex() == 0) return "timesheet-" + dateFormat.format(fromDate.getDate()).replaceAll("/", "") + "-" + dateFormat.format(toDate.getDate()).replaceAll("/", "") + ".txt"; return "timesheet-" + yearCB.getSelectedItem() + "wk" + weekCB.getSelectedItem() + ".txt"; }
protected void GetFields() { if (_PreviousPersonnel == null) return; _PreviousPersonnel.setName(_NameTextField.getText()); _PreviousPersonnel.setCallsign(_CallsignTextField.getText()); _PreviousPersonnel.setRank((Rank) _RankCombo.getSelectedItem()); _PreviousPersonnel.setRating((Rating) _RatingCombo.getSelectedItem()); _PreviousPersonnel.setNotes(_NotesTextArea.getText()); }
@NotNull public AnalysisScope getScope( @NotNull AnalysisUIOptions uiOptions, @NotNull AnalysisScope defaultScope, @NotNull Project project, Module module) { AnalysisScope scope; if (isProjectScopeSelected()) { scope = new AnalysisScope(project); uiOptions.SCOPE_TYPE = AnalysisScope.PROJECT; } else { final SearchScope customScope = getCustomScope(); if (customScope != null) { scope = new AnalysisScope(customScope, project); uiOptions.SCOPE_TYPE = AnalysisScope.CUSTOM; uiOptions.CUSTOM_SCOPE_NAME = customScope.getDisplayName(); } else if (isModuleScopeSelected()) { scope = new AnalysisScope(module); uiOptions.SCOPE_TYPE = AnalysisScope.MODULE; } else if (isUncommitedFilesSelected()) { final ChangeListManager changeListManager = ChangeListManager.getInstance(project); List<VirtualFile> files; if (myChangeLists.getSelectedItem() == ALL) { files = changeListManager.getAffectedFiles(); } else { files = new ArrayList<VirtualFile>(); for (ChangeList list : changeListManager.getChangeListsCopy()) { if (!Comparing.strEqual(list.getName(), (String) myChangeLists.getSelectedItem())) continue; final Collection<Change> changes = list.getChanges(); for (Change change : changes) { final ContentRevision afterRevision = change.getAfterRevision(); if (afterRevision != null) { final VirtualFile vFile = afterRevision.getFile().getVirtualFile(); if (vFile != null) { files.add(vFile); } } } } } scope = new AnalysisScope(project, new HashSet<VirtualFile>(files)); uiOptions.SCOPE_TYPE = AnalysisScope.UNCOMMITTED_FILES; } else { scope = defaultScope; uiOptions.SCOPE_TYPE = defaultScope.getScopeType(); // just not project scope } } uiOptions.ANALYZE_TEST_SOURCES = isInspectTestSources(); scope.setIncludeTestSource(isInspectTestSources()); scope.setScope(getCustomScope()); FindSettings.getInstance().setDefaultScopeName(scope.getDisplayName()); return scope; }
@Override public void actionPerformed(ActionEvent arg0) { if (version.getItemCount() > 0) { Settings.getSettings() .setPackVer( (String.valueOf(version.getSelectedItem()).equalsIgnoreCase("recommended") ? "Recommended Version" : String.valueOf(version.getSelectedItem()))); Settings.getSettings().save(); } }
/** * This method is used to create the ISAField for use in creating the xml when saving the mappings * out to file * * @return ISAField */ public ISAField createISAField() { String mappingValue; if (typeSelection.getSelectedItem() == MappingTypes.DATA_FIELD) { mappingValue = fieldSelection.getSelectedItem().toString(); } else { mappingValue = literalEntry.getText(); } return new ISAField( MappingTypes.resolveTypeFromString(typeSelection.getSelectedItem().toString()), mappingValue); }
private void novaTransicao() { if (atual == null) { return; // n_o executa se o estado atual for nulo } Character c = (Character) cbAlfabeto.getSelectedItem(); // pega o simbolo a ser usado String estadoDestino = ((Estado) cbEstadosDestinos.getSelectedItem()) .getNome(); // pega o nome do estado a ser usado if (a.newTransicao(atual.getNome(), c + "", estadoDestino)) { // cria a nova transi__o refresh(); refreshTrans(); } }
private void onOK() { if (nameTextField.getText().length() < 3 || nameTextField.getText().length() > 24 || !nameTextField.getText().matches("[a-z0-9]+")) { JOptionPane.showMessageDialog( this, "Invalid storage account name. The name should be between 3 and 24 characters long and \n" + "can contain only lowercase letters and numbers.", "Error creating the storage account", JOptionPane.ERROR_MESSAGE); return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); createProgressBar.setVisible(true); try { String name = nameTextField.getText(); String region = (regionOrAffinityGroupComboBox.getSelectedItem() instanceof Location) ? regionOrAffinityGroupComboBox.getSelectedItem().toString() : ""; String affinityGroup = (regionOrAffinityGroupComboBox.getSelectedItem() instanceof AffinityGroup) ? regionOrAffinityGroupComboBox.getSelectedItem().toString() : ""; String replication = replicationComboBox.getSelectedItem().toString(); storageAccount = new StorageAccount( name, replication, region, affinityGroup, "", subscription.getId().toString()); AzureSDKManagerImpl.getManager().createStorageAccount(storageAccount); AzureSDKManagerImpl.getManager().refreshStorageAccountInformation(storageAccount); onCreate.run(); } catch (AzureCmdException e) { storageAccount = null; UIHelper.showException( "An error occurred while trying to create the specified storage account.", e, "Error Creating Storage Account", false, true); } setCursor(Cursor.getDefaultCursor()); this.setVisible(false); dispose(); }
public boolean isModified(Settings settings) { SettingConfig configSaved = settings.getSettingConfig(); return (!TEXT_dir.getText().equals(configSaved.dir) && configSaved.dir != null) || (configSaved.dir == null && !TEXT_dir.getText().equals("")) || !(SizeType.get((String) SELECT_logBuffer.getSelectedItem()).getSize() == configSaved.logBuffer) || !(SELECT_delay.getSelectedItem()).equals(configSaved.delay + "") || !(SELECT_charset.getSelectedItem()).equals(configSaved.charset.getName() + "") || !(CHK_seek.isSelected() == configSaved.seek) || !(CHK_showLineNumber.isSelected() == configSaved.showLineNumber) || !(CHK_softWrap.isSelected() == configSaved.softWrap) || !(SELECT_seekType.getSelectedItem().equals(configSaved.seekType.name())) || !(TEXT_seekPos.getText().equals(configSaved.seekPos + "")) || !(TEXT_limit.getText().equals(configSaved.overflowNum + "")); }
/* * Checks if the preferences have changed from the cached preferences. */ private boolean prefsChanged() { return (prefs.getResolution() != resolution.getSelectedItem()) || (prefs.getFullscreen() != fullscreen.isSelected()) || (prefs.getBitrate() != bitrate.getValue()) || (prefs.getUseOpenGlRenderer() != openGlRenderer.isSelected()) || (prefs.getLocalAudio() != localAudio.isSelected()); }
protected void save() { data.name = nameField.getText(); try { costField.commitEdit(); data.cost = ((Long) costField.getValue()).intValue(); } catch (ParseException e) { data.cost = 0; } data.color = colorBox.getSelectedItem().toString(); data.text = charField.getText(); data.weight = Float.parseFloat(weightField.getText()); if (spellBox.getSelectedItem() != null) { data.spell = spellBox.getSelectedItem().toString(); } data.setPath(Editor.getStore().getActive().get("id")); }
private void onAnredeSelected() { LOGGER.trace("PersonController Event Anrede selected=" + comboBoxAnrede.getSelectedItem()); boolean equalFieldAndModelValue = equalsNullSafe(comboBoxAnrede.getSelectedItem(), personModel.getAnrede()); try { setModelAnrede(); } catch (SvmRequiredException e) { return; } if (equalFieldAndModelValue && isModelValidationMode()) { // Wenn Field und Model den gleichen Wert haben, erfolgt kein PropertyChangeEvent. Deshalb // muss hier die Validierung angestossen werden. LOGGER.trace("Validierung wegen equalFieldAndModelValue"); validate(); } }
public String getValueEntered() { if (typeSelection.getSelectedItem().equals(MappingTypes.DATA_FIELD)) { return "<<" + fieldSelection.getSelectedIndex() + ">>"; } else { return literalEntry.getText(); } }