List of usage examples for javax.swing JOptionPane showInputDialog
public static String showInputDialog(Component parentComponent, Object message) throws HeadlessException
parentComponent
. From source file:org.mbs3.juniuploader.gui.pnlFormVariables.java
private void btnAddPairActionPerformed(ActionEvent evt) { if (evt.getSource() == this.btnAddPair) { String key = JOptionPane.showInputDialog(this, "What is the field name:"); String val = JOptionPane.showInputDialog(this, "What is the field value:"); int enc = JOptionPane.showConfirmDialog(this, "Would you like this variable sent and stored with encryption?", "Encrypt?", JOptionPane.YES_NO_OPTION); if (key != null && !key.equals("") && val != null && !val.equals("")) { // send roster_update_password securely if (enc == 0) { val = CheckSummer.createChecksumFromString(val); }/* ww w .j a v a 2 s . c o m*/ FormPair fp = new FormPair(key, val); int sel = this.cmbFormGroups.getSelectedIndex(); if (sel != -1) { frmMain.formPairValues.addElement(fp); } } else { log.trace("New site addition cancelled by user."); } } }
From source file:org.mbs3.juniuploader.gui.pnlUploadSites.java
private void btnAddSiteActionPerformed(ActionEvent evt) { if (evt.getSource() == this.btnAddSite) { String returnVal = JOptionPane.showInputDialog(this, "What is the URL of this site:"); if (returnVal != null && !returnVal.equals("")) { frmMain.addUploadLocation(returnVal); } else {/* ww w . j a v a2 s.c om*/ log.trace("New site addition cancelled by user."); } } }
From source file:org.netbeans.db.modeler.core.widget.table.BaseTableWidget.java
@Override protected List<JMenuItem> getPopupMenuItemList() { List<JMenuItem> menuList = super.getPopupMenuItemList(); JMenuItem joinTable = new JMenuItem("Create Secondary Table"); joinTable.addActionListener((ActionEvent e) -> { Entity entity = this.getBaseElementSpec().getEntity(); String secondaryTableName = JOptionPane.showInputDialog( (Component) BaseTableWidget.this.getModelerScene().getModelerPanelTopComponent(), "Please enter secondary table name"); if (entity.getTable(secondaryTableName) == null) { //check from complete table list SecondaryTable secondaryTable = new SecondaryTable(); secondaryTable.setName(secondaryTableName); entity.addSecondaryTable(secondaryTable); ModelerFile parentFile = BaseTableWidget.this.getModelerScene().getModelerFile().getParentFile(); EntityMappings entityMappings = (EntityMappings) parentFile.getModelerScene().getBaseElementSpec(); DBUtil.openDBViewer(parentFile, entityMappings, entityMappings.getCurrentWorkSpace()); } else {//from w w w. ja v a 2 s . co m JOptionPane.showMessageDialog( (Component) BaseTableWidget.this.getModelerScene().getModelerPanelTopComponent(), "Table already exist"); } }); menuList.add(0, joinTable); return menuList; }
From source file:org.nuclos.client.main.MainController.java
private Map<String, Map<String, Action>> getCommandMap() { HashMap<String, Map<String, Action>> res = new HashMap<String, Map<String, Action>>(); HashMap<String, Action> mainController = new HashMap<String, Action>(); /* that's too cumbersome: mainController.put(//from ww w. j a v a2s. c om "cmdChangePassword", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { cmdChangePassword(); } }); */ mainController.put("cmdDirectHelp", cmdDirectHelp); mainController.put("cmdShowPersonalTasks", cmdShowPersonalTasks); mainController.put("cmdShowTimelimitTasks", cmdShowTimelimitTasks); mainController.put("cmdShowPersonalSearchFilters", cmdShowPersonalSearchFilters); mainController.put("cmdChangePassword", cmdChangePassword); mainController.put("cmdOpenSettings", cmdOpenSettings); mainController.put("cmdOpenManagementConsole", cmdOpenManagementConsole); //mainController.put("cmdOpenEntityWizard", cmdOpenEntityWizard); mainController.put("cmdOpenRelationEditor", cmdOpenRelationEditor); mainController.put("cmdOpenCustomComponentWizard", cmdOpenCustomComponentWizard); //mainController.put("cmdRefreshClientCaches", cmdRefreshClientCaches); mainController.put("cmdSelectAll", cmdSelectAll); mainController.put("cmdHelpContents", cmdHelpContents); mainController.put("cmdShowAboutDialog", cmdShowAboutDialog); mainController.put("cmdShowProjectReleaseNotes", cmdShowProjectReleaseNotes); mainController.put("cmdShowNuclosReleaseNotes", cmdShowNuclosReleaseNotes); mainController.put("cmdLogoutExit", cmdLogoutExit); mainController.put("cmdWindowClosing", cmdWindowClosing); mainController.put("cmdExecuteRport", cmdExecuteRport); for (Method m : getClass().getDeclaredMethods()) { if (m.getName().startsWith("cmd")) { Class<?>[] pt = m.getParameterTypes(); if (pt.length == 0 || (pt.length == 1 && pt[0].isAssignableFrom(ActionEvent.class))) { final Method fm = m; Action a = new AbstractAction(m.getName()) { @Override public void actionPerformed(ActionEvent e) { miDelegator(e, fm); } }; mainController.put(m.getName(), a); } } } res.put("MainController", mainController); HashMap<String, Action> clipboardUtils = new HashMap<String, Action>(); clipboardUtils.put("cutAction", new ClipboardUtils.CutAction()); clipboardUtils.put("copyAction", new ClipboardUtils.CopyAction()); clipboardUtils.put("pasteAction", new ClipboardUtils.PasteAction()); res.put("ClipboardUtils", clipboardUtils); HashMap<String, Action> dev = new HashMap<String, Action>(); dev.put("jmsNotification", new AbstractAction("Test JMS notification") { @Override public void actionPerformed(ActionEvent e) { String s = JOptionPane.showInputDialog(getMainFrame(), "Topic: Message"); if (s == null) return; String[] a = s.split(": *"); if (a.length == 2) { // testFacadeRemote.testClientNotification(a[0], a[1]); throw new UnsupportedOperationException("TestFacade removed"); } else { JOptionPane.showMessageDialog(getMainFrame(), "Wrong input format"); } } }); dev.put("webPrefs", new AbstractAction("Test Web Prefs-Access") { @Override public void actionPerformed(ActionEvent e) { String s = JOptionPane.showInputDialog(getMainFrame(), "Access-Path"); if (s == null) return; try { Map<String, String> m = getWebAccessPrefs().getPrefsMap(s); StringBuilder sb = new StringBuilder(); for (String k : m.keySet()) sb.append(k).append(": ").append(m.get(k)).append("\n"); JOptionPane.showMessageDialog(getMainFrame(), sb.toString()); } catch (CommonBusinessException e1) { Errors.getInstance().showExceptionDialog(getMainFrame(), e1); } } }); dev.put("uiDefaults", new AbstractAction("UIDefaults") { @Override public void actionPerformed(ActionEvent e) { JFrame out = new JFrame("UIDefaults"); out.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); out.getContentPane().setLayout(new BorderLayout()); final UIDefTableModel mdl = new UIDefTableModel(); final JTable contentTable = new JTable(mdl); JScrollPane sp = new JScrollPane(contentTable); out.getContentPane().add(sp, BorderLayout.CENTER); UIDefaults defs = UIManager.getDefaults(); for (Object key : CollectionUtils.iterableEnum((defs.keys()))) mdl.add(key.toString(), defs.get(key)); mdl.sort(); contentTable.getColumnModel().getColumn(1).setCellRenderer(new UIDefaultsRenderer()); contentTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int row = contentTable.rowAtPoint(e.getPoint()); mdl.forceValue(contentTable.convertRowIndexToModel(row)); } }); out.pack(); out.setVisible(true); } }); dev.put("checkJawin", new AbstractAction("Check Jawin") { @Override public void actionPerformed(ActionEvent e) { try { SystemUtils.checkJawin(); JOptionPane.showMessageDialog(Main.getInstance().getMainFrame(), "Jawin ok"); } catch (Exception ex) { Errors.getInstance().showDetailedExceptionDialog(Main.getInstance().getMainFrame(), ex); } } }); res.put("Dev", dev); return res; }
From source file:org.nuclos.client.relation.MyGraphModel.java
@Override public Object add(Object parent, Object child, int index) { Object obj = super.add(parent, child, index); if (obj instanceof mxCell) { mxCell cell = (mxCell) obj;// w ww. jav a 2 s .c o m if (StringUtils.looksEmpty(cell.getStyle())) { JPopupMenu pop = createRelationPopupMenu(cell, false); editPanel.setIsPopupShown(true); pop.show(graphComponent, graphComponent.getGraphControl().getMousePosition().x, graphComponent.getGraphControl().getMousePosition().y); } else if (mxConstants.ARROW_DIAMOND.equals(cell.getStyle())) { Object cells[] = { cell }; mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ENDARROW, mxConstants.ARROW_DIAMOND); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ENDSIZE, "12"); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_STROKECOLOR, SYMBOLCOLOR); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ELBOW, mxConstants.ELBOW_VERTICAL); } else if (mxConstants.ARROW_OPEN.equals(cell.getStyle())) { Object cells[] = { cell }; mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ENDARROW, mxConstants.ARROW_OPEN); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ENDSIZE, "12"); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_STROKECOLOR, SYMBOLCOLOR); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ELBOW, mxConstants.ELBOW_VERTICAL); } else if (mxConstants.ARROW_OVAL.equals(cell.getStyle())) { Object cells[] = { cell }; mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ENDARROW, mxConstants.ARROW_OVAL); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ENDSIZE, "12"); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_STROKECOLOR, SYMBOLCOLOR); mxUtils.setCellStyles(this, cells, mxConstants.STYLE_ELBOW, mxConstants.ELBOW_VERTICAL); } else if (cell.getStyle() != null && cell.getStyle().indexOf(ENTITYSTYLE) >= 0) { try { if (cell.getValue() != null && cell.getValue() instanceof String) { String sEntity = (String) cell.getValue(); if (sEntity.length() == 0) { boolean blnNotSet = true; while (blnNotSet) { sEntity = JOptionPane.showInputDialog(editPanel, getSpringLocaleDelegate().getMessage("nuclos.entityrelation.editor.20", "Bitte geben Sie den Namen der neuen Entit\u00e4t an!")); for (EntityMetaDataVO voMeta : MetaDataClientProvider.getInstance() .getAllEntities()) { if (voMeta.getEntity().equals(sEntity)) { JOptionPane.showMessageDialog(editPanel, getSpringLocaleDelegate().getMessage( "nuclos.entityrelation.editor.19", "Entit\u00e4t schon vorhanden")); blnNotSet = true; break; } blnNotSet = false; } } if (sEntity == null) { this.remove(cell); } if (sEntity.length() == 0) this.remove(cell); else { EntityMetaDataVO voEntity = new EntityMetaDataVO(); voEntity.setEntity(sEntity); voEntity.setDbEntity("V_EO_" + NuclosWizardUtils.replace(sEntity)); voEntity.setEditable(true); voEntity.setImportExport(true); voEntity.setSearchable(true); voEntity.setStateModel(false); voEntity.setTreeGroup(false); voEntity.setTreeRelation(false); voEntity.setLogBookTracking(true); voEntity.setCacheable(false); voEntity.setFieldValueEntity(false); EntityMetaDataTO toEntity = new EntityMetaDataTO(); toEntity.setTreeView(new ArrayList<EntityTreeViewVO>()); toEntity.setEntityMetaVO(voEntity); List<TranslationVO> lstTranslation = new ArrayList<TranslationVO>(); for (LocaleInfo info : LocaleDelegate.getInstance().getAllLocales(false)) { Map<String, String> mpValues = new HashMap<String, String>(); mpValues.put(TranslationVO.labelsEntity[0], sEntity); mpValues.put(TranslationVO.labelsEntity[2], sEntity); TranslationVO vo = new TranslationVO(info.localeId, info.title, info.language, mpValues); lstTranslation.add(vo); } toEntity.setTranslation(lstTranslation); String sResult = MetaDataDelegate.getInstance().createOrModifyEntity(null, toEntity, null, new ArrayList<EntityFieldMetaDataTO>(), true, null, null); EntityMetaDataVO voEntityCreated = MetaDataDelegate.getInstance() .getEntityByName(sEntity); cell.setValue(voEntityCreated); editPanel.loadReferenz(); } } } } catch (Exception e) { LOG.warn("add: " + e); } } } return obj; }
From source file:org.nuclos.client.relation.MyGraphModel.java
public JPopupMenu createRelationPopupMenu(final mxCell cell, boolean delete) { final JPopupMenu pop = new JPopupMenu(); JMenuItem i1 = new JMenuItem( getSpringLocaleDelegate().getMessage("nuclos.entityrelation.editor.1", "Bezug zu Stammdaten")); i1.addActionListener(new ActionListener() { @Override/*ww w . ja va2 s .c om*/ public void actionPerformed(ActionEvent e) { editPanel.setIsPopupShown(false); if (cell.getTarget() == null || cell.getSource() == null) { remove(cell); return; } Object cells[] = { cell }; mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ENDARROW, mxConstants.ARROW_OPEN); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ENDSIZE, "12"); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ELBOW, mxConstants.ELBOW_VERTICAL); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, EDGESTYLE, ELBOWCONNECTOR); RelationAttributePanel panel = new RelationAttributePanel(RelationAttributePanel.TYPE_ENTITY); mxCell target = (mxCell) cell.getTarget(); mxCell source = (mxCell) cell.getSource(); panel.setEntity((EntityMetaDataVO) target.getValue()); panel.setEntitySource((EntityMetaDataVO) source.getValue()); EntityMetaDataVO voSource = (EntityMetaDataVO) source.getValue(); EntityMetaDataVO voTarget = (EntityMetaDataVO) target.getValue(); panel.setEntityFields( MetaDataDelegate.getInstance().getAllEntityFieldsByEntity(voSource.getEntity()).values()); double cellsDialog[][] = { { 5, TableLayout.PREFERRED, 5 }, { 5, TableLayout.PREFERRED, 5 } }; JDialog dia = new JDialog(mf); dia.setLayout(new TableLayout(cellsDialog)); dia.setTitle(getSpringLocaleDelegate().getMessage("nuclos.entityrelation.editor.10", "Bezug zu Stammdaten bearbeiten")); dia.setLocationRelativeTo(editPanel); dia.add(panel, "1,1"); dia.setModal(true); panel.setDialog(dia); dia.pack(); dia.setVisible(true); if (panel.getState() == 1) { EntityFieldMetaDataVO vo = panel.getField(); cell.setValue(vo); mpTransation.put(vo, panel.getTranslation().getRows()); List<EntityFieldMetaDataTO> toList = new ArrayList<EntityFieldMetaDataTO>(); EntityFieldMetaDataTO toField = new EntityFieldMetaDataTO(); toField.setEntityFieldMeta(vo); toField.setTranslation(panel.getTranslation().getRows()); toList.add(toField); MetaDataDelegate.getInstance().modifyEntityMetaData(voSource, toList); editPanel.loadReferenz(); } else { remove(cell); } } }); final JMenuItem i2 = new JMenuItem(getSpringLocaleDelegate().getMessage("nuclos.entityrelation.editor.3", "Bezug zu Vorg\u00e4ngen (Unterformularbezug)")); i2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { editPanel.setIsPopupShown(false); if (cell.getTarget() == null || cell.getSource() == null) { remove(cell); return; } Object cells[] = { cell }; mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ENDARROW, mxConstants.ARROW_DIAMOND); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ENDSIZE, "12"); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ELBOW, mxConstants.ELBOW_VERTICAL); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, EDGESTYLE, ELBOWCONNECTOR); mxCell target = (mxCell) cell.getTarget(); mxCell source = (mxCell) cell.getSource(); EntityMetaDataVO voSource = (EntityMetaDataVO) source.getValue(); EntityMetaDataVO voTarget = (EntityMetaDataVO) target.getValue(); String sFieldName = null; boolean blnNotSet = true; while (blnNotSet) { sFieldName = JOptionPane.showInputDialog(editPanel, getSpringLocaleDelegate().getMessage( "nuclos.entityrelation.editor.1", "Bitte geben Sie den Namen des Feldes an!")); if (sFieldName == null || sFieldName.length() < 1) { MyGraphModel.this.remove(cell); return; } else if (sFieldName != null) { blnNotSet = false; } } EntityFieldMetaDataVO vo = new EntityFieldMetaDataVO(); vo.setModifiable(true); vo.setLogBookTracking(false); vo.setReadonly(false); vo.setShowMnemonic(true); vo.setInsertable(true); vo.setSearchable(true); vo.setNullable(false); vo.setUnique(true); vo.setDataType("java.lang.String"); List<TranslationVO> lstTranslation = new ArrayList<TranslationVO>(); for (LocaleInfo voLocale : LocaleDelegate.getInstance().getAllLocales(false)) { String sLocaleLabel = voLocale.language; Integer iLocaleID = voLocale.localeId; String sCountry = voLocale.title; Map<String, String> map = new HashMap<String, String>(); TranslationVO translation = new TranslationVO(iLocaleID, sCountry, sLocaleLabel, map); for (String sLabel : labels) { translation.getLabels().put(sLabel, sFieldName); } lstTranslation.add(translation); } vo.setForeignEntity(voTarget.getEntity()); vo.setField(sFieldName); vo.setDbColumn("INTID_" + sFieldName); cell.setValue(vo); List<EntityFieldMetaDataTO> toList = new ArrayList<EntityFieldMetaDataTO>(); EntityFieldMetaDataTO toField = new EntityFieldMetaDataTO(); toField.setEntityFieldMeta(vo); toField.setTranslation(lstTranslation); toList.add(toField); MetaDataDelegate.getInstance().modifyEntityMetaData(voSource, toList); editPanel.loadReferenz(); } }); final JMenuItem i4 = new JMenuItem( getSpringLocaleDelegate().getMessage("nuclos.entityrelation.editor.5", "Arbeitsschritt")); i4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { editPanel.setIsPopupShown(false); if (cell.getTarget() == null || cell.getSource() == null) { remove(cell); return; } Object cells[] = { cell }; mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ENDARROW, mxConstants.ARROW_OVAL); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ENDSIZE, "12"); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, mxConstants.STYLE_ELBOW, mxConstants.ELBOW_VERTICAL); mxUtils.setCellStyles(graphComponent.getGraph().getModel(), cells, EDGESTYLE, ELBOWCONNECTOR); try { mxCell cellSource = (mxCell) cell.getSource(); mxCell cellTarget = (mxCell) cell.getTarget(); EntityMetaDataVO sourceModule = (EntityMetaDataVO) cellSource.getValue(); EntityMetaDataVO targetModule = (EntityMetaDataVO) cellTarget.getValue(); String sSourceModule = sourceModule.getEntity(); String sTargetModule = targetModule.getEntity(); boolean blnFound = false; for (MasterDataVO voGeneration : MasterDataCache.getInstance() .get(NuclosEntity.GENERATION.getEntityName())) { String sSource = (String) voGeneration.getField("sourceModule"); String sTarget = (String) voGeneration.getField("targetModule"); if (org.apache.commons.lang.StringUtils.equals(sSource, sSourceModule) && org.apache.commons.lang.StringUtils.equals(sTarget, sTargetModule)) { GenerationCollectController gcc = (GenerationCollectController) NuclosCollectControllerFactory .getInstance().newMasterDataCollectController( NuclosEntity.GENERATION.getEntityName(), null, null); gcc.runViewSingleCollectableWithId(voGeneration.getId()); blnFound = true; break; } } if (!blnFound) { GenerationCollectController gcc = (GenerationCollectController) NuclosCollectControllerFactory .getInstance().newMasterDataCollectController( NuclosEntity.GENERATION.getEntityName(), null, null); Map<String, Object> mp = new HashMap<String, Object>(); mp.put("sourceModule", sSourceModule); mp.put("sourceModuleId", new Integer( MetaDataClientProvider.getInstance().getEntity(sSourceModule).getId().intValue())); mp.put("targetModule", sTargetModule); mp.put("targetModuleId", new Integer( MetaDataClientProvider.getInstance().getEntity(sTargetModule).getId().intValue())); MasterDataVO vo = new MasterDataVO(NuclosEntity.GENERATION.getEntityName(), null, null, null, null, null, null, mp); gcc.runWithNewCollectableWithSomeFields(vo); } } catch (NuclosBusinessException e1) { LOG.warn("actionPerformed: " + e1); } catch (CommonPermissionException e1) { LOG.warn("actionPerformed: " + e1); } catch (CommonFatalException e1) { LOG.warn("actionPerformed: " + e1); } catch (CommonBusinessException e1) { LOG.warn("actionPerformed: " + e1); } } }); JMenuItem i5 = new JMenuItem( getSpringLocaleDelegate().getMessage("nuclos.entityrelation.editor.12", "Verbindung l\u00f6sen")); i5.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mxGraphModel model = (mxGraphModel) graphComponent.getGraph().getModel(); model.remove(cell); } }); pop.add(i1); pop.add(i2); //pop.add(i3); pop.add(i4); if (delete) { pop.addSeparator(); pop.add(i5); } return pop; }
From source file:org.openbase.bco.manager.scene.visual.SceneCreationPanel.java
private void newButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newButtonActionPerformed if (location == null) { logger.error("You have to select a location first!"); return;// ww w . ja va 2 s.c om } String label = JOptionPane.showInputDialog(this, "Enter scene label"); //is null if cancel has been pressed if (label == null) { return; } try { logger.info("Registering scene from new button"); UnitConfig.Builder unitConfig = UnitConfig.newBuilder() .setLabel(LabelProcessor.addLabel(Label.newBuilder(), Locale.ENGLISH, label)); unitConfig.setUnitType(UnitTemplateType.UnitTemplate.UnitType.SCENE); unitConfig.getPlacementConfigBuilder().setLocationId(location.getConfig().getId()); unitConfig.setEnablingState(EnablingStateType.EnablingState.newBuilder() .setValue(EnablingStateType.EnablingState.State.ENABLED)); unitConfig.setSceneConfig(SceneConfig.getDefaultInstance()); lastSelected = Registries.getUnitRegistry().registerUnitConfig(unitConfig.build()).get(); updateDynamicComponents(); observable.notifyObservers(lastSelected.getSceneConfig()); } catch (CouldNotPerformException | InterruptedException | ExecutionException ex) { ExceptionPrinter.printHistory(ex, logger, LogLevel.ERROR); } }
From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java
/** * Creates dialogs in which the user can change the percentages of (place or * time-in-between) measurements to be counted as fast-slow-normal and * adjusts the metrics to these percentages. *///from w ww. ja v a 2s. c o m private void changeObjectPercentages() { if (elt1 instanceof ExtendedPlace) { // a place was selected // Create a dialog in which the user can fill in the percentage of // measurements that is counted as 'fast' String perc = JOptionPane.showInputDialog(this, "Enter the percentage of measurements\n" + " that is to be counted as 'fast': "); if (perc != null) { // Cancel button was not pressed try { fastestPlacePercentage = Double.parseDouble(perc); // check if the entered value is between 0 and 100 if (fastestPlacePercentage < 0 || fastestPlacePercentage > 100) { fastestPlacePercentage = 0; } } catch (Exception e) { // the entered string was not an integer-value Message.add("Exception: " + e.toString(), 2); fastestPlacePercentage = 0; } // Create a dialog in which the user can fill in the percentage // of // measurements that is counted as 'slow' String perc2 = JOptionPane.showInputDialog(this, "Enter the percentage of measurements\n" + " that is to be counted as 'slow': "); if (perc2 != null) { // Cancel was not pressed try { slowestPlacePercentage = Double.parseDouble(perc2); // check if the entered value is between 0 and 100 and // if // fastest + slowpercentage is below or equal to 100 if (slowestPlacePercentage < 0 || slowestPlacePercentage > 100 || (slowestPlacePercentage + fastestPlacePercentage) > 100) { slowestPlacePercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); slowestPlacePercentage = 0; } } // display the place metrics displayPlaceMetrics((ExtendedPlace) elt1); } } else { if (elt2 instanceof ExtendedTransition) { // two transitions selected String perc = JOptionPane.showInputDialog(this, "Enter the percentage of cases that is to be" + " counted as 'fast': "); if (perc != null) { try { fastestBetweenPercentage = Double.parseDouble(perc); if (fastestBetweenPercentage < 0 || fastestBetweenPercentage > 100) { fastestBetweenPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); fastestBetweenPercentage = 0; } String perc2 = JOptionPane.showInputDialog(this, "Enter the percentage of cases that is to be" + " counted as 'slow': "); if (perc2 != null) { try { slowestBetweenPercentage = Double.parseDouble(perc2); if (slowestBetweenPercentage < 0 || slowestBetweenPercentage > 100 || (slowestBetweenPercentage + fastestBetweenPercentage) > 100) { slowestBetweenPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); slowestBetweenPercentage = 0; } } ExtendedTransition otherTrans = (ExtendedTransition) elt1; ExtendedTransition lastTrans = (ExtendedTransition) elt2; // display the transition metrics displayTransitionMetrics(lastTrans, otherTrans); } } else { // one transition selected // if not a place selected, then one or two transitions selected String perc = JOptionPane.showInputDialog(this, "Enter the percentage of measurements that is to be" + " counted as 'fast': "); if (perc != null) { try { fastestActivityPercentage = Double.parseDouble(perc); if (fastestActivityPercentage < 0 || fastestActivityPercentage > 100) { fastestActivityPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); fastestActivityPercentage = 0; } String perc2 = JOptionPane.showInputDialog(this, "Enter the percentage of measurements that is" + " to be counted as 'slow': "); if (perc2 != null) { try { slowestActivityPercentage = Double.parseDouble(perc2); if (slowestActivityPercentage < 0 || slowestActivityPercentage > 100 || (slowestActivityPercentage + fastestActivityPercentage) > 100) { slowestActivityPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); slowestActivityPercentage = 0; } } ExtendedTransition trans = (ExtendedTransition) elt1; // display the transition metrics try { displayActivityMetrics(trans.getAssociatedActivity()); } catch (NullPointerException npe) { Message.add("No activity related to the selected transition.\n" + npe.toString(), 2); } } } } }
From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java
/** * Creates dialogs in which the user can change the percentages of process * instances to be counted as fast-slow-normal baed on their throughput * time. It also adjusts the process metrics to these percentages. *//*from w w w .j a v a 2s .c o m*/ private void changeProcessPercentages() { // Create a dialog in which the user can fill in the percentage of // cases that is to be counted as 'fast' String perc = JOptionPane.showInputDialog(this, "Enter the percentage of cases that is to be" + " counted as 'fast': "); if (perc != null) { try { fastestProcessPercentage = Double.parseDouble(perc); if (fastestProcessPercentage < 0 || fastestProcessPercentage > 100) { fastestProcessPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); fastestProcessPercentage = 0; } // Create a dialog in which the user can fill in the percentage of // cases that is to be counted as 'slow' String perc2 = JOptionPane.showInputDialog(this, "Enter the percentage of cases that is to be counted" + " as 'slow': "); if (perc2 != null) { // Cancel button was not pushed try { slowestProcessPercentage = Double.parseDouble(perc2); if (slowestProcessPercentage < 0 || slowestProcessPercentage > 100 || (slowestProcessPercentage + fastestProcessPercentage) > 100) { slowestProcessPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); slowestProcessPercentage = 0; } } // display the process metrics (based on the selected instances) displayProcessMetrics(getSelectedInstances()); } }
From source file:org.prom5.analysis.performance.PerformanceAnalysisGUI.java
/** * Creates dialogs in which the user can change the percentages of * (place or time-in-between) measurements to be counted as fast-slow-normal * and adjusts the metrics to these percentages. *//* w w w. java 2s. com*/ private void changeObjectPercentages() { if (elt1 instanceof ExtendedPlace) { //a place was selected //Create a dialog in which the user can fill in the percentage of //measurements that is counted as 'fast' String perc = JOptionPane.showInputDialog(this, "Enter the percentage of measurements\n" + " that is to be counted as 'fast': "); if (perc != null) { //Cancel button was not pressed try { fastestPlacePercentage = Double.parseDouble(perc); //check if the entered value is between 0 and 100 if (fastestPlacePercentage < 0 || fastestPlacePercentage > 100) { fastestPlacePercentage = 0; } } catch (Exception e) { //the entered string was not an integer-value Message.add("Exception: " + e.toString(), 2); fastestPlacePercentage = 0; } //Create a dialog in which the user can fill in the percentage of //measurements that is counted as 'slow' String perc2 = JOptionPane.showInputDialog(this, "Enter the percentage of measurements\n" + " that is to be counted as 'slow': "); if (perc2 != null) { //Cancel was not pressed try { slowestPlacePercentage = Double.parseDouble(perc2); //check if the entered value is between 0 and 100 and if //fastest + slowpercentage is below or equal to 100 if (slowestPlacePercentage < 0 || slowestPlacePercentage > 100 || (slowestPlacePercentage + fastestPlacePercentage) > 100) { slowestPlacePercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); slowestPlacePercentage = 0; } } //display the place metrics displayPlaceMetrics((ExtendedPlace) elt1); } } else { if (elt2 instanceof ExtendedTransition) { //two transitions selected String perc = JOptionPane.showInputDialog(this, "Enter the percentage of cases that is to be" + " counted as 'fast': "); if (perc != null) { try { fastestBetweenPercentage = Double.parseDouble(perc); if (fastestBetweenPercentage < 0 || fastestBetweenPercentage > 100) { fastestBetweenPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); fastestBetweenPercentage = 0; } String perc2 = JOptionPane.showInputDialog(this, "Enter the percentage of cases that is to be" + " counted as 'slow': "); if (perc2 != null) { try { slowestBetweenPercentage = Double.parseDouble(perc2); if (slowestBetweenPercentage < 0 || slowestBetweenPercentage > 100 || (slowestBetweenPercentage + fastestBetweenPercentage) > 100) { slowestBetweenPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); slowestBetweenPercentage = 0; } } ExtendedTransition otherTrans = (ExtendedTransition) elt1; ExtendedTransition lastTrans = (ExtendedTransition) elt2; //display the transition metrics displayTransitionMetrics(lastTrans, otherTrans); } } else { //one transition selected //if not a place selected, then one or two transitions selected String perc = JOptionPane.showInputDialog(this, "Enter the percentage of measurements that is to be" + " counted as 'fast': "); if (perc != null) { try { fastestActivityPercentage = Double.parseDouble(perc); if (fastestActivityPercentage < 0 || fastestActivityPercentage > 100) { fastestActivityPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); fastestActivityPercentage = 0; } String perc2 = JOptionPane.showInputDialog(this, "Enter the percentage of measurements that is" + " to be counted as 'slow': "); if (perc2 != null) { try { slowestActivityPercentage = Double.parseDouble(perc2); if (slowestActivityPercentage < 0 || slowestActivityPercentage > 100 || (slowestActivityPercentage + fastestActivityPercentage) > 100) { slowestActivityPercentage = 0; } } catch (Exception e) { Message.add("Exception: " + e.toString(), 2); slowestActivityPercentage = 0; } } ExtendedTransition trans = (ExtendedTransition) elt1; //display the transition metrics try { displayActivityMetrics(trans.getAssociatedActivity()); } catch (NullPointerException npe) { Message.add("No activity related to the selected transition.\n" + npe.toString(), 2); } } } } }