List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java
/** * Creates a panel for the demo (used by SuperDemo.java). * //from w w w.j a v a2s . c om * @return A panel. */ /* public static JPanel createDemoPanel() { JFreeChart chart = createChart(createDataset()); return new ChartPanel(chart); }*/ public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); System.out.println("From RegCorrAnal:: propertyName =" + propertyName + "!!!"); if (propertyName.equals("DataUpdate")) { //update the local version of the dataTable by outside source dataTable = (JTable) (e.getNewValue()); dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.doLayout(); System.out.println("From RegCorrAnal:: data UPDATED!!!"); } }
From source file:org.pmedv.blackboard.board.BoardDesignerPerspective.java
@Override protected void initializeComponents() { setLayout(new BorderLayout()); toolTabPane = new JTabbedPane(JTabbedPane.BOTTOM); horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); ctx = AppContext.getContext();/*from www. j ava2 s.com*/ resources = ctx.getBean(ResourceService.class); advisor = ctx.getBean(ApplicationWindowAdvisor.class); final String position = (String) Preferences.values .get("org.pmedv.blackboard.BoardDesignerPerspective.layerPanelPlacement"); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { viewMap = new ViewMap(); rootWindow = DockingUtil.createRootWindow(viewMap, true); rootWindow.getWindowBar(Direction.DOWN).setEnabled(true); rootWindow.getWindowProperties().setMinimizeEnabled(true); DockingWindowsTheme theme = new SoftBlueIceDockingTheme(); rootWindow.getRootWindowProperties().addSuperObject(theme.getRootWindowProperties()); rootWindow.getWindowProperties().getTabProperties().getHighlightedButtonProperties() .getCloseButtonProperties().setVisible(false); rootWindow.getWindowProperties().getTabProperties().getNormalButtonProperties() .getCloseButtonProperties().setVisible(false); editorArea = new TabWindow(); editorArea.getWindowProperties().getTabProperties().getNormalButtonProperties() .getCloseButtonProperties().setVisible(false); editorArea.getWindowProperties().getTabProperties().getHighlightedButtonProperties() .getCloseButtonProperties().setVisible(false); editorArea.getWindowProperties().getTabProperties().getNormalButtonProperties() .getMinimizeButtonProperties().setVisible(true); editorArea.getWindowProperties().getTabProperties().getHighlightedButtonProperties() .getMinimizeButtonProperties().setVisible(true); DockingWindowAdapter dockingAdapter = new DockingWindowAdapter() { @Override public void windowClosing(DockingWindow window) throws OperationAbortedException { } }; editorArea.addListener(dockingAdapter); setDockingListener(dockingAdapter); rootWindow.setWindow(editorArea); if (position.equalsIgnoreCase("left")) { horizontalSplitPane.setRightComponent(rootWindow); } else { horizontalSplitPane.setLeftComponent(rootWindow); } advisor.setCurrentEditorArea(editorArea); } }); JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer(); taskpanecontainer.setBackground(new Color(182, 191, 205)); JXTaskPane shapePane = new JXTaskPane(); shapePane.setTitle(resources.getResourceByKey("BoardDesignerPerspective.shapes.title")); shapePane.add(ctx.getBean(ShapePropertiesPanel.class)); taskpanecontainer.add(shapePane); ctx.getBean(ShapePropertiesPanel.class).getStartLineCombo().setSelectedItem(LineEdgeType.STRAIGHT); ctx.getBean(ShapePropertiesPanel.class).getEndLineCombo().setSelectedItem(LineEdgeType.STRAIGHT); ctx.getBean(ShapePropertiesPanel.class).getThicknessCombo().setSelectedItem(new BasicStroke(2.0f)); JXTaskPane layerPane = new JXTaskPane(); layerPane.setTitle(resources.getResourceByKey("BoardDesignerPerspective.layers")); layerPane.add(ctx.getBean(ShowLayersCommand.class).getLayerPanel()); taskpanecontainer.add(layerPane); JScrollPane scrollPane = new JScrollPane(taskpanecontainer); if (position.equalsIgnoreCase("left")) { horizontalSplitPane.setLeftComponent(toolTabPane); } else { horizontalSplitPane.setRightComponent(toolTabPane); } horizontalSplitPane.setOneTouchExpandable(true); horizontalSplitPane.setDividerSize(10); toolTabPane.addTab(resources.getResourceByKey("tooltab.forms"), resources.getIcon("icon.paint"), scrollPane); final SymbolListPanel symbolListPanel = ctx.getBean(SymbolListPanel.class); toolTabPane.addTab(resources.getResourceByKey("tooltab.symbols"), resources.getIcon("icon.symbols"), symbolListPanel); final ModelListPanel modelListPanel = ctx.getBean(ModelListPanel.class); toolTabPane.addTab(resources.getResourceByKey("tooltab.models"), resources.getIcon("icon.model"), modelListPanel); add(horizontalSplitPane, BorderLayout.CENTER); commandArea = new RSyntaxTextArea(); commandArea.setRows(1); commandArea.setColumns(100); JPanel commandPanel = new JPanel(new BorderLayout()); commandPanel.add(new JLabel("Command :"), BorderLayout.WEST); commandPanel.add(commandArea, BorderLayout.CENTER); commandArea.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createLineBorder(Color.BLACK))); add(commandPanel, BorderLayout.NORTH); setupAutoComplete(); commandArea.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (commandArea.getText().startsWith("add ") && commandArea.getText().length() > 4 && commandArea.hasFocus()) { PartFactory pf = AppContext.getContext().getBean(PartFactory.class); String tokens[] = commandArea.getText().split(" "); StringBuffer partName = new StringBuffer(); for (int i = 1; i < tokens.length; i++) { partName.append(tokens[i] + " "); } String name = partName.toString().trim(); if (pf.getPartnames().contains(name)) { e.consume(); commandArea.setText(""); BoardUtil.addPart(name, EditorUtils.getCurrentActiveEditor()); } } else if (commandArea.getText().equals("new")) { e.consume(); commandArea.setText(""); AppContext.getContext().getBean(CreateBoardCommand.class).execute(null); } else if (commandArea.getText().equals("resistor")) { e.consume(); commandArea.setText(""); AppContext.getContext().getBean(AddResistorCommand.class).execute(null); } else if (commandArea.getText().equals("diode")) { e.consume(); commandArea.setText(""); AppContext.getContext().getBean(AddDiodeCommand.class).execute(null); } else if (commandArea.getText().equals("text")) { e.consume(); commandArea.setText(""); AppContext.getContext().getBean(AddTextCommand.class).execute(null); } else if (commandArea.getText().equals("open")) { e.consume(); commandArea.setText(""); new OpenBoardCommand().execute(null); } else if (commandArea.getText().equals("save")) { e.consume(); commandArea.setText(""); AppContext.getContext().getBean(SaveBoardCommand.class).execute(null); } else if (commandArea.getText().equals("color")) { e.consume(); commandArea.setText(""); AppContext.getContext().getBean(ChooseColorCommand.class).execute(null); } } } }); horizontalSplitPane.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equalsIgnoreCase("dividerLocation")) { configProvider.getConfig().setDividerLocation(horizontalSplitPane.getDividerLocation()); } } }); ctx.getBean(ShapePropertiesPanel.class).getObjectField() .setText(resources.getResourceByKey("ShapePropertiesPanel.items.none")); ctx.getBean(ShapePropertiesPanel.class).getRotationSpinner().setEnabled(false); ctx.getBean(ShapePropertiesPanel.class).getStartAngleSpinner().setEnabled(false); initListeners(); }
From source file:FileTreeDropTarget.java
public void propertyChange(PropertyChangeEvent evt) { String propertyName = evt.getPropertyName(); if (propertyName.equals("enabled")) { // Enable the drop target if the FileTree is enabled // and vice versa. dropTarget.setActive(tree.isEnabled()); }//from ww w .j av a 2s . c om }
From source file:blue.automation.AutomationManager.java
private AutomationManager() { parameterActionListener = new ActionListener() { public void actionPerformed(ActionEvent ae) { if (data == null || selectedSoundLayer == null) { return; }//from www . j a v a2 s . co m JMenuItem menuItem = (JMenuItem) ae.getSource(); Parameter param = (Parameter) menuItem.getClientProperty("param"); parameterSelected(selectedSoundLayer, param); selectedSoundLayer = null; } }; renderTimeListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent pce) { if (pce.getSource() == data) { if (pce.getPropertyName().equals("renderStartTime")) { updateValuesFromAutomations(); } } } }; }
From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptingDialog.java
/** * Checks if the user can run the script. * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) *///w w w.j a v a 2 s. c o m public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (RowPane.MODIFIED_CONTENT_PROPERTY.equals(name)) canRunScript(); else if (IdentifierParamPane.DISPLAY_INFO_PROPERTY.equals(name)) { displayIdentifierInformation((Point) evt.getNewValue()); } }
From source file:org.tinymediamanager.ui.tvshows.TvShowExtendedSearchPanel.java
public TvShowExtendedSearchPanel(TvShowTreeModel model, JTree tree) { super();//from ww w .jav a2 s . co m setOpaque(false); shadowAlpha = 100; arcs = new Dimension(10, 10); this.tvShowTreeModel = model; this.tree = tree; // add a dummy mouse listener to prevent clicking through addMouseListener(new MouseAdapter() { }); listCheckListener = new ListCheckListener() { @Override public void removeCheck(ListEvent event) { actionFilter.actionPerformed(new ActionEvent(event.getSource(), 1, "checked")); } @Override public void addCheck(ListEvent event) { actionFilter.actionPerformed(new ActionEvent(event.getSource(), 1, "checked")); } }; setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, })); JLabel lblFilterBy = new JLabel(BUNDLE.getString("movieextendedsearch.filterby")); //$NON-NLS-1$ setComponentFont(lblFilterBy); add(lblFilterBy, "2, 2, 3, 1"); cbFilterNewEpisodes = new JCheckBox(""); cbFilterNewEpisodes.setAction(actionFilter); add(cbFilterNewEpisodes, "2, 4"); JLabel lblNewEpisodes = new JLabel(BUNDLE.getString("movieextendedsearch.newepisodes")); //$NON-NLS-1$ setComponentFont(lblNewEpisodes); add(lblNewEpisodes, "4, 4, right, default"); cbFilterWatched = new JCheckBox(""); cbFilterWatched.setAction(actionFilter); cbFilterWatched.setUI(CHECKBOX_UI); // $hide$ add(cbFilterWatched, "2, 5"); JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$ setComponentFont(lblWatched); add(lblWatched, "4, 5, right, default"); cbWatched = new SmallComboBox(WatchedFlag.values()); setComponentFont(cbWatched); cbWatched.setAction(actionFilter); add(cbWatched, "6, 5, fill, default"); cbFilterGenres = new JCheckBox(""); cbFilterGenres.setAction(actionFilter); cbFilterGenres.setUI(CHECKBOX_UI); // $hide$ add(cbFilterGenres, "2, 6"); JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$ setComponentFont(lblGenres); add(lblGenres, "4, 6, right, default"); cbGenres = new SmallComboBox(MediaGenres.values()); setComponentFont(cbGenres); cbGenres.setAction(actionFilter); add(cbGenres, "6, 6, fill, default"); cbFilterCast = new JCheckBox(""); cbFilterCast.setAction(actionFilter); cbFilterCast.setUI(CHECKBOX_UI); // $hide$ add(cbFilterCast, "2, 7"); JLabel lblCastMember = new JLabel(BUNDLE.getString("movieextendedsearch.cast")); //$NON-NLS-1$ setComponentFont(lblCastMember); add(lblCastMember, "4, 7, right, default"); tfCastMember = new JTextField(); setComponentFont(tfCastMember); tfCastMember.setBorder(new SmallTextFieldBorder()); add(tfCastMember, "6, 7, fill, default"); tfCastMember.setColumns(10); tfCastMember.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { actionFilter.actionPerformed(null); } @Override public void insertUpdate(DocumentEvent e) { actionFilter.actionPerformed(null); } @Override public void removeUpdate(DocumentEvent e) { actionFilter.actionPerformed(null); } }); cbFilterTag = new JCheckBox(""); cbFilterTag.setAction(actionFilter); cbFilterTag.setUI(CHECKBOX_UI); // $hide$ add(cbFilterTag, "2, 8"); JLabel lblTag = new JLabel(BUNDLE.getString("movieextendedsearch.tag")); //$NON-NLS-1$ setComponentFont(lblTag); add(lblTag, "4, 8, right, default"); cbTag = new SmallCheckComboBox(); cbTag.setTextFor(CheckComboBox.NONE, BUNDLE.getString("movieextendedsearch.tags.selected.none")); //$NON-NLS-1$ cbTag.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("movieextendedsearch.tags.selected.multiple")); //$NON-NLS-1$ cbTag.setTextFor(CheckComboBox.ALL, BUNDLE.getString("movieextendedsearch.tags.selected.all")); //$NON-NLS-1$ cbTag.getModel().addListCheckListener(listCheckListener); add(cbTag, "6, 8, fill, default"); cbFilterVideoFormat = new JCheckBox(""); cbFilterVideoFormat.setUI(CHECKBOX_UI); // $hide$ cbFilterVideoFormat.setAction(actionFilter); add(cbFilterVideoFormat, "2, 9"); JLabel lblVideoFormat = new JLabel(BUNDLE.getString("metatag.resolution")); //$NON-NLS-1$ setComponentFont(lblVideoFormat); add(lblVideoFormat, "4, 9, right, default"); cbVideoFormat = new SmallComboBox(getVideoFormats()); setComponentFont(cbVideoFormat); cbVideoFormat.setAction(actionFilter); add(cbVideoFormat, "6, 9, fill, default"); cbFilterVideoCodec = new JCheckBox(""); cbFilterVideoCodec.setAction(actionFilter); cbFilterVideoCodec.setUI(CHECKBOX_UI); // $hide$ add(cbFilterVideoCodec, "2, 10"); JLabel lblVideoCodec = new JLabel(BUNDLE.getString("metatag.videocodec")); //$NON-NLS-1$ setComponentFont(lblVideoCodec); add(lblVideoCodec, "4, 10, right, default"); cbVideoCodec = new SmallComboBox(); setComponentFont(cbVideoCodec); cbVideoCodec.setAction(actionFilter); add(cbVideoCodec, "6, 10, fill, default"); cbFilterAudioCodec = new JCheckBox(""); cbFilterAudioCodec.setAction(actionFilter); cbFilterAudioCodec.setUI(CHECKBOX_UI); // $hide$ add(cbFilterAudioCodec, "2, 11"); JLabel lblAudioCodec = new JLabel(BUNDLE.getString("metatag.audiocodec")); //$NON-NLS-1$ setComponentFont(lblAudioCodec); add(lblAudioCodec, "4, 11, right, default"); cbAudioCodec = new SmallComboBox(); setComponentFont(cbAudioCodec); cbAudioCodec.setAction(actionFilter); add(cbAudioCodec, "6, 11, fill, default"); cbFilterDatasource = new JCheckBox(""); cbFilterDatasource.setAction(actionFilter); cbFilterDatasource.setUI(CHECKBOX_UI); // $hide$ add(cbFilterDatasource, "2, 12"); JLabel lblDatasource = new JLabel(BUNDLE.getString("metatag.datasource")); //$NON-NLS-1$ setComponentFont(lblDatasource); add(lblDatasource, "4, 12, right, default"); cbDatasource = new SmallCheckComboBox(); cbDatasource.setTextFor(CheckComboBox.NONE, BUNDLE.getString("checkcombobox.selected.none")); //$NON-NLS-1$ cbDatasource.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("checkcombobox.selected.multiple")); //$NON-NLS-1$ cbDatasource.setTextFor(CheckComboBox.ALL, BUNDLE.getString("checkcombobox.selected.all")); //$NON-NLS-1$ cbDatasource.getModel().addListCheckListener(listCheckListener); add(cbDatasource, "6, 12, fill, default"); cbFilterMediaSource = new JCheckBox(""); cbFilterMediaSource.setAction(actionFilter); cbFilterMediaSource.setUI(CHECKBOX_UI); // $hide$ add(cbFilterMediaSource, "2, 13"); lblMediaSource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$ setComponentFont(lblMediaSource); add(lblMediaSource, "4, 13, right, default"); cbMediaSource = new SmallComboBox(MediaSource.values()); setComponentFont(cbMediaSource); cbMediaSource.setAction(actionFilter); add(cbMediaSource, "6, 13, fill, default"); cbFilterMissingMetadata = new JCheckBox(""); cbFilterMissingMetadata.setAction(actionFilter); cbFilterMissingMetadata.setUI(CHECKBOX_UI); // $hide$ add(cbFilterMissingMetadata, "2, 14"); JLabel lblMissingMetadata = new JLabel(BUNDLE.getString("movieextendedsearch.missingmetadata")); //$NON-NLS-1$ setComponentFont(lblMissingMetadata); add(lblMissingMetadata, "4, 14, right, default"); cbFilterMissingArtwork = new JCheckBox(""); cbFilterMissingArtwork.setAction(actionFilter); cbFilterMissingArtwork.setUI(CHECKBOX_UI); // $hide$ add(cbFilterMissingArtwork, "2, 15"); JLabel lblMissingArtwork = new JLabel(BUNDLE.getString("movieextendedsearch.missingartwork")); //$NON-NLS-1$ setComponentFont(lblMissingArtwork); add(lblMissingArtwork, "4, 15, right, default"); cbFilterMissingSubtitles = new JCheckBox(""); cbFilterMissingSubtitles.setAction(actionFilter); cbFilterMissingSubtitles.setUI(CHECKBOX_UI); // $hide$ add(cbFilterMissingSubtitles, "2, 16"); JLabel lblMissingSubtitles = new JLabel(BUNDLE.getString("movieextendedsearch.missingsubtitles")); //$NON-NLS-1$ setComponentFont(lblMissingSubtitles); add(lblMissingSubtitles, "4, 16, right, default"); cbFilterNewEpisodes.setUI(CHECKBOX_UI); // $hide$ PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() instanceof TvShowSettings && "tvShowDataSource".equals(evt.getPropertyName())) { buildAndInstallDatasourceArray(); } if (evt.getSource() instanceof TvShowList && "tag".equals(evt.getPropertyName())) { buildAndInstallTagsArray(); } if (evt.getSource() instanceof TvShowList && ("audioCodec".equals(evt.getPropertyName()) || "videoCodec".equals(evt.getPropertyName()))) { buildAndInstallCodecArray(); } } }; tvShowList.addPropertyChangeListener(propertyChangeListener); TvShowModuleManager.SETTINGS.addPropertyChangeListener(propertyChangeListener); buildAndInstallDatasourceArray(); buildAndInstallTagsArray(); buildAndInstallCodecArray(); }
From source file:com.jmstoolkit.queuebrowser.QueueBrowserView.java
/** * * @param app/* w w w.j av a 2s.com*/ */ public QueueBrowserView(SingleFrameApplication app) { super(app); _init(); initComponents(); // post components, finish inititalization based on initial values // of combo boxes try { this.jmsTemplate.setDefaultDestination( (Destination) this.jndiTemplate.lookup(destinationComboBox.getSelectedItem().toString())); connectionFactory.setTargetConnectionFactory( wrapConnectionFactory(connectionFactoryComboBox.getSelectedItem().toString())); } catch (NamingException ex) { messageTextArea.setText(JTKException.formatException(ex)); } catch (NullPointerException e) { // if we have no previous properties, we'll get NullPointerException from // the .toString()s... but we don't care. } // status bar initialization - message timeout, idle icon and busy animation, etc ResourceMap resourceMap = getResourceMap(); int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout"); messageTimer = new Timer(messageTimeout, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { statusMessageLabel.setText(""); } }); messageTimer.setRepeats(false); int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate"); for (int i = 0; i < busyIcons.length; i++) { busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]"); } busyIconTimer = new Timer(busyAnimationRate, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { busyIconIndex = (busyIconIndex + 1) % busyIcons.length; statusAnimationLabel.setIcon(busyIcons[busyIconIndex]); } }); idleIcon = resourceMap.getIcon("StatusBar.idleIcon"); statusAnimationLabel.setIcon(idleIcon); progressBar.setVisible(false); // connecting action tasks to status bar via TaskMonitor TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext()); taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { String propertyName = evt.getPropertyName(); if ("started".equals(propertyName)) { if (!busyIconTimer.isRunning()) { statusAnimationLabel.setIcon(busyIcons[0]); busyIconIndex = 0; busyIconTimer.start(); } progressBar.setVisible(true); progressBar.setIndeterminate(true); } else if ("done".equals(propertyName)) { busyIconTimer.stop(); statusAnimationLabel.setIcon(idleIcon); progressBar.setVisible(false); progressBar.setValue(0); } else if ("message".equals(propertyName)) { String text = (String) (evt.getNewValue()); statusMessageLabel.setText((text == null) ? "" : text); messageTimer.restart(); } else if ("progress".equals(propertyName)) { int value = (Integer) (evt.getNewValue()); progressBar.setVisible(true); progressBar.setIndeterminate(false); progressBar.setValue(value); } } }); }
From source file:org.wings.SFrame.java
public void propertyChange(PropertyChangeEvent pe) { if ("lookAndFeel".equals(pe.getPropertyName())) { updateComponentTreeCG(getContentPane()); }//w w w. ja va 2s . c o m if ("request.url".equals(pe.getPropertyName())) { setRequestURL((RequestURL) pe.getNewValue()); } }
From source file:com.ti.sensortag.gui.services.ServicesActivity.java
/** * This class listens to changes in the model of sensor values. * *///from w ww. jav a 2 s . c om @Override public void propertyChange(final PropertyChangeEvent event) { final String property = event.getPropertyName(); runOnUiThread(new Runnable() { public void run() { try { /*if (property.equals(PROPERTY_ACCELEROMETER)) { // A change in accelerometer data has occured. Point3D newValue = (Point3D) event.getNewValue(); String xaxis = decimal.format(newValue.x); String yaxis = decimal.format(newValue.y); String zaxis = decimal.format(newValue.z); String acl = "X: " + decimal.format(newValue.x) + "g" + "\nY: " + decimal.format(newValue.y) + "g" + "\nZ: " + decimal.format(newValue.z) + "g"; ((TextView) findViewById(R.id.accelerometerTxt)).setText(acl); } } else */if (property.equals(PROPERTY_AMBIENT_TEMPERATURE)) { double newAmbientValue = (Double) event.getNewValue(); final int img; TextView textView = (TextView) findViewById(R.id.ambientTemperatureTxt); String formattedText = "Touch Not Detected"; if (newAmbientValue == 11.00) { formattedText = "Touch Detected"; //img = touch; } else { //img = notouch; } //((ImageView) findViewById(R.id.touch)).setImageResource(img); textView.setText(formattedText); } /*ARVelse*/ else if (property.equals(PROPERTY_IR_TEMPERATURE)) { double newIRValue = (Double) event.getNewValue(); // float newIRValue_1 = (Float) event.getNewValue(); TextView textView = (TextView) findViewById(R.id.ir_temperature); String value = decimal.format(newIRValue); String formattedText = value + DEGREE_SYM; wakelockk.acquire(); textView.setText(formattedText); tempwriteintoafile(value); analyze(Float.valueOf(value), patient); // Added by Nihesh for analysis of incoming readings. //ARV /*try { java.util.Date date = new java.util.Date(); Timestamp chk = new Timestamp(date.getTime()); long timemilli = System.currentTimeMillis(); String abc = String.valueOf(timemilli);//chk.toString(); String separator = System.getProperty("line.separator"); File ext = Environment.getExternalStorageDirectory(); File myFile = new File(ext, "mysdfile_7.txt"); if(myFile.exists()){ try { FileOutputStream fOut = new FileOutputStream(myFile,true); OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut); myOutWriter.append(abc); myOutWriter.append(" "); myOutWriter.append(formattedText_1); myOutWriter.append(separator); myOutWriter.flush(); myOutWriter.close(); fOut.close(); } catch (Exception e) { // TODO: handle exception } } else{ myFile.createNewFile(); } // File myFile = new File("/sdcard/mysdfile.txt"); // myFile.createNewFile(); // FileOutputStream fOut = new FileOutputStream(myFile); //ARV OutputStreamWriter myOutWriter = //ARV new OutputStreamWriter(openFileOutput(FILENAME, Context.MODE_APPEND));//fOut // myOutWriter.append(txtData.getText()); //ARV myOutWriter.write(abc); //ARV myOutWriter.append(separator); //ARV myOutWriter.flush(); //ARV myOutWriter.close(); // fOut.close(); Toast.makeText(getBaseContext(), "Done writing SD 'mysdfile.txt'", Toast.LENGTH_SHORT).show(); } catch (Exception e) { Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_SHORT).show(); } //ARV */ } //endif /* else if (property.equals(PROPERTY_HUMIDITY)) { double newHumidity = (Double) event.getNewValue(); // ARV TextView textView = (TextView) findViewById(R.id.humidityTxt); String formattedText = decimal.format(newHumidity) + "%rH"; //ARV textView.setText(formattedText); } else if (property.equals(PROPERTY_MAGNETOMETER)) { Point3D newValue = (Point3D) event.getNewValue(); String msg = "X: " + decimal.format(newValue.x) + "uT" + "\nY: " + decimal.format(newValue.y) + "uT" + "\nZ: " + decimal.format(newValue.z) + "uT"; //ARV ((TextView) findViewById(R.id.magnetometerTxt)).setText(msg); } else if (property.equals(PROPERTY_GYROSCOPE)) { Point3D newValue = (Point3D) event.getNewValue(); String msg = "X: " + decimal.format(newValue.x) + "deg/s" + "\nY: " + decimal.format(newValue.y) + "deg/s" + "\nZ: " + decimal.format(newValue.z) + "deg/s"; //ARV ((TextView) findViewById(R.id.gyroscopeTxt)).setText(msg); } else if (property.equals(Measurements.PROPERTY_BAROMETER)) { Double newValue = (Double) event.getNewValue(); String msg = new DecimalFormat("+0.0;-0.0").format(newValue / 100) + " hPa"; //ARV ((TextView) findViewById(R.id.barometerTxt)).setText(msg); } else if (property.equals(PROPERTY_SIMPLE_KEYS)) { SimpleKeysStatus newValue = (SimpleKeysStatus) event.getNewValue(); final int img; switch (newValue) { case OFF_OFF: img = buttonsoffoff; break; case OFF_ON: img = buttonsoffon; break; case ON_OFF: img = buttonsonoff; break; case ON_ON: img = buttonsonon; break; default: throw new UnsupportedOperationException(); } ((ImageView) findViewById(R.id.buttons)).setImageResource(img); }*/ else if (property.equals(LOST_DEVICE_ + CONNECTED)) { // A device has been disconnected // We notify the user with a toast int duration = Toast.LENGTH_SHORT; String text = "Lost connection"; Toast.makeText(ServicesActivity.this, text, duration).show(); finish(); } else if (property.equals(NEW_DEVICE_ + CONNECTED)) { // A device has been disconnected // We notify the user with a toast int duration = Toast.LENGTH_SHORT; String text = "Established connection"; Toast.makeText(ServicesActivity.this, text, duration).show(); } } catch (NullPointerException e) { e.printStackTrace(); // Could be that the ServicesFragment is no longer visible // But we still receive property change events. // referring to the views with findViewById will then return a null. } } }); }