@Override public void update(Observable arg0, Object arg1) { if(arg1 instanceof IndicatorCandle) { IndicatorCandle candle = (IndicatorCandle)arg1; System.out.println(candle.toString()); System.out.println(candle.getTimeFrame()); for(AIndicator indi: candle.getIndicators().values()) { System.out.print("Indicator: " + indi.getClass().getSimpleName() + " Plotables: "); for(Plotable p: indi.getPlotables()) { try { System.out.print(p.getMethodToPlot().invoke(indi, null)+"; "); } catch (Exception e) { e.printStackTrace(); } } System.out.println(); } System.out.println(); } }
@Override public void update(Observable o, Object arg) { if (arg.getClass().equals(Notification.class)){ Notification ret = (Notification) arg; //SPU processing ended logger.debug( "SPU "+ret.getSPUID()+" proccesing ended"); subscriptionProcessingEnded(ret.getSPUID()); //Send notification if required if (!ret.toBeNotified()) return; else { logger.debug( "Notify observers"); setChanged(); notifyObservers(ret); } } else { logger.debug( "Notify observers"); setChanged(); notifyObservers(arg); } }
/** The central point for communication with HW from biasgen. All objects in Biasgen are Observables and add Biasgen.this as Observer. They then call notifyObservers when their state changes. * @param observable IPot, Scanner, etc * @param object not used at present */ @Override synchronized public void update(Observable observable, Object object) { // thread safe to ensure gui cannot retrigger this while it is sending something // log.info(observable + " sent " + object); if (this.hardwareInterface == null) { return; } // "economised" BufferIPot (what's that for anyway??) if ((observable instanceof VPot) || (observable instanceof IPot)) { try { hardwareInterface.sendConfiguration(this); } catch (HardwareInterfaceException ex) { log.warning("could not send configuration : " + ex); } } else { super.update(observable, object); // super (Biasgen) handles others, e.g. maasterbias } }
/** called when Observable changes (pot changes) */ @Override public void update(Observable observable, Object obj) { if (observable instanceof ConfigurableIPotRev0) { // log.info("observable="+observable); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // don't do the following - it sometimes prevents display updates or results in double updates // slider.setValueIsAdjusting(true); // try to prevent a new event from the slider updateAppearance(); } }); } }
@Test public void testImportExcelMultipleError() { ResetTestValue.reset(); ImportHandler handler = new ImportHandler( new RowRecordPersistencorHibernateImpl(factory), TransactionMode.MULTIPLE); List<RowRecord> list = handler.importExcel( ExcelFactory.newExcel(new File("D:/test/schoolman_error.xlsx")), new Observer() { @Override public void update(Observable o, Object arg) { Process process = (Process) arg; System.out.println("进度:" + process.getProcess() + ",当前阶段:" + process.getNode()); } }, SchoolMan.class); for (RowRecord rr : list) { System.out.println("行号:" + rr.getRowNo() + ", 错误信息:" + rr.getResult().getMsg()); } }
/** called when Observable changes (pot changes) */ @Override public void update(final Observable observable, final Object obj) { if (observable instanceof IPot) { // log.info("observable="+observable); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // don't do the following - it sometimes prevents display updates or results in double updates // slider.setValueIsAdjusting(true); // try to prevent a new event from the slider updateAppearance(); } }); } }
@Override public void update(Observable obs, Object obj) { if (obs instanceof V2GCommunicationSessionEVCC && (obj instanceof PauseSession || obj instanceof TerminateSession)) { // In case of pausing or terminating a session the transport layer client must be stopped getTransportLayerClient().stop(); getTransportLayerThread().interrupt(); if (obj instanceof PauseSession) { /* * If some action is needed by the sessionHandler when pausing, it can be done here. * If TCP/TLS client sends notification, it should always be a TerminateSession instance * (because a failure of the connection to the TCP/TLS server is its only reason for * notification). */ } else if (obj instanceof TerminateSession) { terminate((TerminateSession) obj); } } else if (obs instanceof TCPClient || obs instanceof TLSClient) { // TCP- and TLSClient already stop themselves and interrupt their threads before notifying terminate((TerminateSession) obj); } else { getLogger().warn("Notification coming from " + obs.getClass().getSimpleName() + " unknown: " + obj.getClass().getSimpleName()); } }
@Override public void update(Observable observable, Object o) { mBooks.clear(); if (o instanceof IBookProvider && ((IBookProvider)o).getBooks() != null) { mBooks.addAll(((IBookProvider)o).getBooks()); mAdapter.notifyDataSetChanged(); if (CurrentSelected.getBook() != null) { for (IBook book : mBooks) { if (book.getId().equalsIgnoreCase(CurrentSelected.getBook().getId())) { ((LinearLayoutManager)mRecyclerView.getLayoutManager()).scrollToPositionWithOffset(mBooks.indexOf(book), mRecyclerView.getHeight()/2); } } } } }
/** * called when Observable changes (pot changes) */ @Override public void update(final Observable observable, final Object obj) { if (observable instanceof TowerOnChip6BitVDAC) { // log.info("observable="+observable); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // don't do the following - it sometimes prevents display updates or results in double updates // slider.setValueIsAdjusting(true); // try to prevent a new event from the slider updateAppearance(); } }); } }
/** * * @param o * @param arg argomenti dell'evento */ @Override public void update(Observable o, Object arg) { String messaggio = arg.toString(); String dati[] = messaggio.split("\t"); if (dati[0].equals("evento")) { gestisciEvento(dati); } else if (dati[0].equals("setta")) { gestisciSettaggio(dati); } else if (dati[0].equals("cambia")) { gestisciCambiamento(dati); } else if(dati[0].equals("partitaPiena")){ this.setChanged(); this.notifyObservers(new PartitaPiena()); } }
/** * 调用本方法时务必保证当前没有处于合成状态 * * @param msg * @return */ protected io.reactivex.Observable<SpeechMsg> startSpeak(SpeechMsg msg) { Log.w(TAG, "startSpeak text:" + msg.text()); if (mContext != null) { if (!mediator.allowSynthersize(msg)) {//TODO 此处判断需挪到前面 Log.e(TAG, "msg.priority can not be synthesize!"); return io.reactivex.Observable.empty(); } } currentMessage = msg; if (msg.text().length() == 0) { Log.e(TAG, "msg.length==0"); return createEmptySuccessCallback(msg); } if (mediator.isBlueToothHeadSet()) { Log.e(TAG, "setAudioManager mode to MODE_IN_CALL"); mediator.startBluetoothSco(); } if (msg.forceLocalEngine()) { //msg.forceLocalEngine=true; } else { //forceSwitchEngine(RobotApplication.online); } return synthesize(msg); }
private void testError(TransactionMode mode, Function<List<RowRecord>, Object> function) { ResetTestValue.reset(); ImportHandler handler = new ImportHandler( new RowRecordHandlerImpl(), new RowRecordPersistencorHibernateImpl(factory), mode); List<RowRecord> list = handler.importExcel( ExcelFactory.newExcel(new File("D:/test/userinfo_error.xlsx")), 1, (Observable o, Object arg) -> { Process process = (Process) arg; System.out.println("进度:" + process.getProcess() + ",当前阶段:" + process.getNode()); }, User.class); list.forEach(rr -> { System.out.println("行号:" + rr.getRowNo() + ", 错误信息:" + rr.getResult().getMsg()); System.out.println(rr); }); function.apply(list); }
@Override public void update(Observable o, Object arg) { if(arg instanceof GiocatoreDisconnessoException){ System.out.println("disconnesso"); disconnesso=true; } else{ String messaggio = String.valueOf(arg); String dati[] = messaggio.split(" "); if(dati[0].equals("evento")){ if (dati[1].equals("SetPuntata")) { puntataInserita(dati[2]); } else if (dati[1].equals("SetGiocata")) { GiocataInserita(dati[2]); }else if(dati[1].equals("Esce")) esce=true; } } }
/** * Bind a model to a view. * @param modelReader a getter on the observable for the field, so that the binder can set the target to start with. * @param applicator code to run when the observable changes. something like (a)->view.setText(a) * @param o the observable to observe. */ public Binder(Supplier<T> modelReader,Consumer<T> applicator,Observable o) { this.applicator=applicator; this.modelReader = modelReader; o.addObserver(this); if( modelReader.get()!=null){ applicator.accept(modelReader.get()); } }
private void updateCodeArea(final Observable o, final Object arg) { try { ByteArrayEditableData data = treeObservable.getBinarySource().getBinaryData(); codeArea.setData(data); } catch (IOException|TreeModelLoadException ex) { // todo } }
@Override public void update(Observable o, Object arg) { if (arg instanceof NotifyEventType) { NotifyEventType eventType = (NotifyEventType) arg; switch (eventType) { case CONSOLE_LOG: updateConsoleLog(server.getLastLog()); break; case PLAYER_LIST: updateConnected(server.getConnectedPlayers()); updateNotConnected(server.getRecentlyDCPlayers()); break; case MAP_CHANGED: updateMaps(); break; case PING: updatePing(); break; case VAC: updateVac(); break; case DISCONNECT: switchToDisconnected(); refreshTitle(); break; case DISCONNECT_ERROR: switchToDisconnectedWithAlert(); refreshTitle(); break; } } }
@Override public void update(Observable o, Object arg) { if (AsyncTaskManager.CANCEL_ALL == (Integer) arg) { if (getStatus() == CommonAsyncTask.Status.RUNNING) { cancel(true); } } }
@Override public void update(Observable observable, Object data) { if (data instanceof SMessage) { SMessage sMessage = (SMessage) data; sMessage.setSender(getContactName(sMessage.getSenderNum())); sendMessage(new Message(sMessage)); } }
public final void boundObservable(Observable observable) { if (!(this.mObservable == observable || this.mObservable == null)) { this.mObservable.deleteObserver(this); } this.mObservable = observable; this.mObservable.addObserver(this); }
@Override public void update(Observable observable, Object updateObject) { String ObjectName = updateObject.toString(); if (ObjectName.equalsIgnoreCase(Project.CHANGED_ProjectName)) { this.getRootNode().setUserObject(currProject.getProjectName()); this.getTreeModel().nodeChanged(this.getRootNode()); this.getJTreeProject().repaint(); Application.setTitelAddition(currProject.getProjectName()); } else if (ObjectName.equals(Project.CHANGED_ProjectView)) { this.setViewForDeveloperOrEndUser(); } else if (ObjectName.equals(Project.CHANGED_EnvironmentModelType)) { this.setViewForDeveloperOrEndUser(); } else if (ObjectName.equals(Project.VIEW_Maximize)) { this.tabMaximize(); } else if (ObjectName.equals(Project.VIEW_Restore)) { this.tabRestore(); } else if (ObjectName.equals(Project.VIEW_TabsLoaded)) { this.setFocus2StartTab(); } this.validate(); this.repaint(); }
public void update(Observable o, Object arg) { // update dependencies for(TimeFrame tf: dependencies.keySet()) { IndicatorCandle ic = getCandle(tf); AIndicator[] tfindis = indicators.get(tf); for(int k = 0; k < tfindis.length; k++) { tfindis[k] = tfindis[k].get(ic); } } }
public final void update(Observable observable, Object data) { if (this.mObservable != observable) { return; } if (data != null) { ((Activity) getContext()).runOnUiThread(new 1(this, data)); } else if (this.mObservable != null) { this.mObservable.deleteObserver(this); this.mObservable = null; } }
@Override public void update(Observable observable, Object o) { Log.d(getClass().getSimpleName(), observable + " -> " + o); if (o instanceof ShoppingList) { list = (ShoppingList) o; if (title != null) { title.setText(list.getName()); } if (date != null) { date.setText(list.getDueTo()); } if (shop != null) { shop.setText(list.getWhereToBuy().getName()); } if (items != null) { items.setAdapter(createAdapter()); } } if (observable instanceof FeatureService) { if (list != null && SettingsService.getInstance().getSetting(SettingsService.SETTING_ENABLE_SHAKE_TO_CHECK_ITEMS).equals(true)) { for (Item i : list.getItems()) { System.out.println("in list"); if (!i.isChecked()) { System.out.println("isnt checked"); i.setChecked(true); ItemService.getInstance().addItem(i); return; } } Toast.makeText(getActivity(), "All Items checked already!", Toast.LENGTH_SHORT).show(); } } }
public void update(Observable o, Object arg) { if(arg.equals(ModelEventHandler.ELEMENT_ADDED)){ elementAdded(); } if(arg.equals(ModelEventHandler.ELEMENT_REMOVED)){ elementAdded(); } if(arg.equals(ModelEventHandler.ACTIVE_ELEMENT_CHANGED)){ elementAdded(); } }
@Override public void update(Observable o, Object arg) { if (o instanceof Chip2D) { if (arg instanceof String) { String s = (String) arg; if (s.equals(Chip2D.EVENT_SIZEX)) { sizeX = chip.getSizeX(); } else if (s.equals(Chip2D.EVENT_SIZEY)) { sizeY = chip.getSizeY(); } } } }
@Override public void update(Observable o, Object arg) { if(o instanceof CsvDataController && arg.equals(CsvDataController.EVENT_TABLE_MODEL_REPLACED)){ DefaultTableModel dtm = this.csvDataController.getDataModel(); if(dtm != null){ this.getJTableData().setModel(dtm); } } }
@Override public void update(Observable o, Object arg) { if (o instanceof Masterbias) { Masterbias m = (Masterbias) o; if ((arg != null) && (arg == Masterbias.EVENT_POWERDOWN)) { set(m.isPowerDownEnabled()); } } }
public void update(Observable observable, Object data) { if (data instanceof String) { String notify = (String) data; if (TextUtils.equals(PlayObservable.ON_NET_CHANGE, notify)) { onNetChange(); } else if (TextUtils.equals(PlayObservable.ON_CALL_STATE_IDLE, notify)) { statisticsLaunch(true); } } }
/** * Called when the chip size is known * * @param o * @param arg */ @Override synchronized public void update(Observable o, Object arg) { currentAddress = new int[chip.getNumCellTypes()]; Arrays.fill(currentAddress, -1); frameExtractor.resetFilter(); if (chip.getBiasgen() != null) { chip.getBiasgen().getSupport().addPropertyChangeListener(this); } }
/** * Called when objects being observed change and send a message * Re initialize filter if camera pixel size has changed * @param o Object that has changed * @param arg Message object has sent about change */ @Override public void update(Observable o, Object arg) { super.update(o, arg); if ((arg != null) && ((arg == Chip2D.EVENT_SIZEX) || (arg == Chip2D.EVENT_SIZEY))) { initFilter(); } }
@Override public void update(Observable o, Object arg) { if (arg instanceof TickPause) { setPause(); } }
@Override public void update(Observable o, Object arg) { if (o == Biasgen.this.scanContinuouslyEnabled) { setScanContinuouslyEnabled(Biasgen.this.scanContinuouslyEnabled.isSet()); } else if (o == Biasgen.this.scanSel) { setScanGanglionCellVMem(scanSel.isSet()); } else if (o == Biasgen.this.scanX) { setScanX(Biasgen.this.scanX.get()); } }
@Override public void update(Observable o, Object arg) { idTokenObj = (IdToken) arg; InternalWebServerTransaction transaction = (InternalWebServerTransaction) o; if (idTokenObj != null) { tokenResponse = AuthHelper.getTokenFromAuthCode(transaction.code, idTokenObj.getTenantId()); if(tokenResponse.getError() == null) { logger.info("User has a valid token"); try { logger.info("Sopping listening thread"); this.socket.close(); } catch (IOException e) { logger.error("IOException durring ", e); } this.setChanged(); this.notifyObservers(tokenResponse); } else { logger.error(tokenResponse.getError()); logger.error(tokenResponse.getErrorDescription()); logger.error("User don't have a valid token"); OwaNotifier.exit(255); serverThread.interrupt(); } } }
@Override public void update(Observable o, Object arg) { if (o instanceof AEChip) { AEChip c = (AEChip) o; if (c.getSizeX() > 0 && c.getSizeY() > 0) { if (display != null) { display.clearImage(); } } } }
@Override // @author Adrien: do not know what I do but Eclipse was yelling for this tag... public void update(Observable o, Object arg) { if ((arg != null) && ((arg == Chip2D.EVENT_SIZEX) || (arg == Chip2D.EVENT_SIZEY))) { initFilter(); } }
@Override public void update(Observable observable, Object obj) { // UndoableControl was updated; refresh icons if (observable instanceof UndoableControl) { undoButton.setEnabled(((UndoableControl) observable).canUndo()); redoButton.setEnabled(((UndoableControl) observable).canRedo()); } }
@Override protected Observer createErrorListener() { return new Observer() { @Override public void update(Observable o, Object arg) { if (arg != null) { JCell<?> errorCell = getJModel().getErrorMap() .get(arg); if (errorCell != null) { getJGraph().setSelectionCell(errorCell); } } } }; }
public void update(Observable obs, Object obj) { if ( ! (obj instanceof Bill.Deposit)) return; Bill.Deposit deposit = (Bill.Deposit)obj; if ( ! mBillMap.containsKey(deposit.wallet_id)) return; Bill bill = mBillMap.get(deposit.wallet_id); if (bill.InsertDeposit(deposit, true)) { InsertDepositIntoDB(deposit); mLastDepositData.SetChanged(); mLastDepositData.notifyObservers(deposit); } else if (bill.UpdateDeposit(deposit, true)) { UpdateDepositInDB(deposit); mLastDepositData.SetChanged(); mLastDepositData.notifyObservers(deposit); } if (bill.getStatus() == Bill.STATUS_CONFIRMED) { IExchangeAPI api = ExchangeAPI.GetCurrentAPI(); if (api != null && ! bill.getActionDone()) { switch (bill.getAction()) { case Bill.ACTION_TAKE: api.TakeMarket(bill.getCryptoAmount()); bill.setActionDone(true); break; case Bill.ACTION_MAKE: api.MakeMarket(bill.getCryptoAmount()); bill.setActionDone(true); break; } } } }
/** Responds to updates from Masterbias to notify observers * * @param observable ignored * @param obj ignored */ public void update(Observable observable, Object obj) { if(observable instanceof Masterbias){ if(obj!=Masterbias.EVENT_POWERDOWN){ // only inform listening pots to update their GUI when needed setChanged(); notifyObservers(); } } }
/** called when Observable changes (pot changes) */ @Override public void update(Observable observable, Object obj) { if (observable instanceof VPot) { slider.setValueIsAdjusting(false); // try to prevent a new event from the slider // System.out.println("VPotSliderTextControl observer update"); updateAppearance(); } }