@Override public void initialize(URL location, ResourceBundle resources) { urlField.setOnAction( event -> { String text = urlField.getText(); urlField.setText("tetetetetetetete"); webView.getEngine().load(text); }); webView .getEngine() .getLoadWorker() .stateProperty() .addListener( (ov, oldState, newState) -> { if (newState == State.SUCCEEDED) { String url = webView.getEngine().getLocation(); urlField.setText(url); if (Pattern.compile("http://item.rakuten.co.jp/.*").matcher(url).find()) { try { Elements tmp; Document document = Jsoup.connect(url).get(); tmp = document.select("input"); tmp = tmp.select("#etime"); if (tmp.size() != 0) { if (!(Long.parseLong(tmp.first().val()) < new Date().getTime())) { entryButton.setDisable(false); } } else { entryButton.setDisable(false); } } catch (Exception e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } } } ; }); entryButton.setOnAction( event -> { urlField.setText("webView disable"); sendEntryTaskController(); }); }
@FXML private void Ok_click(ActionEvent event) { logger.entry(); LogEntry log = new LogEntry("6.16", "Local Delete Object Instance service"); try { ObjectInstanceHandle instanceHandle = rtiAmb .getObjectInstanceHandleFactory() .decode( ByteBuffer.allocate(4) .putInt(Integer.parseInt(ObjectInstanceDesignator.getText())) .array(), 0); log.getSuppliedArguments() .add( new ClassValuePair( "Object instance designator", ObjectInstanceHandle.class, instanceHandle.toString())); rtiAmb.localDeleteObjectInstance(instanceHandle); log.setDescription("Local Object instance deleted successfully"); log.setLogType(LogEntryType.REQUEST); } catch (FederateNotExecutionMember | NotConnected | NumberFormatException | CouldNotDecode | RTIinternalError | OwnershipAcquisitionPending | FederateOwnsAttributes | ObjectInstanceNotKnown | SaveInProgress | RestoreInProgress ex) { log.setException(ex); log.setLogType(LogEntryType.ERROR); logger.log(Level.ERROR, ex.getMessage(), ex); } catch (Exception ex) { log.setException(ex); log.setLogType(LogEntryType.FATAL); logger.log(Level.FATAL, ex.getMessage(), ex); } logEntries.add(log); ((Stage) OkButton.getScene().getWindow()).close(); logger.exit(); }
@FXML private void OK_click(ActionEvent event) { logger.entry(); FederateHandle federateHandle; LogEntry log = new LogEntry("4.9", "Join Federation Execution service"); try { if (!FederateName.getText().isEmpty()) { log.getSuppliedArguments() .add(new ClassValuePair("Federate Name", String.class, FederateName.getText())); } log.getSuppliedArguments() .add(new ClassValuePair("Federate Type", String.class, FederateType.getText())); log.getSuppliedArguments() .add( new ClassValuePair( "Federation Execution Name", String.class, FederationExecutionName.getText())); List<URL> foms = new ArrayList<>(); int i = 1; for (File file : FomModuleDesignators.getFiles()) { foms.add(file.toURI().toURL()); log.getSuppliedArguments() .add( new ClassValuePair( "FOM Module Deisgnator " + i++, URL.class, file.toURI().toURL().toString())); } if (FederateName.getText().isEmpty() && FomModuleDesignators.getFileNames().isEmpty()) { federateHandle = rtiAmb.joinFederationExecution( FederateType.getText(), FederationExecutionName.getText()); } else if (FomModuleDesignators.getFileNames().isEmpty()) { federateHandle = rtiAmb.joinFederationExecution( FederateName.getText(), FederateType.getText(), FederationExecutionName.getText()); } else if (FederateName.getText().isEmpty()) { federateHandle = rtiAmb.joinFederationExecution( FederateType.getText(), FederationExecutionName.getText(), foms.toArray(new URL[foms.size()])); } else { federateHandle = rtiAmb.joinFederationExecution( FederateName.getText(), FederateType.getText(), FederationExecutionName.getText(), foms.toArray(new URL[foms.size()])); } log.getReturnedArguments() .add( new ClassValuePair( "Federate Handle", FederateHandle.class, federateHandle.toString())); log.setDescription("Federate joined federation execution successfully"); log.setLogType(LogEntryType.REQUEST); logicalTimeFactory = rtiAmb.getTimeFactory(); currentLogicalTime = logicalTimeFactory.makeInitial(); // subscribe to HLAcurrentFDD to retrieve FDD ObjectClassHandle FederationHandle = rtiAmb.getObjectClassHandle("HLAobjectRoot.HLAmanager.HLAfederation"); currentFDDHandle = rtiAmb.getAttributeHandle(FederationHandle, "HLAcurrentFDD"); AttributeHandleSet set = rtiAmb.getAttributeHandleSetFactory().create(); set.add(currentFDDHandle); rtiAmb.subscribeObjectClassAttributes(FederationHandle, set); rtiAmb.requestAttributeValueUpdate(FederationHandle, set, null); // In case of HLA_EVOKED we require this line to receive the FDD rtiAmb.evokeMultipleCallbacks( .05, 1); // evoke one callback will not be enough because the reflect attribute is the second // one } catch (CouldNotCreateLogicalTimeFactory | CallNotAllowedFromWithinCallback | CouldNotOpenFDD | ErrorReadingFDD | InconsistentFDD | FederateNameAlreadyInUse | FederateAlreadyExecutionMember | FederationExecutionDoesNotExist | SaveInProgress | RestoreInProgress | NotConnected | RTIinternalError ex) { log.setException(ex); log.setLogType(LogEntryType.ERROR); logger.log(Level.ERROR, ex.getMessage(), ex); } catch (Exception ex) { log.setException(ex); log.setLogType(LogEntryType.FATAL); logger.log(Level.FATAL, ex.getMessage(), ex); } logEntries.add(log); ((Stage) FederationExecutionName.getScene().getWindow()).close(); logger.exit(); }