List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:pcgui.SetupParametersPanel.java
private void runModel() { //retrieve master configuration ArrayList<ArrayList<Object>> mod = model.getData(); //create a new list and check for dependencies ArrayList<Symbol> list = new ArrayList<Symbol>(); //independent variable list ArrayList<Symbol> ivList = new ArrayList<Symbol>(); //step variable list ArrayList<Symbol> stepList = new ArrayList<Symbol>(); //dependent list ArrayList<Symbol> depList = new ArrayList<Symbol>(); //output tracking ArrayList<Symbol> trackedSymbols = new ArrayList<Symbol>(); Symbol tempSym = null;/*from www. ja v a 2 s. c o m*/ //step variable counter to be used for making combinations int stepVarCount = 0; long stepCombinations = 1; TextParser textParser = new TextParser(); compileSuccess = true; for (ArrayList<Object> rowData : mod) { tempSym = paramList.get(mod.indexOf(rowData)); if ("Manual".equals((String) rowData.get(2))) { System.out.println("Found Customized Symbol : " + rowData.get(0)); System.out.println("Value : " + rowData.get(3) + ": type=" + rowData.get(3).getClass()); tempSym.mode = "Manual"; String data = (String) rowData.get(3); //checking dependent variables if (data != null && !data.isEmpty()) { //dependent if (hashTable.containsKey(data)) { tempSym.setDependent(true); depList.add(tempSym); } else { //independents tempSym.setDependent(false); tempSym.set(data); ivList.add(tempSym); } } } else if ("External".equals((String) rowData.get(2))) { System.out.println("Found External Symbol : " + rowData.get(0)); System.out.println("External : " + rowData.get(3) + ": type=" + rowData.get(3).getClass()); if (!(((String) rowData.get(4)).isEmpty())) { tempSym.externalFile = (String) rowData.get(4); tempSym.set(tempSym.externalFile); tempSym.mode = "External"; if (tempSym.externalFile.endsWith(".xls") || tempSym.externalFile.endsWith(".xlsx")) { if (tempSym.excelFileRange.isEmpty()) { // TODO show an error dialog System.err.println("Error user missed excel range arguments"); JOptionPane.showMessageDialog(new JFrame(), "Error user missed excel range arguments"); return; } else { tempSym.excelFileRange = (String) rowData.get(5); //'[Daten_10$B'+(i)+':B'+(5+n)+']' //user has to add quote before the 1st + and after the last + //the data file used should be inside Models/Data folder tempSym.set("Models//Data//" + tempSym.externalFile + "::" + tempSym.excelFileRange); } } else { //for non excel files tempSym.set("Models//Data//" + tempSym.externalFile); } } else { System.err.println("Error user missed excel file"); JOptionPane.showMessageDialog(new JFrame(), "Please enter external file for variable : " + tempSym.name); return; } ivList.add(tempSym); list.add(tempSym); } else if ("Randomized".equals((String) rowData.get(2))) { System.out.println("Found Randomized Symbol : " + rowData.get(0)); System.out.println("Value : " + rowData.get(6)); boolean isValid = textParser.validate((String) rowData.get(6)); if (isValid) { //saving the array declaration parameters if (((String) rowData.get(1)).trim().startsWith("array")) { System.out.println("Found randomized array : " + tempSym.name); //found an array tempSym.isArray = true; List<String> arrayParams = parseArrayParam((String) rowData.get(1)); tempSym.arrayParams = arrayParams; System.out.println("Param list : "); for (Object obj : tempSym.arrayParams) { //check if any of the param is symbol if (hashTable.containsKey((String) obj)) { tempSym.isDependentDimension = true; depList.add(tempSym); break; } System.out.println((String) obj); } //add to independent variable list if none of the dimension is based on variable if (!tempSym.isDependentDimension) { ivList.add(tempSym); } } Distribution dist = textParser.getDistribution((String) rowData.get(6)); if ("Step".equalsIgnoreCase(dist.getDistribution())) { System.err.println("Error: User entered step distribution in Randomized variable"); JOptionPane.showMessageDialog(new JFrame(), "Please enter random distribution only" + " for variable : " + tempSym.name); return; } tempSym.setDistribution(dist); tempSym.mode = "Randomized"; //check dependent variables List<String> distParamList = dist.getParamList(); for (String param : distParamList) { //TODO: if .contains work on Symbol if (hashTable.containsKey(param) && !depList.contains(tempSym)) { tempSym.setDependent(true); depList.add(tempSym); break; } } //generate apache distribution object for independent vars if (!tempSym.isDependent()) { Object apacheDist = generateDistribution(tempSym); tempSym.setApacheDist(apacheDist); if ("StepDistribution".equals(apacheDist.getClass().getSimpleName())) { stepVarCount++; StepDistribution stepDist = (StepDistribution) apacheDist; stepCombinations *= stepDist.getStepCount(); tempSym.isStepDist = true; tempSym.setStepDist(stepDist); stepList.add(tempSym); } else if (!ivList.contains(tempSym) && !tempSym.isDependentDimension) { ivList.add(tempSym); } } list.add(tempSym); } else { System.err.println("Error: User entered unknown distribution for randomized variable"); JOptionPane.showMessageDialog(new JFrame(), "Please enter random distribution only" + " for variable : " + tempSym.name); return; } } else if ("Step".equals((String) rowData.get(2))) { System.out.println("Found Step Symbol : " + rowData.get(0)); System.out.println("Value : " + rowData.get(6)); Distribution dist = textParser.getStepDistribution((String) rowData.get(6)); if (dist == null || !"Step".equalsIgnoreCase(dist.getDistribution())) { System.err.println("Error: User entered unknown distribution for step variable"); JOptionPane.showMessageDialog(new JFrame(), "Please enter random distribution only" + " for variable : " + tempSym.name); return; } boolean isValid = textParser.validateStepDist((String) rowData.get(6)); if (isValid) { //saving the array declaration parameters if (((String) rowData.get(1)).trim().startsWith("array")) { //TODO: if this can work for step arrays System.out.println("Found step array : " + tempSym.name); //found an array tempSym.isArray = true; List<String> arrayParams = parseArrayParam((String) rowData.get(1)); tempSym.arrayParams = arrayParams; System.out.println("Param list : "); for (Object obj : tempSym.arrayParams) { //check if any of the param is symbol if (hashTable.containsKey((String) obj)) { tempSym.isDependentDimension = true; depList.add(tempSym); break; } System.out.println((String) obj); } //add to independent variable list if none of the dimension is based on variable if (!tempSym.isDependentDimension) { ivList.add(tempSym); } } tempSym.setDistribution(dist); tempSym.mode = "Randomized"; //check dependent variables List<String> distParamList = dist.getParamList(); for (String param : distParamList) { if (hashTable.containsKey(param) && !depList.contains(tempSym)) { tempSym.setDependent(true); depList.add(tempSym); break; } } //generate apache distribution object for independent vars if (!tempSym.isDependent()) { Object apacheDist = generateDistribution(tempSym); tempSym.setApacheDist(apacheDist); //dual safe check if ("StepDistribution".equals(apacheDist.getClass().getSimpleName())) { stepVarCount++; StepDistribution stepDist = (StepDistribution) apacheDist; stepCombinations *= stepDist.getStepCount(); tempSym.isStepDist = true; tempSym.setStepDist(stepDist); stepList.add(tempSym); } else if (!ivList.contains(tempSym) && !tempSym.isDependentDimension) { ivList.add(tempSym); } } list.add(tempSym); } else { System.err.println("Error: User entered unknown distribution for randomized variable"); JOptionPane.showMessageDialog(new JFrame(), "Please enter random distribution only" + " for variable : " + tempSym.name); return; } } //add symbol to trackedSymbol list for output tracking if (tempSym != null && rowData.get(7) != null && (boolean) rowData.get(7)) { trackedSymbols.add(tempSym); } } System.out.println("Total step distribution variables =" + stepVarCount); System.out.println("Total step combinations =" + stepCombinations); System.out.println("====STEP VARIABLES===="); for (Symbol sym : stepList) { System.out.println(sym.name); } //resolve dependencies and generate random distributions object //list for an instance of execution HashMap<String, Integer> map = new HashMap<String, Integer>(); for (int i = 0; i < stepList.size(); i++) { map.put(stepList.get(i).name, getSteppingCount(stepList, i)); System.out.println(stepList.get(i).name + " has stepping count =" + map.get(stepList.get(i).name)); } int repeatitions = 0; try { repeatitions = Integer.parseInt(repeatCount.getText()); } catch (NumberFormatException e) { System.err.println("Invalid repeat count"); JOptionPane.showMessageDialog(new JFrame(), "Please enter integer value for repeat count"); return; } //generate instances showProgressBar(); final long totalIterations = repeatitions * stepCombinations; final long repeatitionsFinal = repeatitions; final long combinations = stepCombinations; SwingWorker<Void, Void> executionTask = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { long itNum = 1; int itCount = 1; System.out.println("Total iterations: " + totalIterations); // TODO Auto-generated method stub for (int c = 1; c <= repeatitionsFinal; c++) { for (int i = 1; i <= combinations; i++) { setProgress((int) (itNum * 100 / totalIterations)); //step variables first for (Symbol sym : stepList) { if (map.get(sym.name) == 1 || i % map.get(sym.name) - 1 == 0 || i == 1) { sym.set(sym.getStepDist().sample()); hashTable.put(sym.name, sym); } //System.out.println(sym.name+" = "+sym.get()); } //independent randomized variables for (Symbol sym : ivList) { if (sym.mode.equals("Randomized")) { Object distObj = sym.getApacheDist(); switch (sym.getApacheDist().getClass().getSimpleName()) { case "UniformIntegerDistribution": //case "GeometricDistribution" : // case "BinomialDistribution"://not implemented yet IntegerDistribution intDist = (IntegerDistribution) distObj; if (sym.isArray) { //generate Stringified array String val = generateIndependentArray(sym, intDist); sym.set(val); hashTable.put(sym.name, sym); } break; case "LogisticDistribution": case "UniformRealDistribution": case "ExponentialDistribution": case "GammaDistribution": case "NormalDistribution": RealDistribution realDist = (RealDistribution) distObj; if (sym.isArray) { //generate Stringified array String val = generateIndependentArray(sym, realDist); sym.set(val); hashTable.put(sym.name, sym); } break; default: System.err.println("Unknown distribution"); JOptionPane.showMessageDialog(new JFrame(), "Error occurred : Unknown distribution"); return null; } } //System.out.println(sym.name+" = "+sym.get()); //other types of independent variable already have values } for (Symbol sym : depList) { if (sym.mode != null && "Manual".equals(sym.mode)) { //value depends on some other value String ref = (String) sym.get(); Object val = (Object) hashTable.get(ref); sym.set(val); hashTable.put(sym.name, sym); } else if (sym.mode != null && "Randomized".equals(sym.mode)) { Object distObj = null; //when a random distribution depends on another variable Distribution dist = sym.getDistribution(); StringBuilder sb = new StringBuilder(); sb.append(dist.getDistribution()); sb.append("("); for (String s : dist.getParamList()) { //replacing a dependency by actual value of that variable if (hashTable.containsKey(s)) { Symbol val = (Symbol) hashTable.get(s); sb.append((String) val.get()); } else { //this param is a number itself sb.append(s); } sb.append(","); } //check if param list length = 0 if (dist.getParamList() != null && dist.getParamList().size() >= 1) { sb.deleteCharAt(sb.length() - 1); } sb.append(")"); if (sym.typeString != null && sym.typeString.contains("integer")) { try { distObj = textParser.parseText(sb.toString(), TextParser.INTEGER); sym.setApacheDist(distObj); } catch (Exception e) { System.err.println( "Exception occured when trying to get Random distribution for variable" + sym.name + "\n" + e.getMessage()); e.printStackTrace(); JOptionPane.showMessageDialog(new JFrame(), "Error occurred : " + e.getMessage()); return null; } } else { try { distObj = textParser.parseText(sb.toString(), TextParser.REAL); sym.setApacheDist(distObj); } catch (Exception e) { System.err.println( "Exception occured when trying to get Random distribution for variable" + sym.name + "\n" + e.getMessage()); e.printStackTrace(); JOptionPane.showMessageDialog(new JFrame(), "Error occurred : " + e.getMessage()); return null; } } //generation of actual apache distribution objects switch (distObj.getClass().getSimpleName()) { case "UniformIntegerDistribution": //case "GeometricDistribution" : //case "BinomialDistribution": IntegerDistribution intDist = (IntegerDistribution) distObj; if (sym.isArray) { //generate Stringified array String val = generateDependentArray(sym, intDist); sym.set(val); hashTable.put(sym.name, sym); } break; case "LogisticDistribution": case "UniformRealDistribution": case "ExponentialDistribution": case "GammaDistribution": case "NormalDistribution": RealDistribution realDist = (RealDistribution) distObj; if (sym.isArray) { //generate Stringified array String val = generateDependentArray(sym, realDist); sym.set(val); hashTable.put(sym.name, sym); } break; default: System.err.println("Unknown distribution"); JOptionPane.showMessageDialog(new JFrame(), "Error occurred : Unknown distribution"); } } //System.out.println(sym.name+" = "+sym.get()); } ArrayList<Symbol> instanceList = new ArrayList<Symbol>(); instanceList.addAll(stepList); instanceList.addAll(ivList); instanceList.addAll(depList); System.out.println("=======ITERATION " + itCount++ + "======="); System.out.println("=======instanceList.size =" + instanceList.size() + " ======="); for (Symbol sym : instanceList) { System.out.println(sym.name + " = " + sym.get()); } //runModel here try { //TODO anshul: pass output variables to be written to excel System.out.println("Tracked output symbols"); for (Symbol sym : trackedSymbols) { System.out.println(sym.name); } HashMap<String, OutputParams> l = parser.changeModel(instanceList, trackedSymbols, itNum); if (l == null) { compileSuccess = false; break; } } catch (/*XPRMCompileException | */XPRMLicenseError | IOException e) { e.printStackTrace(); JOptionPane.showMessageDialog(new JFrame(), "Error occurred : " + e.getMessage()); compileSuccess = false; break; } itNum++; } } this.notifyAll(); done(); return null; } @Override protected void done() { super.done(); //check if compilation was successful if (compileSuccess) { ModelSaver.saveModelResult(); visPanel.setTrackedVariables(trackedSymbols); mapVisPanel.setTrackedVariables(trackedSymbols); JOptionPane.showMessageDialog(new JFrame("Success"), "Model execution completed.\nOutput written to excel file : " + outputFile); } else { //Error popup should have been shown by ModelParser System.err.println("There was an error while running the model."); return; } if (progressFrame != null) { progressFrame.dispose(); } } }; executionTask.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if ("progress" == evt.getPropertyName()) { int progress = (Integer) evt.getNewValue(); if (pbar != null) pbar.setValue(progress); if (taskOutput != null) taskOutput.append(String.format("Completed %d%% of task.\n", executionTask.getProgress())); } } }); executionTask.execute(); }
From source file:op.care.bhp.PnlBHP.java
private java.util.List<Component> addFilter() { java.util.List<Component> list = new ArrayList<Component>(); jdcDatum = new JDateChooser(new Date()); jdcDatum.setFont(new Font("Arial", Font.PLAIN, 18)); jdcDatum.setMinSelectableDate(BHPTools.getMinDatum(resident)); jdcDatum.setBackground(Color.WHITE); jdcDatum.addPropertyChangeListener(new PropertyChangeListener() { @Override// ww w.ja v a 2s . c om public void propertyChange(PropertyChangeEvent evt) { if (initPhase) { return; } if (evt.getPropertyName().equals("date")) { reloadDisplay(); } } }); list.add(jdcDatum); JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.WHITE); buttonPanel.setLayout(new HorizontalLayout(5)); buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0)); JButton homeButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png"))); homeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDatum.setDate(jdcDatum.getMinSelectableDate()); } }); homeButton.setPressedIcon( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start_pressed.png"))); homeButton.setBorder(null); homeButton.setBorderPainted(false); homeButton.setOpaque(false); homeButton.setContentAreaFilled(false); homeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton backButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back.png"))); backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDatum.getDate()); DateMidnight min = new DateMidnight(jdcDatum.getMinSelectableDate()); if (current.equals(min)) { return; } jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), -1)); } }); backButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back_pressed.png"))); backButton.setBorder(null); backButton.setBorderPainted(false); backButton.setOpaque(false); backButton.setContentAreaFilled(false); backButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton fwdButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play.png"))); fwdButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDatum.getDate()); if (current.equals(new DateMidnight())) { return; } jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), 1)); } }); fwdButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play_pressed.png"))); fwdButton.setBorder(null); fwdButton.setBorderPainted(false); fwdButton.setOpaque(false); fwdButton.setContentAreaFilled(false); fwdButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton endButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png"))); endButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDatum.setDate(new Date()); } }); endButton.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end_pressed.png"))); endButton.setBorder(null); endButton.setBorderPainted(false); endButton.setOpaque(false); endButton.setContentAreaFilled(false); endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); buttonPanel.add(homeButton); buttonPanel.add(backButton); buttonPanel.add(fwdButton); buttonPanel.add(endButton); list.add(buttonPanel); // panelFilter.setContentPane(labelPanel); return list; }
From source file:org.openconcerto.sql.model.SQLDataSource.java
private SQLDataSource(DBSystemRoot sysRoot) { this.sysRoot = sysRoot; // on a besoin d'une implementation synchronise this.handlers = new Hashtable<Thread, HandlersStack>(); // weak, since this is only a hint to avoid initializing the connection // on each borrowal this.schemaUptodate = new WeakHashMap<Connection, Object>(); this.uptodate = new WeakHashMap<Connection, Object>(); this.initialShemaSet = false; this.initialShema = null; // see #getNewConnection(boolean) this.setValidationQuery("SELECT 1"); this.setTestOnBorrow(false); this.setInitialSize(3); this.setMaxActive(48); // creating connections is quite costly so make sure we always have a couple free this.setMinIdle(2); // but not too much as it can lock out other users (the server has a max connection count) this.setMaxIdle(16); this.setBlockWhenExhausted(false); // check 5 connections every 4 seconds this.setTimeBetweenEvictionRunsMillis(4000); this.setNumTestsPerEvictionRun(5); // kill extra (above minIdle) connections after 40s this.setSoftMinEvictableIdleTimeMillis(TimeUnit.SECONDS.toMillis(40)); // kill idle connections after 30 minutes (even if it means re-creating some new ones // immediately afterwards to ensure minIdle connections) this.setMinEvictableIdleTimeMillis(TimeUnit.MINUTES.toMillis(30)); // the default of many systems this.txIsolation = Connection.TRANSACTION_READ_COMMITTED; // by definition unknown without a connection this.dbTxIsolation = null; // it's rare that DB configuration changes, and it's expensive to add a trip to the server // for each new connection this.checkOnceDBTxIsolation = true; // see #createDataSource() for properties not supported by this class this.tables = Collections.emptySet(); this.descL = new PropertyChangeListener() { @Override/* ww w . j a va 2 s . c o m*/ public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("descendants")) { // the dataSource must always have all tables, to listen to them for its cache setTables(((DBSystemRoot) evt.getSource()).getDescs(SQLTable.class)); } } }; this.sysRoot.addListener(this.descL); this.cache = null; this.cacheEnabled = false; }
From source file:br.com.jinsync.view.FrmJInSync.java
private void expExcelBook() { ExportExcelBook expBook = new ExportExcelBook(); expBook.setTableName(tableCopy);/*from w w w .j av a2 s . c o m*/ expBook.setNameFile(txtPath.getText()); EnableComponents.enable(tabCopybook, false); grpFontes.setEnabledAt(1, false); grpFontes.setEnabledAt(2, false); expBook.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (name.equals("state")) { SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue(); switch (state) { case DONE: EnableComponents.enable(tabCopybook, true); grpFontes.setEnabledAt(1, true); grpFontes.setEnabledAt(2, true); } } } }); expBook.execute(); }
From source file:br.com.jinsync.view.FrmJInSync.java
private void expExcelString() { ExportExcelString expString = new ExportExcelString(); expString.setTableName(tableString); expString.setNameFile(txtPath.getText()); expString.setTipoConteudo(contentType); expString.setTamanhoConteudo(contentLength); expString.setDecimalConteudo(contentDecimal); expString.setTotalConteudo(contentTotal); EnableComponents.enable(tabString, false); grpFontes.setEnabledAt(0, false);//from w ww .j a v a2 s . c om grpFontes.setEnabledAt(2, false); expString.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (name.equals("state")) { SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue(); switch (state) { case DONE: EnableComponents.enable(tabString, true); grpFontes.setEnabledAt(0, true); grpFontes.setEnabledAt(2, true); } } } }); expString.execute(); }
From source file:br.com.jinsync.view.FrmJInSync.java
private void expExcelFile() { progressBar.setStringPainted(true);//from w w w .ja va 2 s .c om progressBar.setValue(0); btnExcelFile.setEnabled(false); ExportExcelFile exportExcelFile = new ExportExcelFile(); exportExcelFile.setTableName(tableFile); exportExcelFile.setName(txtFile.getText()); EnableComponents.enable(tabFile, false); grpFontes.setEnabledAt(0, false); grpFontes.setEnabledAt(1, false); exportExcelFile.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (name.equals("progress")) { int progress = (int) evt.getNewValue(); progressBar.setValue(progress); progressBar.setString(Language.msgExportingExcel + progress + "%"); repaint(); } else if (name.equals("state")) { SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue(); switch (state) { case DONE: EnableComponents.enable(tabFile, true); grpFontes.setEnabledAt(0, true); grpFontes.setEnabledAt(1, true); } } } }); exportExcelFile.execute(); }
From source file:br.com.jinsync.view.FrmJInSync.java
private void processFile(String nameCopy) { loadColumnsLayoutTableFile();// w ww . ja va2s. c om String arq = nameCopy; int lenFile = 0; int qtdColumns = columnNamesFile.length; tableFileModel = new FileTableModel(columnNamesFile, qtdColumns); isProcessStarted = true; tabFile.setFocusable(true); tabFile.requestFocusInWindow(); grpFontes.setEnabledAt(0, false); grpFontes.setEnabledAt(1, false); try { lenFile = Integer.parseInt(txtLength.getText()); } catch (NumberFormatException e) { lenFile = qtdLargerGrp; } tbWorker = new TableSwingWorker(tableFileModel, listTotCopy, arq, lenFile, progressBar, tabFile); tbWorker.execute(); loadLayoutTableFile(); tbWorker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (name.equals("state")) { SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue(); switch (state) { case DONE: isProcessStarted = false; grpFontes.setEnabledAt(0, true); grpFontes.setEnabledAt(1, true); } } } }); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java
/** * Sets the currently selected rating value. * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */// www .ja v a2 s .co m public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (RatingComponent.RATE_PROPERTY.equals(name)) { int newValue = (Integer) evt.getNewValue(); if (newValue != selectedValue) { selectedValue = newValue; view.saveData(true); } } else if (RatingComponent.RATE_END_PROPERTY.equals(name)) { view.saveData(true); } }
From source file:ucar.unidata.idv.control.JythonControl.java
/** * Make the probe for this instance//from w w w . ja v a 2 s . com * * @throws RemoteException Java RMI error * @throws VisADException VisAD Error */ private void doMakeProbe() throws VisADException, RemoteException { if (getDisplayInfos().size() > 0) { removeDisplayables(); } transectProbe = null; verticalProbe = null; pointProbe = null; areaProbe = null; levelProbe = null; lastProbeLocation = null; boolean displayIs3D = isDisplay3D(); //Make sure we have a probeType if (probeType == null) { probeType = PROBE_NONE; } probeType = probeType.trim(); PropertyChangeListener listener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (!getHaveInitialized()) { return; } if (evt.getPropertyName().equals(SelectorDisplayable.PROPERTY_POSITION)) { probeMoved(); } } }; SelectorDisplayable probe = null; //TODO: Have the non-point probes be fixed in z if (probeType.equals(PROBE_POINT)) { pointProbe = new PointProbe(0.0, 0.0, 0.0); probe = pointProbe; if (initPosition != null) { pointProbe.setPosition((RealTuple) initPosition); } } else if (probeType.equals(PROBE_LEVEL)) { levelProbe = new ZSelector(-1, -1, -1); probe = levelProbe; if (initPosition != null) { levelProbe.setZValue(((Real) initPosition).getValue()); } } else if (probeType.equals(PROBE_AREA)) { areaProbe = new AreaProbe(); probe = areaProbe; if (initPosition != null) { areaProbe.setPosition((RealTuple) initPosition); } } else if (probeType.equals(PROBE_TRANSECT)) { transectProbe = new CrossSectionSelector(); transectProbe.setZValue(.95f); probe = transectProbe; if (initPosition != null) { transectProbe.setPosition((RealTuple[]) initPosition); } } else if (probeType.equals(PROBE_VERTICAL)) { verticalProbe = (getDisplayAltitudeType().equals(Display.Radius)) ? new LineProbe(new RealTuple(RealTupleType.SpatialEarth2DTuple, new double[] { 0, 0 })) : new LineProbe(); if (initPosition != null) { verticalProbe.setPosition((RealTuple) initPosition); } // it is a little colored cube 8 pixels across probe = verticalProbe; } else if (probeType.equals(PROBE_NONE)) { } if (probe != null) { addDisplayable(probe, FLAG_COLOR); Color color = getColor(); if (color == null) { color = Color.blue; } probe.setColor(color); probe.addPropertyChangeListener(listener); probe.setPointSize(getDisplayScale()); probe.setVisible(true); probe.setAutoSize(true); } initPosition = null; }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java
/** * Listens to property changes in the bound property * RegistryBrowser.PROPERTY_LOCALE./*from www . ja v a2 s. c om*/ */ public void propertyChange(PropertyChangeEvent ev) { if (ev.getPropertyName().equals(PROPERTY_LOCALE)) { processLocaleChange((Locale) ev.getNewValue()); } }