diff --git a/.gitignore b/.gitignore index 8379e6d..f9f196d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ - out/ .gradle/ .idea/ @@ -7,6 +6,8 @@ out/ *.tmp build/ +node_modules/ +resources/ vendor/ package.*.yml diff --git a/.travis.yml b/.travis.yml index bdb4836..d1c927e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ jdk: - oraclejdk8 before_install: - - wget -O - https://github.com/jphp-compiler/jphp/releases/download/jppm-0.3.0/jppm-setup-0.3.0.sh | bash + - wget -O - https://github.com/jphp-compiler/jphp/releases/download/jppm-0.4.1/jppm-setup-0.4.1.sh | bash script: - - jppm install - - jppm test \ No newline at end of file + - jppm build \ No newline at end of file diff --git a/README.md b/README.md index b2a52da..738f971 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,22 @@ # Wizard Framework -[![Build Status](https://travis-ci.org/jphp-group/wizard-framework.svg?branch=master)](https://travis-ci.org/jphp-group/wizard-framework) +[![Build Status](https://travis-ci.org/MWGuy/wizard-framework.svg?branch=master)](https://travis-ci.org/MWGuy/wizard-framework) -Wizard Framework is a jphp framework for the web/mobile/desktop. +Wizard Framework is a jphp framework for the web/desktop. # How to taste? -If you want to see our framework in action, you can use the `sandbox` project in the `sandbox/` directory. +If you want to see our framework in action, you can use the `sandbox` project in the `sandbox-web/` directory. -Before you should install Java 8 and run the `npmInstall gulpInstall` gradle task (it can take a lot of time): -``` -cd +Before you should install Java and jppm then run the `jppm build` command. -// for linux -chmod +x gradlew -./gradlew npmInstall installGulp +Then you can run wizard sandbox -// for windows -gradlew.bat npmInstall installGulp +```bash +cd path/to/wizard/sandbox-web +jppm update +jppm start ``` -Then you can run wizard sandbox: - -``` -cd - -// for linux -./gradlew sandboxWeb - -// for windows -gradlew.bat sandboxWeb -``` - -Then open `http://localhost:5000/` in your browser (opera, chrome or firefox). Your browser -must support the WebSocket feature. - - +Then open `http://localhost:5000/` in your browser (opera, chrome or firefox). +Your browser must support the WebSocket feature. diff --git a/modules/wizard-ide-support/build.gradle b/modules/wizard-ide-support/build.gradle deleted file mode 100644 index 0ef5d42..0000000 --- a/modules/wizard-ide-support/build.gradle +++ /dev/null @@ -1,8 +0,0 @@ - - -dependencies { - provided project(":wizard-core") - compile project(":modules/wizard-localization") - compile "org.develnext.jphp:jphp-zip-ext:0.9.0-SNAPSHOT" - compile "org.develnext.jphp:jphp-graphic-ext:$jphpVersion" -} \ No newline at end of file diff --git a/modules/wizard-ide-support/src-php/framework/ide/IdeComponent.php b/modules/wizard-ide-support/src-php/framework/ide/IdeComponent.php deleted file mode 100644 index ceb39af..0000000 --- a/modules/wizard-ide-support/src-php/framework/ide/IdeComponent.php +++ /dev/null @@ -1,232 +0,0 @@ -className; - } - - /** - * @param string $className - */ - protected function setClassName(string $className) - { - $this->className = $className; - } - - /** - * @return IdeComponentField[] - */ - protected function getFields(): array - { - return $this->components->findByClass(IdeComponentField::class); - } - - /** - * @return IdeComponent|null - */ - protected function getParent(): ?IdeComponent - { - return $this->parent; - } - - /** - * @param IdeComponent|null $parent - */ - protected function setParent(?IdeComponent $parent) - { - $this->parent = $parent; - } - - /** - * @return string - */ - protected function getLocalizedName(): string - { - return $this->localizer ? $this->localizer->translate($this->name) : $this->name; - } - - /** - * @return string - */ - protected function getLocalizedDescription(): string - { - return $this->localizer ? $this->localizer->translate($this->description) : $this->description; - } - - /** - * @return string - */ - protected function getName(): string - { - return $this->name; - } - - /** - * @param string $name - */ - protected function setName(string $name) - { - $this->name = $name; - } - - /** - * @return string - */ - protected function getDescription(): string - { - return $this->description; - } - - /** - * @param string $description - */ - protected function setDescription(string $description) - { - $this->description = $description; - } - - /** - * @return bool - */ - protected function isAbstract(): bool - { - return $this->abstract; - } - - /** - * @param bool $abstract - */ - protected function setAbstract(bool $abstract) - { - $this->abstract = $abstract; - } - - /** - * @return string[] - */ - protected function getEvents(): array - { - return $this->events; - } - - /** - * @return Localizer - */ - protected function getLocalizer(): ?Localizer - { - return $this->localizer; - } - - /** - * @param Localizer $localizer - */ - protected function setLocalizer(?Localizer $localizer) - { - $this->localizer = $localizer; - } - - /** - * @param string[] $events - */ - protected function setEvents(array $events) - { - $this->events = $events; - } - - /** - * @return Image - */ - protected function getIcon(): ?Image - { - return $this->icon; - } - - /** - * @param Image $icon - */ - protected function setIcon(?Image $icon) - { - $this->icon = $icon; - } - - - /** - * @param string $className - * @return bool - */ - public function isSubclassOf(string $className): bool - { - if ($className === $this->className) { - return true; - } - - return $this->parent && $this->parent->isSubclassOf($className); - } -} \ No newline at end of file diff --git a/modules/wizard-ide-support/src-php/framework/ide/IdeComponentField.php b/modules/wizard-ide-support/src-php/framework/ide/IdeComponentField.php deleted file mode 100644 index 4b8641f..0000000 --- a/modules/wizard-ide-support/src-php/framework/ide/IdeComponentField.php +++ /dev/null @@ -1,115 +0,0 @@ - 'mixed', 'nullable' => true, 'builtin' => true]; - - /** - * @var string - */ - private $name; - - /** - * @var string - */ - private $description; - - /** - * @var string - */ - private $default; - - /** - * @return array - */ - protected function getType(): array - { - return $this->type; - } - - /** - * @param array $type - */ - protected function setType(array $type) - { - $this->type = $type; - } - - /** - * @return string - */ - protected function getName(): string - { - return $this->name; - } - - protected function getLocalizedName(): string - { - if ($this->owner instanceof IdeComponent) { - return $this->owner->localizer->translate($this->name); - } else { - return $this->name; - } - } - - /** - * @param string $name - */ - protected function setName(string $name) - { - $this->name = $name; - } - - /** - * @return mixed - */ - protected function getDefault() - { - return $this->default; - } - - /** - * @param mixed $default - */ - protected function setDefault($default) - { - $this->default = $default; - } - - /** - * @return string - */ - protected function getDescription(): string - { - return $this->description; - } - - protected function getLocalizedDescription(): string - { - return $this->owner instanceof IdeComponent ? $this->owner->localizer->translate($this->description) : $this->description; - } - - /** - * @param string $description - */ - protected function setDescription(string $description) - { - $this->description = $description; - } -} \ No newline at end of file diff --git a/modules/wizard-ide-support/src-php/framework/ide/IdeComponentLoader.php b/modules/wizard-ide-support/src-php/framework/ide/IdeComponentLoader.php deleted file mode 100644 index f6d8325..0000000 --- a/modules/wizard-ide-support/src-php/framework/ide/IdeComponentLoader.php +++ /dev/null @@ -1,445 +0,0 @@ -reset(); - - $this->localizer = $localizer; - } - - /** - * Load all components from class paths and zip files. - */ - public function scan() - { - foreach ($this->zipFiles as $zipFile) { - $zip = new ZipFile($zipFile); - foreach ($zip->statAll() as $stat) { - ['name' => $name, 'directory' => $directory] = $stat; - - if (!$directory && str::endsWith($name, '.php')) { - $name = str::sub($name, 0, str::length($name) - 4); - $name = str::replace($name, '/', '\\'); - - if ($this->isComponent($name)) { - $this->load($name); - } - } - } - } - - foreach ($this->classPaths as $path) { - $path = fs::normalize(fs::abs($path)); - - fs::scan($path, [ - 'extensions' => ['php'], - 'callback' => function ($file) use ($path) { - $name = fs::pathNoExt($file); - $name = str::sub($name, str::length($path)); - $name = str::replace($name, '/', '\\'); - - if ($name[0] === '\\') { - $name = str::sub($name, 1); - } - - if ($this->isComponent($name)) { - $this->load($name); - } - } - ]); - } - } - - protected function loadMeta(IdeComponent $ideComponent, Stream $stream, string $format) - { - [ - 'name' => $ideComponent->name, - 'description' => $ideComponent->description, - 'localizer' => $localizer, - 'fields' => $fields, - ] = $stream->parseAs($format); - - if (is_array($localizer)) { - $l = new Localizer($this->localizer); - - foreach ($localizer as $lang => $messages) { - if (is_array($messages)) { - $l->addMessages($lang, $messages); - } - } - - $ideComponent->localizer = $l; - } - - if (is_array($fields)) { - foreach ($fields as $name => $field) { - if ($f = $ideComponent->fields[$name]) { - if (isset($field['name'])) { - $f->name = $field['name']; - } - - if (isset($field['description'])) { - $f->description = $field['description']; - } - } - } - } - - return $stream; - } - - /** - * @param string $pathToZip - */ - public function addZipFile(string $pathToZip) - { - if (isset($this->zipFiles[$pathToZip])) { - return; - } - - $this->zipFiles[$pathToZip] = $pathToZip; - - $this->metaLoaders[$pathToZip] = function (IdeComponent $ideComponent) use ($pathToZip) { - $filename = str::replace($ideComponent->className, '\\', '/') . '.php.meta'; - - $zip = new ZipFile($pathToZip, false); - foreach (['json', 'yml'] as $format) { - if ($zip->has("$filename.$format")) { - $zip->read("$filename.$format", function (array $stat, Stream $stream) use ($format, $ideComponent) { - $this->loadMeta($ideComponent, $stream, $format); - }); - - return true; - } - } - - return false; - }; - - $this->env->execute(function () use ($pathToZip) { - $zip = new ZipFile($pathToZip, false); - - spl_autoload_register(function ($className) use ($zip) { - $filename = str::replace($className, '\\', '/') . '.php'; - - if ($zip->has($filename)) { - $zip->read($filename, function (array $stats, Stream $stream) { - $module = new Module($stream); - }); - - return true; - } - - return false; - }); - }); - } - - /** - * @param string $path - */ - public function addClassPath(string $path) - { - if (isset($this->classPaths[$path])) { - return; - } - - $this->classPaths[$path] = $path; - - $this->metaLoaders[$path] = function (IdeComponent $ideComponent) use ($path) { - $filename = $path . '/' . str::replace($ideComponent->className, '\\', '/') . '.php.meta'; - - foreach (['json', 'yml'] as $format) { - if (Stream::exists("$filename.$format")) { - try { - Stream::tryAccess("$filename.$format", function (Stream $stream) use ($ideComponent, $format) { - $this->loadMeta($ideComponent, $stream, $format); - }); - } catch (IOException $e) { - Logger::error("Failed to load meta file of {0} component", $ideComponent->className); - } - - return true; - } - } - - return false; - }; - - $this->env->execute(function () use ($path) { - spl_autoload_register(function ($className) use ($path) { - $filename = str::replace($className, '\\', '/') . '.php'; - - if (Stream::exists("$path/$filename")) { - $module = new Module("$path/$filename"); - return true; - } - - return false; - }); - }); - } - - /** - * Reset environment. - */ - public function reset() - { - $classPaths = $this->classPaths; - $zipFiles = $this->zipFiles; - - $this->metaLoaders = []; - $this->classPaths = []; - $this->components = []; - $this->zipFiles = []; - - $this->env = new Environment(null, Environment::HOT_RELOAD); - - foreach ($classPaths as $path) { - $this->addClassPath($path); - } - - foreach ($zipFiles as $zipFile) { - $this->addZipFile($zipFile); - } - } - - /** - * @param string $superClassName - * @param bool $withAbstract - * @return array - */ - public function findComponents(string $superClassName = Component::class, bool $withAbstract = false): array - { - $this->scan(); - - if ($superClassName === Component::class) { - return $withAbstract - ? $this->components - : flow($this->components)->find(function (Component $el) { return !$el->abstract; })->withKeys()->toArray(); - } - - $result = []; - - foreach ($this->components as $name => $component) { - if ($component->isSubclassOf($superClassName)) { - if ($withAbstract || !$component->abstract) { - $result[$name] = $component; - } - } - } - - return $result; - } - - /** - * @param string $className - * @param string $extendClassName - * @return bool - */ - public function isComponent(string $className, string $extendClassName = Component::class): bool - { - if ($c = $this->components[$className]) { - if ($extendClassName === Component::class) { - return true; - } - - return $c->isSubclassOf($extendClassName); - } - - return $this->env->execute(function () use ($className, $extendClassName, &$result) { - try { - if (class_exists($className)) { - $ref = new \ReflectionClass($className); - return $ref->isSubclassOf($extendClassName); - } else { - return false; - } - } catch (\Error $e) { - return false; - } - }); - } - - /** - * @param string $className - * @return IdeComponent - */ - public function reload(string $className): IdeComponent - { - unset($this->components[$className]); - return $this->load($className); - } - - /** - * @param string $className - * @return IdeComponent - * @throws \Exception - */ - public function load(string $className): IdeComponent - { - if ($c = $this->components[$className]) { - return $c; - } - - $result = []; - - Logger::info("Load component '{0}'", $className); - - $this->env->execute(function () use ($className, &$result) { - $ref = new \ReflectionClass($className); - - if ($ref->isSubclassOf(Component::class)) { - $defaultProperties = $ref->getDefaultProperties(); - - $result['className'] = $ref->getName(); - $result['parent'] = $ref->getParentClass() ? $ref->getParentClass()->getName() : null; - $result['namespace'] = $ref->getNamespaceName(); - $result['file'] = $ref->getFileName(); - $result['abstract'] = $ref->isAbstract(); - $result['fields'] = []; - $result['eventSignals'] = []; - - foreach ($ref->getProperties() as $property) { - $name = $property->getName(); - - if ($property->getDeclaringClass()->getName() !== $ref->getName()) { - continue; - } - - if ($property->isPublic() && str::startsWith($name, 'on') - && str::contains($property->getDocComment(), '@var EventSignal')) { - $eventSignal = str::lowerFirst(str::sub($name, 2)); - $result['eventSignals'][$eventSignal] = $eventSignal; - continue; - } - - try { - if ($method = $ref->getMethod("set{$name}")) { - $param = $method->getParameters()[0]; - - if ($param) { - $result['fields'][$name] = [ - 'comment' => $ref->getDocComment(), - 'default' => $defaultProperties[$name], - 'type' => $param->getType() ? [ - 'name' => $param->getType()->getName(), - 'nullable' => $param->getType()->allowsNull(), - 'builtin' => $param->getType()->isBuiltin() - ] : [ - 'name' => 'mixed', - 'nullable' => true, - 'builtin' => true - ] - ]; - } - } - } catch (\ReflectionException $e) { - continue; - } - } - } else { - $result = null; - } - }); - - if ($result === null) { - throw new \Exception("Failed to load component {$className}"); - } - - $fields = []; - foreach ($result['fields'] as $name => $field) { - $fields[$name] = $f = new IdeComponentField(); - - $f->id = $name; - $f->properties = [ - 'name' => $name, - 'default' => $field['default'], - 'type' => $field['type'] - ]; - } - - $c = new IdeComponent(); - $c->properties = [ - 'className' => $result['className'], - 'parent' => $result['parent'] && $this->isComponent($result['parent']) ? $this->load($result['parent']) : null, - 'abstract' => $result['abstract'], - 'events' => $result['eventSignals'], - ]; - - foreach ($fields as $one) { - $c->components[] = $one; - } - - foreach ($this->metaLoaders as $metaLoader) { - if ($metaLoader($c)) { - break; - } - } - - if (!$c->localizer) { - $c->localizer = $this->localizer; - } - - if (!$c->localizer) { - $c->localizer = new Localizer(); - } - - return $this->components[$className] = $c; - } -} \ No newline at end of file diff --git a/modules/wizard-localization/package.build.php b/modules/wizard-localization/package.build.php new file mode 100644 index 0000000..a9ce17f --- /dev/null +++ b/modules/wizard-localization/package.build.php @@ -0,0 +1,10 @@ +package()->getAny('modules', []) as $i => $module) { - Tasks::runExternal("./$module", 'publish', [], ...$event->flags()); + Tasks::runExternal("./$module", 'install', [], ...$event->flags()); + Tasks::runExternal("./$module", 'wizard:build', [], ...$event->flags()); } } diff --git a/sandbox-browser/build.gradle b/sandbox-browser/build.gradle deleted file mode 100644 index daeadff..0000000 --- a/sandbox-browser/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -apply plugin: 'application' - -mainClassName = 'php.runtime.launcher.Launcher' -applicationDefaultJvmArgs = [ - '-Dfile.encoding=UTF-8', - '-Djava.library.path=../wizard-browser-win64/build/native/win64' -] - -dependencies { - compile project(":wizard-browser") - compile "org.develnext.jphp:jphp-core:${jphpVersion}" - compile "org.develnext.jphp:jphp-zend-ext:${jphpVersion}" - compile "org.develnext.jphp:jphp-yaml-ext:${jphpVersion}" - compile "org.develnext.jphp:jphp-xml-ext:${jphpVersion}" -} - -task browserSandbox(dependsOn: ['run']) { - -} \ No newline at end of file diff --git a/sandbox-browser/src-php/JPHP-INF/.bootstrap.php b/sandbox-browser/src-php/JPHP-INF/.bootstrap.php deleted file mode 100644 index ff4c575..0000000 --- a/sandbox-browser/src-php/JPHP-INF/.bootstrap.php +++ /dev/null @@ -1,102 +0,0 @@ -offset = 0; - $callback->continue(); - return true; - } - - /** - * @param \cef\CefResponse $response - * @param array $args [length, redirectUrl] - * @return array|null [length, redirectUrl] - */ - public function getResponseHeaders(\cef\CefResponse $response, array $args) - { - $response->status = 200; - $response->mimeType = 'text/plain'; - - return ['length' => str::length($this->data)]; - } - - /** - * @param Stream $out - * @param int $bytesToRead - * @param CefCallback $callback - */ - public function readResponse(Stream $out, int $bytesToRead, CefCallback $callback) - { - $len = min($bytesToRead, str::length($this->data) - $this->offset); - - if ($this->offset < str::length($this->data)) { - $out->write(str::sub($this->data, $this->offset, $len)); - $this->offset += $bytesToRead; - } - } - - /** - * @param array $cookie - * @return bool - */ - public function canGetCookie(array $cookie) - { - return false; - } - - /** - * @param array $cookie - * @return bool - */ - public function canSetCookie(array $cookie) - { - return false; - } - - /** - */ - public function cancel() - { - } -} - -CefApp::registerCustomScheme('wizard', function ($b, $s, $request) { - print_r($request); - return new WizardSchemeHandler(); -}); - -$app = CefApp::getInstance(); -$client = $app->createClient(); - -$client->onTitleChange(function (CefBrowser $browser, $title) { - CefBrowserWindow::find($browser)->title = $title; -}); - -$browser = $client->createBrowser('wizard://test', false); - -$window = new CefBrowserWindow($browser); -$window->title = 'Hello World'; -$window->size = [600, 400]; -$window->centerOnScreen(); -$window->onClosing(function (CefBrowserWindow $window) { - $window->free(); -}); -$window->show(); \ No newline at end of file diff --git a/sandbox-web/package.php.yml b/sandbox-web/package.php.yml new file mode 100644 index 0000000..e90601e --- /dev/null +++ b/sandbox-web/package.php.yml @@ -0,0 +1,19 @@ +name: sandbox-web +version: 1.0.0 +description: Sandbox for wizard framework +deps: + jphp-core: '*' + jphp-zend-ext: '*' + wizard-web-ui: '*' + wizard-web: '*' + wizard-app: '*' + wizard-app-web: '*' + wizard-core: '*' + wizard-web-ui-ace-editor: '*' + wizard-web-ui-slider: '*' +plugins: +- App +sources: +- src +includes: +- index.php diff --git a/sandbox-web/resources/JPHP-INF/launcher.conf b/sandbox-web/resources/JPHP-INF/launcher.conf deleted file mode 100644 index 4875aa0..0000000 --- a/sandbox-web/resources/JPHP-INF/launcher.conf +++ /dev/null @@ -1,2 +0,0 @@ - -bootstrap.file=res://bootstrap.php \ No newline at end of file diff --git a/sandbox-web/src-php/bootstrap.php b/sandbox-web/src-php/bootstrap.php deleted file mode 100644 index c376199..0000000 --- a/sandbox-web/src-php/bootstrap.php +++ /dev/null @@ -1,61 +0,0 @@ -observables = ['http://develnext.org', 'http://j-php.net']; -$monitor->on('update', function ($e) { - var_dump($e); -}); - -$monitor->startWatch(); - -return; -//print_r($ideComponent->properties); - -$deployer = new HotDeployer(function () { - $webUi = new WebServerAppModule(); - /*$webUi->addModule(new SliderModule()); - $webUi->addModule(new AceEditorModule());*/ - $webUi->setupResources( - './../wizard-web-ui/src-js/build/lib/dnext-engine.js', - './../wizard-web-ui/src-js/build/lib/dnext-engine.min.css' - ); - - $app = new WebApplication(); - $app->addSettings('res://application.conf'); - $app->components[] = $webUi; - $webUi->addUI(MainUI::class); - - $app->components[] = new WebAssets('/assets', './assets'); - $app->components[] = new WebDevModule(); - $app->launch(); -}, function () { - if (WebApplication::isInitialized()) { - $app = WebApplication::current(); - $app->trigger(new Event('restart', $app)); - $app->shutdown(); - } -}); - -//$deployer->addFileWatcher('application.watcher'); -$deployer->addDirWatcher('./src-php'); -$deployer->addDirWatcher('../wizard-core/src-php'); -$deployer->addDirWatcher('../wizard-web/src-php'); -$deployer->addDirWatcher('../wizard-web-ui/src-php'); -$deployer->run(); \ No newline at end of file diff --git a/sandbox-web/src-php/components/HelloWorldComponent.php b/sandbox-web/src-php/components/HelloWorldComponent.php deleted file mode 100644 index f47789d..0000000 --- a/sandbox-web/src-php/components/HelloWorldComponent.php +++ /dev/null @@ -1,66 +0,0 @@ -myProp; - } - - /** - * @param mixed $myProp - */ - protected function setMyProp($myProp) - { - $this->myProp = $myProp; - } - - - /** - * @event $owner.render - */ - public function handleRender() - { - if ($this->owner instanceof UINode) { - $this->owner->css([ - 'box-shadow' => '0 0 5px black' - ]); - } - } - - /** - * @event animate - */ - public function handleAnimate() - { - if ($this->owner instanceof UINode) { - $this->owner->animate(['margin-top' => 50], ['duration' => $this->duration]); - } - } - - /** - * @event reverseAnimate - */ - public function handleReverseAnimate() - { - if ($this->owner instanceof UINode) { - $this->owner->animate(['margin-top' => 0], ['duration' => $this->duration]); - } - } -} \ No newline at end of file diff --git a/sandbox-web/src-php/components/HelloWorldComponent.php.meta.yml b/sandbox-web/src-php/components/HelloWorldComponent.php.meta.yml deleted file mode 100644 index 7b1de62..0000000 --- a/sandbox-web/src-php/components/HelloWorldComponent.php.meta.yml +++ /dev/null @@ -1,22 +0,0 @@ - -name: Hello World Component -description: Hello World Component Description - -fields: - myProp: - name: My Property - description: Property Description - editor: text - -events: - click: - name: Click - -# Localizations. -localizer: - ru: - Hello World Component: Привет Мир компонент - Hello World Component Description: Описание компонента "Привет Мир" - My Property: Моё свойство - Property Description: Описание свойства - Click: Клик \ No newline at end of file diff --git a/sandbox-web/src-php/controllers/MainController.module b/sandbox-web/src-php/controllers/MainController.module deleted file mode 100644 index 1f5b595..0000000 --- a/sandbox-web/src-php/controllers/MainController.module +++ /dev/null @@ -1,14 +0,0 @@ -{ - "props": {}, - "components": [ - { - "id": "greeting", - "type": "components\\HelloWorldComponent", - "name": "DevelNext" - }, - { - "id": "appModule", - "type": "modules\\AppModule" - } - ] -} \ No newline at end of file diff --git a/sandbox-web/src-php/controllers/MainController.php b/sandbox-web/src-php/controllers/MainController.php deleted file mode 100644 index 8ea8dd2..0000000 --- a/sandbox-web/src-php/controllers/MainController.php +++ /dev/null @@ -1,49 +0,0 @@ - {1} [{2}]", $this->request->method(), $this->request->path(), $this->request->sessionId()); - } - - /** - * @GET - * @path / - */ - public function index() - { - return 'OK'; - } - - /** - * @GET - * @path /greeting - */ - public function greeting() - { - if ($name = $this->request->query('name')) { - $this->appModule->name = $name; - } - - return 'Hello, ' . $this->appModule->name . '!'; - } -} \ No newline at end of file diff --git a/sandbox-web/src-php/application.conf b/sandbox-web/src/application.conf similarity index 100% rename from sandbox-web/src-php/application.conf rename to sandbox-web/src/application.conf diff --git a/sandbox-web/src/index.php b/sandbox-web/src/index.php new file mode 100644 index 0000000..469fdc5 --- /dev/null +++ b/sandbox-web/src/index.php @@ -0,0 +1,31 @@ +addSettings('res://application.conf'); + + $webUi = new WebServerAppModule(); + $webUi->setApp($app); + $webUi->addUI(MainUI::class); + $webUi->addModule(new AceEditorModule()); + $webUi->addModule(new SliderModule()); + + $app->launch(); +}, function () { + if (WebApplication::isInitialized()) { + $app = WebApplication::current(); + $app->trigger(new Event('restart', $app)); + $app->shutdown(); + } +}); + +$deployer->addDirWatcher("./", true); +$deployer->run(); \ No newline at end of file diff --git a/sandbox-web/src/ui/CodeForm.php b/sandbox-web/src/ui/CodeForm.php new file mode 100644 index 0000000..b93e4c2 --- /dev/null +++ b/sandbox-web/src/ui/CodeForm.php @@ -0,0 +1,40 @@ +themes->items = AceEditorModule::$themes; + $this->mode->items = AceEditorModule::$modes; + } + + /** + * @event themes.change + * @event mode.change + */ + public function onChange() { + $this->editor->mode = $this->mode->selectedText; + $this->editor->theme = $this->themes->selectedText; + } +} \ No newline at end of file diff --git a/sandbox-web/src/ui/CodeForm.php.frm b/sandbox-web/src/ui/CodeForm.php.frm new file mode 100644 index 0000000..7a46163 --- /dev/null +++ b/sandbox-web/src/ui/CodeForm.php.frm @@ -0,0 +1,53 @@ +{ + "title": "Code editor", + "router": { + "path": "/code" + }, + "layout": { + "_": "VBox", + "align": [ + "top", + "center" + ], + "padding": 30, + "height": "100%", + "spacing": 10, + "_content": [ + { + "_": "Label", + "text": "Wizard Framework (Code editor)", + "font": {"size": 22}, + "width": "100%", + "padding": [0, 0, 30, 0] + }, + { + "_": "HBox", + "align": [ + "top", + "center" + ], + "padding": 10, + "spacing": 10, + "_content": [ + { + "_": "ComboBox", + "id": "themes", + "selectedText": "eclipse" + }, + { + "_": "ComboBox", + "id": "mode", + "selectedText": "json" + } + ] + }, + { + "_": "bundle\\aceeditor\\ui\\UIAceEditor", + "id": "editor", + "height": "100%", + "mode": "json", + "theme": "eclipse" + } + ] + } +} \ No newline at end of file diff --git a/sandbox-web/src-php/ui/InputTextDialog.php b/sandbox-web/src/ui/InputTextDialog.php similarity index 100% rename from sandbox-web/src-php/ui/InputTextDialog.php rename to sandbox-web/src/ui/InputTextDialog.php diff --git a/sandbox-web/src-php/ui/InputTextDialog.php.frm b/sandbox-web/src/ui/InputTextDialog.php.frm similarity index 100% rename from sandbox-web/src-php/ui/InputTextDialog.php.frm rename to sandbox-web/src/ui/InputTextDialog.php.frm diff --git a/sandbox-web/src-php/ui/MainForm.php b/sandbox-web/src/ui/MainForm.php similarity index 75% rename from sandbox-web/src-php/ui/MainForm.php rename to sandbox-web/src/ui/MainForm.php index a124969..b7e17ba 100644 --- a/sandbox-web/src-php/ui/MainForm.php +++ b/sandbox-web/src/ui/MainForm.php @@ -3,21 +3,13 @@ namespace ui; use framework\core\Event; -use framework\web\ui\animations\UICSSAnimation; -use framework\web\ui\effects\UIBlurEffect; -use framework\web\ui\effects\UIGrayScaleEffect; -use framework\web\ui\effects\UISepiaEffect; -use framework\web\ui\effects\UIShadowEffect; use framework\web\ui\UIAlert; use framework\web\ui\UIButton; use framework\web\ui\UICheckbox; use framework\web\ui\UIHBox; -use framework\web\ui\UIImageView; use framework\web\ui\UIListView; -use framework\web\ui\UINode; use framework\web\ui\UITextField; use framework\web\UIForm; -use php\time\Timer; /** * Class MainForm @@ -32,18 +24,7 @@ class MainForm extends UIForm { /** - * @param Event $e - * @event input.keyUp - */ - /*public function doInputKeyUp(Event $e) - { - if ($e->data['which'] === 13) { - $this->doButtonClick($e); - } - }*/ - - /** - * event button.click-left + * @event button.click-left * @event input.keyUp-Enter * @param Event $e */ diff --git a/sandbox-web/src-php/ui/MainForm.php.frm b/sandbox-web/src/ui/MainForm.php.frm similarity index 95% rename from sandbox-web/src-php/ui/MainForm.php.frm rename to sandbox-web/src/ui/MainForm.php.frm index 90502b9..198b88c 100644 --- a/sandbox-web/src-php/ui/MainForm.php.frm +++ b/sandbox-web/src/ui/MainForm.php.frm @@ -15,7 +15,7 @@ "_content": [ { "_": "Label", - "text": "Wizard Framework (Демонстрация)", + "text": "Wizard Framework (TODO List)", "font": {"size": 22}, "width": "100%", "style": "border-bottom: 1px solid silver; color: gray;", @@ -82,7 +82,7 @@ }, { "_": "Hyperlink", - "text": "Автор - Дмитрий Зайцев", + "text": "Ссылка в никуда :D", "href": "#", "target": "_blank", "components": [ diff --git a/sandbox-web/src-php/ui/MainUI.php b/sandbox-web/src/ui/MainUI.php similarity index 87% rename from sandbox-web/src-php/ui/MainUI.php rename to sandbox-web/src/ui/MainUI.php index 49f2ea1..89a5442 100644 --- a/sandbox-web/src-php/ui/MainUI.php +++ b/sandbox-web/src/ui/MainUI.php @@ -17,6 +17,7 @@ public function __construct() $this->registerForm('MainForm', new MainForm()); $this->registerForm('OtherForm', new OtherForm()); + $this->registerForm('CodeForm', new CodeForm()); $this->registerNotFoundForm('NotFound', new NotFoundForm()); } diff --git a/sandbox-web/src-php/ui/NotFoundForm.php b/sandbox-web/src/ui/NotFoundForm.php similarity index 100% rename from sandbox-web/src-php/ui/NotFoundForm.php rename to sandbox-web/src/ui/NotFoundForm.php diff --git a/sandbox-web/src-php/ui/NotFoundForm.php.frm b/sandbox-web/src/ui/NotFoundForm.php.frm similarity index 100% rename from sandbox-web/src-php/ui/NotFoundForm.php.frm rename to sandbox-web/src/ui/NotFoundForm.php.frm diff --git a/sandbox-web/src-php/ui/OtherForm.php b/sandbox-web/src/ui/OtherForm.php similarity index 70% rename from sandbox-web/src-php/ui/OtherForm.php rename to sandbox-web/src/ui/OtherForm.php index 5c8d9c0..4f91d04 100644 --- a/sandbox-web/src-php/ui/OtherForm.php +++ b/sandbox-web/src/ui/OtherForm.php @@ -1,11 +1,7 @@ [ + "type" => "text/css", + "content" => "res://dnext-engine.min.css" + ], + "engine.js" => [ + "type" => "text/javascript", + "content" => "res://dnext-engine.js" + ], + ]; + + /** + * @param WebApplication $app + */ + public function setApp(WebApplication $app): void + { + $this->app = $app; + $this->app->components[] = $this; + } + + /** + * @param UIModule $module + * @throws \ReflectionException + */ + public function addModule(UIModule $module) { + Logger::debug("Register module {0}", (new \ReflectionClass($module))->getName()); + $this->resources = flow($this->resources, $module->getRequiredResources(), $module->getResources())->toMap(); + } + /** * @event addTo * @param Event $e @@ -76,6 +111,7 @@ protected function handleAddTo(Event $e) /** * @param string $uiClass * @return $this + * @throws \ReflectionException */ public function addUI(string $uiClass) { @@ -172,7 +208,16 @@ public function addUI(string $uiClass) 'urlArgument' => $request->attribute('**') ]; - $body = $ui->makeHtmlView($path, 'window.NX.WebSocketAppDispatcher', $this->dnextResources, $args); + foreach ($this->resources as $resource => $data) { + if (!str::contains($args["urlArgument"], $resource)) continue; + + $response->contentType($data["type"]); + $response->body(Stream::getContents($data["content"])); + + return; + } + + $body = $ui->makeHtmlView($path, 'window.NX.WebSocketAppDispatcher', $this->resources, $args); $response->contentType('text/html'); $response->body($body); }); diff --git a/wizard-app/package.build.php b/wizard-app/package.build.php new file mode 100644 index 0000000..a9ce17f --- /dev/null +++ b/wizard-app/package.build.php @@ -0,0 +1,10 @@ +dnextCssFile = $cssFile; $this->dnextJsFile = $jsFile; diff --git a/wizard-browser-linux64/build.gradle b/wizard-browser-linux64/build.gradle deleted file mode 100644 index ad18458..0000000 --- a/wizard-browser-linux64/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ - -dependencies { - compile project(':wizard-browser') - compile fileTree(include: ['*.jar'], dir: "$projectDir.path/lib") -} - -task unpackNativeLinux64(type: Copy) { - def zipFile = file("$projectDir/native/linux64.tar.gz") - def outputDir = file("$buildDir/native") - - doFirst { delete "$outputDir/linux64" } - - from tarTree(resources.gzip(zipFile)) - into outputDir -} - -task unpackNative(dependsOn: 'unpackNativeLinux64') {} \ No newline at end of file diff --git a/wizard-browser-linux64/lib/gluegen-rt-natives-linux-amd64.jar b/wizard-browser-linux64/lib/gluegen-rt-natives-linux-amd64.jar deleted file mode 100644 index 155be9e..0000000 Binary files a/wizard-browser-linux64/lib/gluegen-rt-natives-linux-amd64.jar and /dev/null differ diff --git a/wizard-browser-linux64/lib/jogl-all-natives-linux-amd64.jar b/wizard-browser-linux64/lib/jogl-all-natives-linux-amd64.jar deleted file mode 100644 index 6b71431..0000000 Binary files a/wizard-browser-linux64/lib/jogl-all-natives-linux-amd64.jar and /dev/null differ diff --git a/wizard-browser-linux64/native/linux64.tar.gz b/wizard-browser-linux64/native/linux64.tar.gz deleted file mode 100644 index d43bf29..0000000 Binary files a/wizard-browser-linux64/native/linux64.tar.gz and /dev/null differ diff --git a/wizard-browser-win32/build.gradle b/wizard-browser-win32/build.gradle deleted file mode 100644 index 36f32d4..0000000 --- a/wizard-browser-win32/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ - -dependencies { - compile project(':wizard-browser') - compile fileTree(include: ['*.jar'], dir: "$projectDir.path/lib") -} - -task unpackNativeWin32(type: Copy) { - def zipFile = file("${projectDir}/native/win32.zip") - def outputDir = file("${buildDir}/native") - - doFirst { delete "$outputDir/win32" } - - from zipTree(zipFile) - into outputDir -} - - -task unpackNative(dependsOn: 'unpackNativeWin32') {} diff --git a/wizard-browser-win32/lib/gluegen-rt-natives-windows-i586.jar b/wizard-browser-win32/lib/gluegen-rt-natives-windows-i586.jar deleted file mode 100644 index 2b3c0fe..0000000 Binary files a/wizard-browser-win32/lib/gluegen-rt-natives-windows-i586.jar and /dev/null differ diff --git a/wizard-browser-win32/lib/jogl-all-natives-windows-i586.jar b/wizard-browser-win32/lib/jogl-all-natives-windows-i586.jar deleted file mode 100644 index f0988ad..0000000 Binary files a/wizard-browser-win32/lib/jogl-all-natives-windows-i586.jar and /dev/null differ diff --git a/wizard-browser-win32/native/win32.zip b/wizard-browser-win32/native/win32.zip deleted file mode 100644 index 369fbaa..0000000 Binary files a/wizard-browser-win32/native/win32.zip and /dev/null differ diff --git a/wizard-browser-win64/build.gradle b/wizard-browser-win64/build.gradle deleted file mode 100644 index 83674e1..0000000 --- a/wizard-browser-win64/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ - -dependencies { - compile project(':wizard-browser') - compile fileTree(include: ['*.jar'], dir: "$projectDir.path/lib") -} - -task unpackNativeWin64(type: Copy) { - def zipFile = file("$projectDir/native/win64.zip") - def outputDir = file("$buildDir/native") - - doFirst { delete "$outputDir/win64" } - - from zipTree(zipFile) - into outputDir -} - -task unpackNative(dependsOn: 'unpackNativeWin64') {} \ No newline at end of file diff --git a/wizard-browser-win64/lib/gluegen-rt-natives-windows-amd64.jar b/wizard-browser-win64/lib/gluegen-rt-natives-windows-amd64.jar deleted file mode 100644 index e3c6cd1..0000000 Binary files a/wizard-browser-win64/lib/gluegen-rt-natives-windows-amd64.jar and /dev/null differ diff --git a/wizard-browser-win64/lib/jogl-all-natives-windows-amd64.jar b/wizard-browser-win64/lib/jogl-all-natives-windows-amd64.jar deleted file mode 100644 index b8bd7bb..0000000 Binary files a/wizard-browser-win64/lib/jogl-all-natives-windows-amd64.jar and /dev/null differ diff --git a/wizard-browser-win64/native/win64.zip b/wizard-browser-win64/native/win64.zip deleted file mode 100644 index 1dbbe52..0000000 Binary files a/wizard-browser-win64/native/win64.zip and /dev/null differ diff --git a/wizard-browser/build.gradle b/wizard-browser/build.gradle deleted file mode 100644 index dac1b5b..0000000 --- a/wizard-browser/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -apply plugin: 'application' - -mainClassName = 'org.develnext.framework.wizard.desktop.WizardBrowserSandbox' - -dependencies { - compile "org.develnext.jphp:jphp-runtime:${jphpVersion}" - compile fileTree(include: ['*.jar'], dir: 'lib') -} - diff --git a/wizard-browser/lib/gluegen-rt.jar b/wizard-browser/lib/gluegen-rt.jar deleted file mode 100644 index 62b2071..0000000 Binary files a/wizard-browser/lib/gluegen-rt.jar and /dev/null differ diff --git a/wizard-browser/lib/jogl-all.jar b/wizard-browser/lib/jogl-all.jar deleted file mode 100644 index 8440b3d..0000000 Binary files a/wizard-browser/lib/jogl-all.jar and /dev/null differ diff --git a/wizard-browser/resources/JPHP-INF/sdk/cef/CefApp.php b/wizard-browser/resources/JPHP-INF/sdk/cef/CefApp.php deleted file mode 100644 index a557c1c..0000000 --- a/wizard-browser/resources/JPHP-INF/sdk/cef/CefApp.php +++ /dev/null @@ -1,110 +0,0 @@ - ... - * CHROME_VERSION_MAJOR => ... - * CHROME_VERSION_MINOR => ... - * ] - * @return array|null - */ - public function getVersion(): ?array - { - } - - /** - * [ - * browser_subprocess_path => null (string), windowless_rendering_enabled => true, command_line_args_disabled => false, - * cache_path => null, persist_session_cookies => false, user_agent => null (string), product_version => null (string), - * locale => null (string), log_file => null, log_severity => LOGSEVERITY_DEFAULT, - * javascript_flags => null (string), resources_dir_path => null (string), locales_dir_path => null (string), - * pack_loading_disabled => false, remote_debugging_port => 0, uncaught_exception_stack_size => 0, - * ignore_certificate_errors => false, background_color => null - * ] - * @param array $settings - */ - public function setSettings(array $settings) - { - } - - /** - * To shutdown the system, it's important to call the dispose - * method. Calling this method closes all client instances with - * and all browser instances each client owns. After that the - * message loop is terminated and CEF is shutdown. - */ - public function dispose() - { - } - - /** - * @return CefClient - */ - public function createClient(): CefClient - { - } - - /** - * NONE, NEW, INITIALIZING, INITIALIZED, SHUTTING_DOWN, TERMINATED. - * - * @return string - */ - public static function getState(): string - { - } - - /** - * @param array $args - * @param array $settings - * @return CefApp - */ - public static function getInstance(array $args = [], array $settings = []): CefApp - { - } - - /** - * @param callable $invoker (): bool - */ - public static function onBeforeTerminate(callable $invoker) - { - } - - /** - * @param callable $invoker (): void - */ - public static function onContextInitialized(callable $invoker) - { - } - - /** - * State is - NONE, NEW, INITIALIZING, INITIALIZED, SHUTTING_DOWN, TERMINATED - * @param callable $invoker (string $state): void - */ - public static function onStateChanged(callable $invoker) - { - } - - /** - * @param string $schemeName - * @param callable $factory (CefBrowser $browser, string $schemeName, array $request): CefResourceHandler - * @param bool $isStandard - */ - public static function registerCustomScheme(string $schemeName, callable $factory, bool $isStandard = true) - { - } -} \ No newline at end of file diff --git a/wizard-browser/resources/JPHP-INF/sdk/cef/CefBrowser.php b/wizard-browser/resources/JPHP-INF/sdk/cef/CefBrowser.php deleted file mode 100644 index 916684c..0000000 --- a/wizard-browser/resources/JPHP-INF/sdk/cef/CefBrowser.php +++ /dev/null @@ -1,33 +0,0 @@ - clients_ = new HashSet(); - private CefSettings settings_ = null; - - /** - * To get an instance of this class, use the method - * getInstance() instead of this CTOR. - * - * The CTOR is called by getInstance() as needed and - * loads all required JCEF libraries. - * - * @throws UnsatisfiedLinkError - */ - private CefApp(String[] args, CefSettings settings) throws UnsatisfiedLinkError { - super(args); - if (settings != null) settings_ = settings.clone(); - if (OS.isWindows()) { - System.loadLibrary("jawt"); - System.loadLibrary("chrome_elf"); - System.loadLibrary("libcef"); - } else if (OS.isLinux()) { - System.loadLibrary("cef"); - } - System.loadLibrary("jcef"); - if (appHandler_ == null) { - appHandler_ = this; - } - - // Execute on the AWT event dispatching thread. - try { - Runnable r = new Runnable() { - @Override - public void run() { - // Perform native pre-initialization. - if (!N_PreInitialize()) - throw new IllegalStateException("Failed to pre-initialize native code"); - } - }; - if (SwingUtilities.isEventDispatchThread()) - r.run(); - else - SwingUtilities.invokeAndWait(r); - } catch (Exception e) { - e.printStackTrace(); - } - - Runtime.getRuntime().addShutdownHook(new Thread("JCEF Shutdown Hook") { - @Override - public void run() { - try { - for (CefClient c : clients_) { - c.dispose(); - } - - // Wait for shutdown() to complete. - cefShutdown.awaitUninterruptibly(); - - // Avoid a deadlock. Give the native code at least 150 milliseconds - // to terminate. - Thread.sleep(150); - } catch (Exception e) { - } - } - }); - } - - /** - * Assign an AppHandler to CefApp. The AppHandler can be used to evaluate - * application arguments, to register your own schemes and to hook into the - * shutdown sequence. See CefAppHandler for more details. - * - * This method must be called before CefApp is initialized. CefApp will be - * initialized automatically if you call createClient() the first time. - * @param appHandler An instance of CefAppHandler. - * - * @throws IllegalStateException in case of CefApp is already initialized - */ - public static void addAppHandler(CefAppHandler appHandler) throws IllegalStateException { - if (getState().compareTo(CefAppState.NEW) > 0) - throw new IllegalStateException("Must be called before CefApp is initialized"); - appHandler_ = appHandler; - } - - /** - * Get an instance of this class. - * @return an instance of this class - * @throws UnsatisfiedLinkError - */ - public static synchronized CefApp getInstance() throws UnsatisfiedLinkError { - return getInstance(null, null); - } - - public static synchronized CefApp getInstance(String[] args) throws UnsatisfiedLinkError { - return getInstance(args, null); - } - - public static synchronized CefApp getInstance(CefSettings settings) - throws UnsatisfiedLinkError { - return getInstance(null, settings); - } - - public static synchronized CefApp getInstance(String[] args, CefSettings settings) - throws UnsatisfiedLinkError { - if (settings != null) { - if (getState() != CefAppState.NONE && getState() != CefAppState.NEW) - throw new IllegalStateException("Settings can only be passed to CEF" - + " before createClient is called the first time."); - } - if (self == null) { - if (getState() == CefAppState.TERMINATED) - throw new IllegalStateException("CefApp was terminated"); - self = new CefApp(args, settings); - setState(CefAppState.NEW); - } - return self; - } - - public final void setSettings(CefSettings settings) throws IllegalStateException { - if (getState() != CefAppState.NONE && getState() != CefAppState.NEW) - throw new IllegalStateException("Settings can only be passed to CEF" - + " before createClient is called the first time."); - settings_ = settings.clone(); - } - - public final CefVersion getVersion() { - try { - return N_GetVersion(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - /** - * Returns the current state of CefApp. - * @return current state. - */ - public final static CefAppState getState() { - synchronized (state_) { - return state_; - } - } - - private static final void setState(final CefAppState state) { - synchronized (state_) { - state_ = state; - } - // Execute on the AWT event dispatching thread. - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (appHandler_ != null) appHandler_.stateHasChanged(state); - } - }); - } - - /** - * To shutdown the system, it's important to call the dispose - * method. Calling this method closes all client instances with - * and all browser instances each client owns. After that the - * message loop is terminated and CEF is shutdown. - */ - public synchronized final void dispose() { - switch (getState()) { - case NEW: - // Nothing to do inspite of invalidating the state - setState(CefAppState.TERMINATED); - break; - - case INITIALIZING: - case INITIALIZED: - // (3) Shutdown sequence. Close all clients and continue. - setState(CefAppState.SHUTTING_DOWN); - if (clients_.isEmpty()) { - shutdown(); - } else { - // shutdown() will be called from clientWasDisposed() when the last - // client is gone. - for (CefClient c : clients_) { - c.dispose(); - } - } - break; - - case NONE: - case SHUTTING_DOWN: - case TERMINATED: - // Ignore shutdown, CefApp is already terminated, in shutdown progress - // or was never created (shouldn't be possible) - break; - } - } - - /** - * Creates a new client instance and returns it to the caller. - * One client instance is responsible for one to many browser - * instances - * @return a new client instance - */ - public synchronized CefClient createClient() { - switch (getState()) { - case NEW: - setState(CefAppState.INITIALIZING); - initialize(); - // FALL THRU - - case INITIALIZING: - case INITIALIZED: - CefClient client = new CefClient(); - clients_.add(client); - return client; - - default: - throw new IllegalStateException("Can't crate client in state " + state_); - } - } - - /** - * Register a scheme handler factory for the specified |scheme_name| and - * optional |domain_name|. An empty |domain_name| value for a standard scheme - * will cause the factory to match all domain names. The |domain_name| value - * will be ignored for non-standard schemes. If |scheme_name| is a built-in - * scheme and no handler is returned by |factory| then the built-in scheme - * handler factory will be called. If |scheme_name| is a custom scheme then - * also implement the CefApp::OnRegisterCustomSchemes() method in all - * processes. This function may be called multiple times to change or remove - * the factory that matches the specified |scheme_name| and optional - * |domain_name|. Returns false if an error occurs. This function may be - * called on any thread in the browser process. - */ - public boolean registerSchemeHandlerFactory( - String schemeName, String domainName, CefSchemeHandlerFactory factory) { - try { - return N_RegisterSchemeHandlerFactory(schemeName, domainName, factory); - } catch (Exception err) { - err.printStackTrace(); - } - return false; - } - - /** - * Clear all registered scheme handler factories. Returns false on error. This - * function may be called on any thread in the browser process. - */ - public boolean clearSchemeHandlerFactories() { - try { - return N_ClearSchemeHandlerFactories(); - } catch (Exception err) { - err.printStackTrace(); - } - return false; - } - - /** - * This method is called by a CefClient if it was disposed. This causes - * CefApp to clean up its list of available client instances. If all clients - * are disposed, CefApp will be shutdown. - * @param client the disposed client. - */ - final protected void clientWasDisposed(CefClient client) { - clients_.remove(client); - if (clients_.isEmpty() && getState().compareTo(CefAppState.SHUTTING_DOWN) >= 0) { - // Shutdown native system. - shutdown(); - } - } - - /** - * Initialize the context. - * @return true on success. - */ - private final void initialize() { - // Execute on the AWT event dispatching thread. - try { - Runnable r = new Runnable() { - @Override - public void run() { - String library_path = getJcefLibPath(); - System.out.println("initialize on " + Thread.currentThread() - + " with library path " + library_path); - - CefSettings settings = settings_ != null ? settings_ : new CefSettings(); - - // Avoid to override user values by testing on NULL - if (OS.isMacintosh()) { - if (settings.browser_subprocess_path == null) { - Path path = Paths.get(library_path, - "../Frameworks/jcef Helper.app/Contents/MacOS/jcef Helper"); - settings.browser_subprocess_path = - path.normalize().toAbsolutePath().toString(); - } - } else if (OS.isWindows()) { - if (settings.browser_subprocess_path == null) { - settings.browser_subprocess_path = library_path + "\\jcef_helper.exe"; - } - } else if (OS.isLinux()) { - if (settings.browser_subprocess_path == null) - settings.browser_subprocess_path = library_path + "/jcef_helper"; - if (settings.resources_dir_path == null) - settings.resources_dir_path = library_path; - if (settings.locales_dir_path == null) - settings.locales_dir_path = library_path + "/locales"; - } - - if (N_Initialize(library_path, appHandler_, settings)) - setState(CefAppState.INITIALIZED); - } - }; - if (SwingUtilities.isEventDispatchThread()) - r.run(); - else - SwingUtilities.invokeAndWait(r); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * This method is invoked by the native code (currently on Mac only) in case - * of a termination event (e.g. someone pressed CMD+Q). - */ - protected final void handleBeforeTerminate() { - // Execute on the AWT event dispatching thread. Always call asynchronously - // so the call stack has a chance to unwind. - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - CefAppHandler handler = - (CefAppHandler) ((appHandler_ == null) ? this : appHandler_); - if (!handler.onBeforeTerminate()) dispose(); - } - }); - } - - /** - * Shut down the context. - */ - private final void shutdown() { - // Execute on the AWT event dispatching thread. Always call asynchronously - // so the call stack has a chance to unwind. - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - System.out.println("shutdown on " + Thread.currentThread()); - - // Shutdown native CEF. - N_Shutdown(); - - setState(CefAppState.TERMINATED); - CefApp.self = null; - - // Allow the shutdown hook to terminate. - lock.lock(); - cefShutdown.signal(); - lock.unlock(); - } - }); - } - - /** - * Perform a single message loop iteration. Used on all platforms except - * Windows with windowed rendering. - */ - public final void doMessageLoopWork(final long delay_ms) { - // Execute on the AWT event dispatching thread. - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (getState() == CefAppState.TERMINATED) return; - - // The maximum number of milliseconds we're willing to wait between - // calls to DoMessageLoopWork(). - final long kMaxTimerDelay = 1000 / 30; // 30fps - - if (workTimer_ != null) { - workTimer_.stop(); - workTimer_ = null; - } - - if (delay_ms <= 0) { - // Execute the work immediately. - N_DoMessageLoopWork(); - - // Schedule more work later. - doMessageLoopWork(kMaxTimerDelay); - } else { - long timer_delay_ms = delay_ms; - // Never wait longer than the maximum allowed time. - if (timer_delay_ms > kMaxTimerDelay) timer_delay_ms = kMaxTimerDelay; - - workTimer_ = new Timer((int) timer_delay_ms, new ActionListener() { - @Override - public void actionPerformed(ActionEvent evt) { - // Timer has timed out. - workTimer_.stop(); - workTimer_ = null; - - N_DoMessageLoopWork(); - - // Schedule more work later. - doMessageLoopWork(kMaxTimerDelay); - } - }); - workTimer_.start(); - } - } - }); - } - - /** - * Get the path which contains the jcef library - * @return The path to the jcef library - */ - private final String getJcefLibPath() { - String library_path = System.getProperty("java.library.path"); - String[] paths = library_path.split(System.getProperty("path.separator")); - for (String path : paths) { - File dir = new File(path); - String[] found = dir.list(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return (name.equalsIgnoreCase("libjcef.dylib") - || name.equalsIgnoreCase("libjcef.so") - || name.equalsIgnoreCase("jcef.dll")); - } - }); - if (found != null && found.length != 0) return path; - } - return library_path; - } - - private final native boolean N_PreInitialize(); - private final native boolean N_Initialize( - String pathToJavaDLL, CefAppHandler appHandler, CefSettings settings); - private final native void N_Shutdown(); - private final native void N_DoMessageLoopWork(); - private final native CefVersion N_GetVersion(); - private final native boolean N_RegisterSchemeHandlerFactory( - String schemeName, String domainName, CefSchemeHandlerFactory factory); - private final native boolean N_ClearSchemeHandlerFactories(); -} diff --git a/wizard-browser/src/main/java/org/cef/CefClient.java b/wizard-browser/src/main/java/org/cef/CefClient.java deleted file mode 100644 index b48b1d9..0000000 --- a/wizard-browser/src/main/java/org/cef/CefClient.java +++ /dev/null @@ -1,850 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef; - -import java.awt.Component; -import java.awt.Container; -import java.awt.FocusTraversalPolicy; -import java.awt.KeyboardFocusManager; -import java.awt.Point; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.nio.ByteBuffer; -import java.util.Collection; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.SwingUtilities; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefBrowserFactory; -import org.cef.browser.CefFrame; -import org.cef.browser.CefMessageRouter; -import org.cef.browser.CefRequestContext; -import org.cef.callback.CefAuthCallback; -import org.cef.callback.CefBeforeDownloadCallback; -import org.cef.callback.CefContextMenuParams; -import org.cef.callback.CefDownloadItem; -import org.cef.callback.CefDownloadItemCallback; -import org.cef.callback.CefDragData; -import org.cef.callback.CefFileDialogCallback; -import org.cef.callback.CefGeolocationCallback; -import org.cef.callback.CefJSDialogCallback; -import org.cef.callback.CefMenuModel; -import org.cef.callback.CefRequestCallback; -import org.cef.handler.CefClientHandler; -import org.cef.handler.CefContextMenuHandler; -import org.cef.handler.CefDialogHandler; -import org.cef.handler.CefDisplayHandler; -import org.cef.handler.CefDownloadHandler; -import org.cef.handler.CefDragHandler; -import org.cef.handler.CefFocusHandler; -import org.cef.handler.CefGeolocationHandler; -import org.cef.handler.CefJSDialogHandler; -import org.cef.handler.CefKeyboardHandler; -import org.cef.handler.CefLifeSpanHandler; -import org.cef.handler.CefLoadHandler; -import org.cef.handler.CefRenderHandler; -import org.cef.handler.CefRequestHandler; -import org.cef.handler.CefResourceHandler; -import org.cef.handler.CefWindowHandler; -import org.cef.misc.BoolRef; -import org.cef.misc.StringRef; -import org.cef.network.CefRequest; -import org.cef.network.CefRequest.TransitionType; -import org.cef.network.CefResponse; -import org.cef.network.CefURLRequest; -import org.cef.network.CefWebPluginInfo; - -/** - * Client that owns a browser and renderer. - */ -public class CefClient extends CefClientHandler - implements CefContextMenuHandler, CefDialogHandler, CefDisplayHandler, CefDownloadHandler, - CefDragHandler, CefFocusHandler, CefGeolocationHandler, CefJSDialogHandler, - CefKeyboardHandler, CefLifeSpanHandler, CefLoadHandler, CefRenderHandler, - CefRequestHandler, CefWindowHandler { - private HashMap browser_ = new HashMap(); - private CefContextMenuHandler contextMenuHandler_ = null; - private CefDialogHandler dialogHandler_ = null; - private CefDisplayHandler displayHandler_ = null; - private CefDownloadHandler downloadHandler_ = null; - private CefDragHandler dragHandler_ = null; - private CefFocusHandler focusHandler_ = null; - private CefGeolocationHandler geolocationHandler_ = null; - private CefJSDialogHandler jsDialogHandler_ = null; - private CefKeyboardHandler keyboardHandler_ = null; - private CefLifeSpanHandler lifeSpanHandler_ = null; - private CefLoadHandler loadHandler_ = null; - private CefRequestHandler requestHandler_ = null; - private boolean wasDisposed = false; - private volatile CefBrowser focusedBrowser_ = null; - - /** - * The CTOR is only accessible within this package. - * Use CefApp.createClient() to create an instance of - * this class. - * @see CefApp.createClient() - */ - CefClient() throws UnsatisfiedLinkError { - super(); - - KeyboardFocusManager km = KeyboardFocusManager.getCurrentKeyboardFocusManager(); - km.addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (focusedBrowser_ != null) { - Component browserUI = focusedBrowser_.getUIComponent(); - Object oldUI = evt.getOldValue(); - if (isPartOf(oldUI, browserUI)) { - focusedBrowser_.setFocus(false); - focusedBrowser_ = null; - } - } - } - }); - } - - private boolean isPartOf(Object obj, Component browserUI) { - if (obj == browserUI) return true; - if (obj instanceof Container) { - Component childs[] = ((Container) obj).getComponents(); - for (Component child : childs) { - return isPartOf(child, browserUI); - } - } - return false; - } - - @Override - public void dispose() { - wasDisposed = true; - synchronized (browser_) { - Collection browserList = browser_.values(); - for (CefBrowser browser : browserList) { - browser.close(); - } - } - } - - // CefClientHandler - - public CefBrowser createBrowser( - String url, boolean isOffscreenRendered, boolean isTransparent) { - return createBrowser(url, isOffscreenRendered, isTransparent, null); - } - - public CefBrowser createBrowser(String url, boolean isOffscreenRendered, boolean isTransparent, - CefRequestContext context) { - if (wasDisposed) - throw new IllegalStateException("Can't create browser. CefClient is disposed"); - return CefBrowserFactory.create(this, url, isOffscreenRendered, isTransparent, context); - } - - @Override - protected CefBrowser getBrowser(int identifier) { - synchronized (browser_) { - return browser_.get(new Integer(identifier)); - } - } - - @Override - protected Object[] getAllBrowser() { - synchronized (browser_) { - return browser_.values().toArray(); - } - } - - @Override - protected CefContextMenuHandler getContextMenuHandler() { - return this; - } - - @Override - protected CefDialogHandler getDialogHandler() { - return this; - }; - - @Override - protected CefDisplayHandler getDisplayHandler() { - return this; - } - - @Override - protected CefDownloadHandler getDownloadHandler() { - return this; - } - - @Override - protected CefDragHandler getDragHandler() { - return this; - } - - @Override - protected CefFocusHandler getFocusHandler() { - return this; - } - - @Override - protected CefGeolocationHandler getGeolocationHandler() { - return this; - } - - @Override - protected CefJSDialogHandler getJSDialogHandler() { - return this; - } - - @Override - protected CefKeyboardHandler getKeyboardHandler() { - return this; - } - - @Override - protected CefLifeSpanHandler getLifeSpanHandler() { - return this; - } - - @Override - protected CefLoadHandler getLoadHandler() { - return this; - } - - @Override - protected CefRenderHandler getRenderHandler() { - return this; - } - - @Override - protected CefRequestHandler getRequestHandler() { - return this; - } - - @Override - protected CefWindowHandler getWindowHandler() { - return this; - } - - // CefContextMenuHandler - - public CefClient addContextMenuHandler(CefContextMenuHandler handler) { - if (contextMenuHandler_ == null) contextMenuHandler_ = handler; - return this; - } - - public void removeContextMenuHandler() { - contextMenuHandler_ = null; - } - - @Override - public void onBeforeContextMenu( - CefBrowser browser, CefFrame frame, CefContextMenuParams params, CefMenuModel model) { - if (contextMenuHandler_ != null && browser != null) - contextMenuHandler_.onBeforeContextMenu(browser, frame, params, model); - } - - @Override - public boolean onContextMenuCommand(CefBrowser browser, CefFrame frame, - CefContextMenuParams params, int commandId, int eventFlags) { - if (contextMenuHandler_ != null && browser != null) - return contextMenuHandler_.onContextMenuCommand( - browser, frame, params, commandId, eventFlags); - return false; - } - - @Override - public void onContextMenuDismissed(CefBrowser browser, CefFrame frame) { - if (contextMenuHandler_ != null && browser != null) - contextMenuHandler_.onContextMenuDismissed(browser, frame); - } - - // CefDialogHandler - - public CefClient addDialogHandler(CefDialogHandler handler) { - if (dialogHandler_ == null) dialogHandler_ = handler; - return this; - } - - public void removeDialogHandler() { - dialogHandler_ = null; - } - - @Override - public boolean onFileDialog(CefBrowser browser, FileDialogMode mode, String title, - String defaultFilePath, Vector acceptFilters, int selectedAcceptFilter, - CefFileDialogCallback callback) { - if (dialogHandler_ != null && browser != null) { - return dialogHandler_.onFileDialog(browser, mode, title, defaultFilePath, acceptFilters, - selectedAcceptFilter, callback); - } - return false; - } - - // CefDisplayHandler - - public CefClient addDisplayHandler(CefDisplayHandler handler) { - if (displayHandler_ == null) displayHandler_ = handler; - return this; - } - - public void removeDisplayHandler() { - displayHandler_ = null; - } - - @Override - public void onAddressChange(CefBrowser browser, CefFrame frame, String url) { - if (displayHandler_ != null && browser != null) - displayHandler_.onAddressChange(browser, frame, url); - } - - @Override - public void onTitleChange(CefBrowser browser, String title) { - if (displayHandler_ != null && browser != null) - displayHandler_.onTitleChange(browser, title); - } - - @Override - public boolean onTooltip(CefBrowser browser, String text) { - if (displayHandler_ != null && browser != null) { - return displayHandler_.onTooltip(browser, text); - } - return false; - } - - @Override - public void onStatusMessage(CefBrowser browser, String value) { - if (displayHandler_ != null && browser != null) { - displayHandler_.onStatusMessage(browser, value); - } - } - - @Override - public boolean onConsoleMessage(CefBrowser browser, String message, String source, int line) { - if (displayHandler_ != null && browser != null) { - return displayHandler_.onConsoleMessage(browser, message, source, line); - } - return false; - } - - // CefDownloadHandler - - public CefClient addDownloadHandler(CefDownloadHandler handler) { - if (downloadHandler_ == null) downloadHandler_ = handler; - return this; - } - - public void removeDownloadHandler() { - downloadHandler_ = null; - } - - @Override - public void onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem, - String suggestedName, CefBeforeDownloadCallback callback) { - if (downloadHandler_ != null && browser != null) - downloadHandler_.onBeforeDownload(browser, downloadItem, suggestedName, callback); - } - - @Override - public void onDownloadUpdated( - CefBrowser browser, CefDownloadItem downloadItem, CefDownloadItemCallback callback) { - if (downloadHandler_ != null && browser != null) - downloadHandler_.onDownloadUpdated(browser, downloadItem, callback); - } - - // CefDragHandler - - public CefClient addDragHandler(CefDragHandler handler) { - if (dragHandler_ == null) dragHandler_ = handler; - return this; - } - - public void removeDragHandler() { - dragHandler_ = null; - } - - @Override - public boolean onDragEnter(CefBrowser browser, CefDragData dragData, int mask) { - if (dragHandler_ != null && browser != null) - return dragHandler_.onDragEnter(browser, dragData, mask); - return false; - } - - // CefFocusHandler - - public CefClient addFocusHandler(CefFocusHandler handler) { - if (focusHandler_ == null) focusHandler_ = handler; - return this; - } - - public void removeFocusHandler() { - focusHandler_ = null; - } - - @Override - public void onTakeFocus(CefBrowser browser, boolean next) { - if (browser == null) return; - - browser.setFocus(false); - Container parent = browser.getUIComponent().getParent(); - if (parent != null) { - FocusTraversalPolicy policy = null; - while (parent != null) { - policy = parent.getFocusTraversalPolicy(); - if (policy != null) break; - parent = parent.getParent(); - } - if (policy != null) { - Component nextComp = next - ? policy.getComponentAfter(parent, browser.getUIComponent()) - : policy.getComponentBefore(parent, browser.getUIComponent()); - if (nextComp == null) { - policy.getDefaultComponent(parent).requestFocus(); - } else { - nextComp.requestFocus(); - } - } - } - focusedBrowser_ = null; - if (focusHandler_ != null) focusHandler_.onTakeFocus(browser, next); - } - - @Override - public boolean onSetFocus(final CefBrowser browser, FocusSource source) { - if (browser == null) return false; - - boolean alreadyHandled = false; - if (focusHandler_ != null) alreadyHandled = focusHandler_.onSetFocus(browser, source); - if (!alreadyHandled) { - Runnable r = new Runnable() { - @Override - public void run() { - Component uiComponent = browser.getUIComponent(); - if (uiComponent != null) { - uiComponent.requestFocus(); - } - } - }; - if (SwingUtilities.isEventDispatchThread()) - r.run(); - else - SwingUtilities.invokeLater(r); - } - return alreadyHandled; - } - - @Override - public void onGotFocus(CefBrowser browser) { - if (browser == null) return; - - focusedBrowser_ = browser; - browser.setFocus(true); - if (focusHandler_ != null) focusHandler_.onGotFocus(browser); - } - - // CefGeolocationHandler - - public CefClient addGeolocationHandler(CefGeolocationHandler handler) { - if (geolocationHandler_ == null) geolocationHandler_ = handler; - return this; - } - - public void removeGeolocationHandler() { - geolocationHandler_ = null; - } - - @Override - public boolean onRequestGeolocationPermission(CefBrowser browser, String requesting_url, - int request_id, CefGeolocationCallback callback) { - if (geolocationHandler_ != null && browser != null) { - return geolocationHandler_.onRequestGeolocationPermission( - browser, requesting_url, request_id, callback); - } - return false; - } - - @Override - public void onCancelGeolocationPermission(CefBrowser browser, int request_id) { - if (geolocationHandler_ != null && browser != null) - geolocationHandler_.onCancelGeolocationPermission(browser, request_id); - } - - // CefJSDialogHandler - - public CefClient addJSDialogHandler(CefJSDialogHandler handler) { - if (jsDialogHandler_ == null) jsDialogHandler_ = handler; - return this; - } - - public void removeJSDialogHandler() { - jsDialogHandler_ = null; - } - - @Override - public boolean onJSDialog(CefBrowser browser, String origin_url, JSDialogType dialog_type, - String message_text, String default_prompt_text, CefJSDialogCallback callback, - BoolRef suppress_message) { - if (jsDialogHandler_ != null && browser != null) - return jsDialogHandler_.onJSDialog(browser, origin_url, dialog_type, message_text, - default_prompt_text, callback, suppress_message); - return false; - } - - @Override - public boolean onBeforeUnloadDialog(CefBrowser browser, String message_text, boolean is_reload, - CefJSDialogCallback callback) { - if (jsDialogHandler_ != null && browser != null) - return jsDialogHandler_.onBeforeUnloadDialog( - browser, message_text, is_reload, callback); - return false; - } - - @Override - public void onResetDialogState(CefBrowser browser) { - if (jsDialogHandler_ != null && browser != null) - jsDialogHandler_.onResetDialogState(browser); - } - - @Override - public void onDialogClosed(CefBrowser browser) { - if (jsDialogHandler_ != null && browser != null) jsDialogHandler_.onDialogClosed(browser); - } - - // CefKeyboardHandler - - public CefClient addKeyboardHandler(CefKeyboardHandler handler) { - if (keyboardHandler_ == null) keyboardHandler_ = handler; - return this; - } - - public void removeKeyboardHandler() { - keyboardHandler_ = null; - } - - @Override - public boolean onPreKeyEvent( - CefBrowser browser, CefKeyEvent event, BoolRef is_keyboard_shortcut) { - if (keyboardHandler_ != null && browser != null) - return keyboardHandler_.onPreKeyEvent(browser, event, is_keyboard_shortcut); - return false; - } - - @Override - public boolean onKeyEvent(CefBrowser browser, CefKeyEvent event) { - if (keyboardHandler_ != null && browser != null) - return keyboardHandler_.onKeyEvent(browser, event); - return false; - } - - // CefLifeSpanHandler - - public CefClient addLifeSpanHandler(CefLifeSpanHandler handler) { - if (lifeSpanHandler_ == null) lifeSpanHandler_ = handler; - return this; - } - - public void removeLifeSpanHandler() { - lifeSpanHandler_ = null; - } - - @Override - public boolean onBeforePopup( - CefBrowser browser, CefFrame frame, String target_url, String target_frame_name) { - if (wasDisposed) return true; - if (lifeSpanHandler_ != null && browser != null) - return lifeSpanHandler_.onBeforePopup(browser, frame, target_url, target_frame_name); - return false; - } - - @Override - public void onAfterCreated(CefBrowser browser) { - if (browser == null) return; - - // keep browser reference - Integer identifier = browser.getIdentifier(); - synchronized (browser_) { - browser_.put(identifier, browser); - } - if (lifeSpanHandler_ != null) lifeSpanHandler_.onAfterCreated(browser); - } - - @Override - public boolean doClose(CefBrowser browser) { - if (lifeSpanHandler_ != null && browser != null) return lifeSpanHandler_.doClose(browser); - return false; - } - - @Override - public void onBeforeClose(CefBrowser browser) { - if (browser == null) return; - - if (lifeSpanHandler_ != null) lifeSpanHandler_.onBeforeClose(browser); - - // remove browser reference - int identifier = browser.getIdentifier(); - - synchronized (browser_) { - browser_.remove(identifier); - if (browser_.isEmpty() && wasDisposed) { - removeContextMenuHandler(this); - removeDialogHandler(this); - removeDisplayHandler(this); - removeDownloadHandler(this); - removeDragHandler(this); - removeFocusHandler(this); - removeGeolocationHandler(this); - removeJSDialogHandler(this); - removeKeyboardHandler(this); - removeLifeSpanHandler(this); - removeLoadHandler(this); - removeRenderHandler(this); - removeRequestHandler(this); - removeWindowHandler(this); - super.dispose(); - - CefApp.getInstance().clientWasDisposed(this); - } - } - } - - // CefLoadHandler - - public CefClient addLoadHandler(CefLoadHandler handler) { - if (loadHandler_ == null) loadHandler_ = handler; - return this; - } - - public void removeLoadHandler() { - loadHandler_ = null; - } - - @Override - public void onLoadingStateChange( - CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward) { - if (loadHandler_ != null && browser != null) - loadHandler_.onLoadingStateChange(browser, isLoading, canGoBack, canGoForward); - } - - @Override - public void onLoadStart(CefBrowser browser, CefFrame frame, TransitionType transitionType) { - if (loadHandler_ != null && browser != null) - loadHandler_.onLoadStart(browser, frame, transitionType); - } - - @Override - public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { - if (loadHandler_ != null && browser != null) - loadHandler_.onLoadEnd(browser, frame, httpStatusCode); - } - - @Override - public void onLoadError(CefBrowser browser, CefFrame frame, ErrorCode errorCode, - String errorText, String failedUrl) { - if (loadHandler_ != null && browser != null) - loadHandler_.onLoadError(browser, frame, errorCode, errorText, failedUrl); - } - - // CefMessageRouter - - @Override - public synchronized void addMessageRouter(CefMessageRouter messageRouter) { - super.addMessageRouter(messageRouter); - } - - @Override - public synchronized void removeMessageRouter(CefMessageRouter messageRouter) { - super.removeMessageRouter(messageRouter); - } - - // CefRenderHandler - - @Override - public Rectangle getViewRect(CefBrowser browser) { - if (browser == null) return new Rectangle(0, 0, 0, 0); - - CefRenderHandler realHandler = browser.getRenderHandler(); - if (realHandler != null) return realHandler.getViewRect(browser); - return new Rectangle(0, 0, 0, 0); - } - - @Override - public Point getScreenPoint(CefBrowser browser, Point viewPoint) { - if (browser == null) return new Point(0, 0); - - CefRenderHandler realHandler = browser.getRenderHandler(); - if (realHandler != null) return realHandler.getScreenPoint(browser, viewPoint); - return new Point(0, 0); - } - - @Override - public void onPopupShow(CefBrowser browser, boolean show) { - if (browser == null) return; - - CefRenderHandler realHandler = browser.getRenderHandler(); - if (realHandler != null) realHandler.onPopupShow(browser, show); - } - - @Override - public void onPopupSize(CefBrowser browser, Rectangle size) { - if (browser == null) return; - - CefRenderHandler realHandler = browser.getRenderHandler(); - if (realHandler != null) realHandler.onPopupSize(browser, size); - } - - @Override - public void onPaint(CefBrowser browser, boolean popup, Rectangle[] dirtyRects, - ByteBuffer buffer, int width, int height) { - if (browser == null) return; - - CefRenderHandler realHandler = browser.getRenderHandler(); - if (realHandler != null) - realHandler.onPaint(browser, popup, dirtyRects, buffer, width, height); - } - - @Override - public void onCursorChange(CefBrowser browser, int cursorType) { - if (browser == null) return; - - CefRenderHandler realHandler = browser.getRenderHandler(); - if (realHandler != null) realHandler.onCursorChange(browser, cursorType); - } - - @Override - public boolean startDragging(CefBrowser browser, CefDragData dragData, int mask, int x, int y) { - if (browser == null) return false; - - CefRenderHandler realHandler = browser.getRenderHandler(); - if (realHandler != null) return realHandler.startDragging(browser, dragData, mask, x, y); - return false; - } - - @Override - public void updateDragCursor(CefBrowser browser, int operation) { - if (browser == null) return; - - CefRenderHandler realHandler = browser.getRenderHandler(); - if (realHandler != null) realHandler.updateDragCursor(browser, operation); - } - - // CefRequestHandler - - public CefClient addRequestHandler(CefRequestHandler handler) { - if (requestHandler_ == null) requestHandler_ = handler; - return this; - } - - public void removeRequestHandler() { - requestHandler_ = null; - } - - @Override - public boolean onBeforeBrowse( - CefBrowser browser, CefFrame frame, CefRequest request, boolean is_redirect) { - if (requestHandler_ != null && browser != null) - return requestHandler_.onBeforeBrowse(browser, frame, request, is_redirect); - return false; - } - - @Override - public boolean onBeforeResourceLoad(CefBrowser browser, CefFrame frame, CefRequest request) { - if (requestHandler_ != null && browser != null) - return requestHandler_.onBeforeResourceLoad(browser, frame, request); - return false; - } - - @Override - public CefResourceHandler getResourceHandler( - CefBrowser browser, CefFrame frame, CefRequest request) { - if (requestHandler_ != null && browser != null) - return requestHandler_.getResourceHandler(browser, frame, request); - return null; - } - - @Override - public void onResourceRedirect(CefBrowser browser, CefFrame frame, CefRequest request, - CefResponse response, StringRef new_url) { - if (requestHandler_ != null && browser != null) - requestHandler_.onResourceRedirect(browser, frame, request, response, new_url); - } - - @Override - public boolean onResourceResponse( - CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response) { - if (requestHandler_ != null && browser != null) - return requestHandler_.onResourceResponse(browser, frame, request, response); - return false; - } - - @Override - public void onResourceLoadComplete(CefBrowser browser, CefFrame frame, CefRequest request, - CefResponse response, CefURLRequest.Status status, long receivedContentLength) { - if (requestHandler_ != null && browser != null) - requestHandler_.onResourceLoadComplete( - browser, frame, request, response, status, receivedContentLength); - } - - @Override - public boolean getAuthCredentials(CefBrowser browser, CefFrame frame, boolean isProxy, - String host, int port, String realm, String scheme, CefAuthCallback callback) { - if (requestHandler_ != null && browser != null) - return requestHandler_.getAuthCredentials( - browser, frame, isProxy, host, port, realm, scheme, callback); - return false; - } - - @Override - public boolean onQuotaRequest( - CefBrowser browser, String origin_url, long new_size, CefRequestCallback callback) { - if (requestHandler_ != null && browser != null) - return requestHandler_.onQuotaRequest(browser, origin_url, new_size, callback); - return false; - } - - @Override - public void onProtocolExecution(CefBrowser browser, String url, BoolRef allow_os_execution) { - if (requestHandler_ != null && browser != null) - requestHandler_.onProtocolExecution(browser, url, allow_os_execution); - } - - @Override - public boolean onCertificateError(CefBrowser browser, ErrorCode cert_error, String request_url, - CefRequestCallback callback) { - if (requestHandler_ != null) - return requestHandler_.onCertificateError(browser, cert_error, request_url, callback); - return false; - } - - @Override - public void onPluginCrashed(CefBrowser browser, String pluginPath) { - if (requestHandler_ != null) requestHandler_.onPluginCrashed(browser, pluginPath); - } - - @Override - public void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status) { - if (requestHandler_ != null) requestHandler_.onRenderProcessTerminated(browser, status); - } - - // CefWindowHandler - - @Override - public Rectangle getRect(CefBrowser browser) { - if (browser == null) return new Rectangle(0, 0, 0, 0); - - CefWindowHandler realHandler = browser.getWindowHandler(); - if (realHandler != null) return realHandler.getRect(browser); - return new Rectangle(0, 0, 0, 0); - } - - @Override - public void onMouseEvent( - CefBrowser browser, int event, int screenX, int screenY, int modifier, int button) { - if (browser == null) return; - - CefWindowHandler realHandler = browser.getWindowHandler(); - if (realHandler != null) - realHandler.onMouseEvent(browser, event, screenX, screenY, modifier, button); - } -} diff --git a/wizard-browser/src/main/java/org/cef/CefSettings.java b/wizard-browser/src/main/java/org/cef/CefSettings.java deleted file mode 100644 index 128d8d6..0000000 --- a/wizard-browser/src/main/java/org/cef/CefSettings.java +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef; - -/** - * Initialization settings. Specify NULL or 0 to get the recommended default - * values. Many of these and other settings can also configured using command- - * line switches. - */ -public class CefSettings { - /** - * Log severity levels. - */ - public enum LogSeverity { - /** - * Default logging (currently INFO logging). - */ - LOGSEVERITY_DEFAULT, - - /** - * Verbose logging. - */ - LOGSEVERITY_VERBOSE, - - /** - * INFO logging. - */ - LOGSEVERITY_INFO, - - /** - * WARNING logging. - */ - LOGSEVERITY_WARNING, - - /** - * ERROR logging. - */ - LOGSEVERITY_ERROR, - - /** - * Completely disable logging. - */ - LOGSEVERITY_DISABLE - } - - /** - * 32-bit ARGB color value, not premultiplied. The color components are always - * in a known order. Equivalent to the SkColor type. - */ - public class ColorType { - private long color_value = 0; - - private ColorType() {} - - public ColorType(int alpha, int red, int green, int blue) { - color_value = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0); - } - - public long getColor() { - return color_value; - } - - @Override - public ColorType clone() { - ColorType res = new ColorType(); - res.color_value = this.color_value; - return res; - } - } - - /** - * The path to a separate executable that will be launched for sub-processes. - * By default the browser process executable is used. See the comments on - * CefExecuteProcess() for details. Also configurable using the - * "browser-subprocess-path" command-line switch. - */ - public String browser_subprocess_path = null; - - /** - * Set to true to enable windowless (off-screen) rendering support. Do not - * enable this value if the application does not use windowless rendering as - * it may reduce rendering performance on some systems. - */ - public boolean windowless_rendering_enabled = true; - - /** - * Set to true to disable configuration of browser process features using - * standard CEF and Chromium command-line arguments. Configuration can still - * be specified using CEF data structures or via the - * CefApp::OnBeforeCommandLineProcessing() method. - */ - public boolean command_line_args_disabled = false; - - /** - * The location where cache data will be stored on disk. If empty an in-memory - * cache will be used for some features and a temporary disk cache for others. - * HTML5 databases such as localStorage will only persist across sessions if a - * cache path is specified. - */ - public String cache_path = null; - - /** - * To persist session cookies (cookies without an expiry date or validity - * interval) by default when using the global cookie manager set this value to - * true. Session cookies are generally intended to be transient and most Web - * browsers do not persist them. A |cache_path| value must also be specified to - * enable this feature. Also configurable using the "persist-session-cookies" - * command-line switch. - */ - public boolean persist_session_cookies = false; - - /** - * Value that will be returned as the User-Agent HTTP header. If empty the - * default User-Agent string will be used. Also configurable using the - * "user-agent" command-line switch. - */ - public String user_agent = null; - - /** - * Value that will be inserted as the product portion of the default - * User-Agent string. If empty the Chromium product version will be used. If - * |userAgent| is specified this value will be ignored. Also configurable - * using the "product-version" command-line switch. - */ - public String product_version = null; - - /** - * The locale string that will be passed to Blink. If empty the default - * locale of "en-US" will be used. This value is ignored on Linux where locale - * is determined using environment variable parsing with the precedence order: - * LANGUAGE, LC_ALL, LC_MESSAGES and LANG. Also configurable using the "lang" - * command-line switch. - */ - public String locale = null; - - /** - * The directory and file name to use for the debug log. If empty, the - * default name of "debug.log" will be used and the file will be written - * to the application directory. Also configurable using the "log-file" - * command-line switch. - */ - public String log_file = null; - - /** - * The log severity. Only messages of this severity level or higher will be - * logged. Also configurable using the "log-severity" command-line switch with - * a value of "verbose", "info", "warning", "error", "error-report" or - * "disable". - */ - public LogSeverity log_severity = LogSeverity.LOGSEVERITY_DEFAULT; - - /** - * Custom flags that will be used when initializing the V8 JavaScript engine. - * The consequences of using custom flags may not be well tested. Also - * configurable using the "js-flags" command-line switch. - */ - public String javascript_flags = null; - - /** - * The fully qualified path for the resources directory. If this value is - * empty the cef.pak and/or devtools_resources.pak files must be located in - * the module directory on Windows/Linux or the app bundle Resources directory - * on Mac OS X. Also configurable using the "resources-dir-path" command-line - * switch. - */ - public String resources_dir_path = null; - - /** - * The fully qualified path for the locales directory. If this value is empty - * the locales directory must be located in the module directory. This value - * is ignored on Mac OS X where pack files are always loaded from the app - * bundle Resources directory. Also configurable using the "locales-dir-path" - * command-line switch. - */ - public String locales_dir_path = null; - - /** - * Set to true to disable loading of pack files for resources and locales. - * A resource bundle handler must be provided for the browser and render - * processes via CefApp::GetResourceBundleHandler() if loading of pack files - * is disabled. Also configurable using the "disable-pack-loading" command- - * line switch. - */ - public boolean pack_loading_disabled = false; - - /** - * Set to a value between 1024 and 65535 to enable remote debugging on the - * specified port. For example, if 8080 is specified the remote debugging URL - * will be http: *localhost:8080. CEF can be remotely debugged from any CEF or - * Chrome browser window. Also configurable using the "remote-debugging-port" - * command-line switch. - */ - public int remote_debugging_port = 0; - - /** - * The number of stack trace frames to capture for uncaught exceptions. - * Specify a positive value to enable the CefV8ContextHandler:: - * OnUncaughtException() callback. Specify 0 (default value) and - * OnUncaughtException() will not be called. Also configurable using the - * "uncaught-exception-stack-size" command-line switch. - */ - public int uncaught_exception_stack_size = 0; - - /** - * Set to true to ignore errors related to invalid SSL certificates. - * Enabling this setting can lead to potential security vulnerabilities like - * "man in the middle" attacks. Applications that load content from the - * internet should not enable this setting. Also configurable using the - * "ignore-certificate-errors" command-line switch. - */ - public boolean ignore_certificate_errors = false; - - /** - * Opaque background color used for accelerated content. By default the - * background color will be white. Only the RGB compontents of the specified - * value will be used. The alpha component must greater than 0 to enable use - * of the background color but will be otherwise ignored. - */ - public ColorType background_color = null; - - public CefSettings() {} - - @Override - public CefSettings clone() { - CefSettings tmp = new CefSettings(); - tmp.browser_subprocess_path = browser_subprocess_path; - tmp.windowless_rendering_enabled = windowless_rendering_enabled; - tmp.command_line_args_disabled = command_line_args_disabled; - tmp.cache_path = cache_path; - tmp.persist_session_cookies = persist_session_cookies; - tmp.user_agent = user_agent; - tmp.product_version = product_version; - tmp.locale = locale; - tmp.log_file = log_file; - tmp.log_severity = log_severity; - tmp.javascript_flags = javascript_flags; - tmp.resources_dir_path = resources_dir_path; - tmp.locales_dir_path = locales_dir_path; - tmp.pack_loading_disabled = pack_loading_disabled; - tmp.remote_debugging_port = remote_debugging_port; - tmp.uncaught_exception_stack_size = uncaught_exception_stack_size; - tmp.ignore_certificate_errors = ignore_certificate_errors; - if (background_color != null) tmp.background_color = background_color.clone(); - return tmp; - } -} diff --git a/wizard-browser/src/main/java/org/cef/OS.java b/wizard-browser/src/main/java/org/cef/OS.java deleted file mode 100644 index be464d2..0000000 --- a/wizard-browser/src/main/java/org/cef/OS.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef; - -public class OS { - private static enum OSType { - OSUndefined, - OSLinux, - OSWindows, - OSMacintosh, - OSUnknown, - } - ; - private static OSType osType = OSType.OSUndefined; - - public static final boolean isWindows() { - return getOSType() == OSType.OSWindows; - } - - public static final boolean isMacintosh() { - return getOSType() == OSType.OSMacintosh; - } - - public static final boolean isLinux() { - return getOSType() == OSType.OSLinux; - } - - private static final OSType getOSType() { - if (osType == OSType.OSUndefined) { - String os = System.getProperty("os.name").toLowerCase(); - if (os.startsWith("windows")) - osType = OSType.OSWindows; - else if (os.startsWith("linux")) - osType = OSType.OSLinux; - else if (os.startsWith("mac")) - osType = OSType.OSMacintosh; - else - osType = OSType.OSUnknown; - } - return osType; - } -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefBrowser.java b/wizard-browser/src/main/java/org/cef/browser/CefBrowser.java deleted file mode 100644 index fc5f86a..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefBrowser.java +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import java.awt.Component; -import java.awt.Point; -import java.util.Vector; - -import org.cef.callback.CefPdfPrintCallback; -import org.cef.callback.CefRunFileDialogCallback; -import org.cef.callback.CefStringVisitor; -import org.cef.handler.CefDialogHandler.FileDialogMode; -import org.cef.handler.CefRenderHandler; -import org.cef.handler.CefWindowHandler; -import org.cef.misc.CefPdfPrintSettings; -import org.cef.network.CefRequest; - -/** - * Interface representing a browser. - */ -public interface CefBrowser { - /** - * Get the underlying UI component (e.g. java.awt.Canvas). - * @return The underlying UI component. - */ - public Component getUIComponent(); - - /** - * Get an implementation of CefRenderHandler if any. - * @return An instance of CefRenderHandler or null. - */ - public CefRenderHandler getRenderHandler(); - - /** - * Get an implementation of CefWindowHandler if any. - * @return An instance of CefWindowHandler or null. - */ - public CefWindowHandler getWindowHandler(); - - // - // The following methods are forwarded to CefBrowser. - // - - /** - * Tests if the browser can navigate backwards. - * @return true if the browser can navigate backwards. - */ - public boolean canGoBack(); - - /** - * Go back. - */ - public void goBack(); - - /** - * Tests if the browser can navigate forwards. - * @return true if the browser can navigate forwards. - */ - public boolean canGoForward(); - - /** - * Go forward. - */ - public void goForward(); - - /** - * Tests if the browser is currently loading. - * @return true if the browser is currently loading. - */ - public boolean isLoading(); - - /** - * Reload the current page. - */ - public void reload(); - - /** - * Reload the current page ignoring any cached data. - */ - public void reloadIgnoreCache(); - - /** - * Stop loading the page. - */ - public void stopLoad(); - - /** - * Returns the unique browser identifier. - * @return The browser identifier - */ - public int getIdentifier(); - - /** - * Returns the main (top-level) frame for the browser window. - * @return The main frame - */ - public CefFrame getMainFrame(); - - /** - * Returns the focused frame for the browser window. - * @return The focused frame - */ - public CefFrame getFocusedFrame(); - - /** - * Returns the frame with the specified identifier, or NULL if not found. - * @param identifier The unique frame identifier - * @return The frame or NULL if not found - */ - public CefFrame getFrame(long identifier); - - /** - * Returns the frame with the specified name, or NULL if not found. - * @param name The specified name - * @return The frame or NULL if not found - */ - public CefFrame getFrame(String name); - - /** - * Returns the identifiers of all existing frames. - * @return All identifiers of existing frames. - */ - public Vector getFrameIdentifiers(); - - /** - * Returns the names of all existing frames. - * @return The names of all existing frames. - */ - public Vector getFrameNames(); - - /** - * Returns the number of frames that currently exist. - * @return The number of frames - */ - public int getFrameCount(); - - /** - * Tests if the window is a popup window. - * @return true if the window is a popup window. - */ - public boolean isPopup(); - - /** - * Tests if a document has been loaded in the browser. - * @return true if a document has been loaded in the browser. - */ - public boolean hasDocument(); - - // - // The following methods are forwarded to the mainFrame. - // - - /** - * Save this frame's HTML source to a temporary file and open it in the - * default text viewing application. This method can only be called from the - * browser process. - */ - public void viewSource(); - - /** - * Retrieve this frame's HTML source as a string sent to the specified - * visitor. - * - * @param visitor - */ - public void getSource(CefStringVisitor visitor); - - /** - * Retrieve this frame's display text as a string sent to the specified - * visitor. - * - * @param visitor - */ - public void getText(CefStringVisitor visitor); - - /** - * Load the request represented by the request object. - * - * @param request The request object. - */ - public void loadRequest(CefRequest request); - - /** - * Load the specified URL in the main frame. - * @param url The URL to load. - */ - public void loadURL(String url); - - /** - * Load the contents of val with the specified dummy url. - * url should have a standard scheme (for example, http scheme) or - * behaviors like link clicks and web security restrictions may not - * behave as expected. - * - * @param val Content to be displayed. - * @param url dummy url to be used for. - */ - public void loadString(String val, String url); - - /** - * Execute a string of JavaScript code in this frame. The url - * parameter is the URL where the script in question can be found, if any. - * The renderer may request this URL to show the developer the source of the - * error. The line parameter is the base line number to use for error - * reporting. - * - * @param code The code to be executed. - * @param url The URL where the script in question can be found. - * @param line The base line number to use for error reporting. - */ - public void executeJavaScript(String code, String url, int line); - - /** - * Emits the URL currently loaded in this frame. - * @return the URL currently loaded in this frame. - */ - public String getURL(); - - // The following methods are forwarded to CefBrowserHost. - - /** - * Close the browser. - */ - public void close(); - - /** - * Set or remove keyboard focus to/from the browser window. - * @param enable set to true to give the focus to the browser - **/ - public void setFocus(boolean enable); - - /** - * Set whether the window containing the browser is visible - * (minimized/unminimized, app hidden/unhidden, etc). Only used on Mac OS X. - * @param visible - */ - public void setWindowVisibility(boolean visible); - - /** - * Get the current zoom level. The default zoom level is 0.0. - * @return The current zoom level. - */ - public double getZoomLevel(); - - /** - * Change the zoom level to the specified value. Specify 0.0 to reset the - * zoom level. - * - * @param zoomLevel The zoom level to be set. - */ - public void setZoomLevel(double zoomLevel); - - /** - * Call to run a file chooser dialog. Only a single file chooser dialog may be - * pending at any given time.The dialog will be initiated asynchronously on - * the UI thread. - * - * @param mode represents the type of dialog to display. - * @param title to be used for the dialog and may be empty to show the - * default title ("Open" or "Save" depending on the mode). - * @param defaultFilePath is the path with optional directory and/or file name - * component that should be initially selected in the dialog. - * @param acceptFilters are used to restrict the selectable file types and may - * any combination of (a) valid lower-cased MIME types (e.g. "text/*" or - * "image/*"), (b) individual file extensions (e.g. ".txt" or ".png"), or (c) - * combined description and file extension delimited using "|" and ";" (e.g. - * "Image Types|.png;.gif;.jpg"). - * @param selectedAcceptFilter is the 0-based index of the filter that should - * be selected by default. - * @param callback will be executed after the dialog is dismissed or - * immediately if another dialog is already pending. - */ - public void runFileDialog(FileDialogMode mode, String title, String defaultFilePath, - Vector acceptFilters, int selectedAcceptFilter, - CefRunFileDialogCallback callback); - - /** - * Download the file at url using CefDownloadHandler. - * - * @param url URL to download that file. - */ - public void startDownload(String url); - - /** - * Print the current browser contents. - */ - public void print(); - - /** - * Print the current browser contents to a PDF. - * - * @param path The path of the file to write to (will be overwritten if it - * already exists). Cannot be null. - * @param settings The pdf print settings to use. If null then defaults - * will be used. - * @param callback Called when the pdf print job has completed. - */ - public void printToPDF(String path, CefPdfPrintSettings settings, CefPdfPrintCallback callback); - - /** - * Search for some kind of text on the page. - * - * @param identifier can be used to have multiple searches running simultaniously. - * @param searchText to be searched for. - * @param forward indicates whether to search forward or backward within the page. - * @param matchCase indicates whether the search should be case-sensitive. - * @param findNext indicates whether this is the first request or a follow-up. - */ - public void find(int identifier, String searchText, boolean forward, boolean matchCase, - boolean findNext); - - /** - * Cancel all searches that are currently going on. - * @param clearSelection Set to true to reset selection. - */ - public void stopFinding(boolean clearSelection); - - /** - * Get an instance of the dev tools to be displayed in its own window or to be - * embedded within your UI. Only one instance per browser is available. - */ - public CefBrowser getDevTools(); - - /** - * Get an instance of the dev tools to be displayed in its own window or to be - * embedded within your UI. Only one instance per browser is available. - * - * @param inspectAt a position in the UI which should be inspected. - */ - public CefBrowser getDevTools(Point inspectAt); - - /** - * If a misspelled word is currently selected in an editable node calling - * this method will replace it with the specified |word|. - * - * @param word replace selected word with this word. - */ - public void replaceMisspelling(String word); -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefBrowserFactory.java b/wizard-browser/src/main/java/org/cef/browser/CefBrowserFactory.java deleted file mode 100644 index eec822b..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefBrowserFactory.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import org.cef.handler.CefClientHandler; - -/** - * Creates a new instance of CefBrowser according the passed values - */ -public class CefBrowserFactory { - public static CefBrowser create(CefClientHandler clientHandler, String url, - boolean isOffscreenRendered, boolean isTransparent, CefRequestContext context) { - if (isOffscreenRendered) - return new CefBrowserOsr(clientHandler, url, isTransparent, context); - return new CefBrowserWr(clientHandler, url, context); - } -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefBrowserOsr.java b/wizard-browser/src/main/java/org/cef/browser/CefBrowserOsr.java deleted file mode 100644 index e257572..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefBrowserOsr.java +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import java.awt.Component; -import java.awt.Cursor; -import java.awt.Graphics; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.awt.event.MouseWheelEvent; -import java.awt.event.MouseWheelListener; -import java.awt.Point; -import java.awt.Rectangle; -import java.nio.ByteBuffer; - -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.swing.MenuSelectionManager; -import javax.swing.SwingUtilities; - -import org.cef.callback.CefDragData; -import org.cef.handler.CefClientHandler; -import org.cef.handler.CefRenderHandler; - -/** - * This class represents an off-screen rendered browser. - * The visibility of this class is "package". To create a new - * CefBrowser instance, please use CefBrowserFactory. - */ -class CefBrowserOsr extends CefBrowser_N implements CefRenderHandler { - private CefRenderer renderer_; - private GLCanvas canvas_; - private long window_handle_ = 0; - private Rectangle browser_rect_ = new Rectangle(0, 0, 1, 1); // Work around CEF issue #1437. - private Point screenPoint_ = new Point(0, 0); - private CefClientHandler clientHandler_; - private String url_; - private boolean isTransparent_; - private CefRequestContext context_; - private CefBrowserOsr parent_ = null; - private Point inspectAt_ = null; - private CefBrowserOsr devTools_ = null; - ; - - CefBrowserOsr(CefClientHandler clientHandler, String url, boolean transparent, - CefRequestContext context) { - this(clientHandler, url, transparent, context, null, null); - } - - private CefBrowserOsr(CefClientHandler clientHandler, String url, boolean transparent, - CefRequestContext context, CefBrowserOsr parent, Point inspectAt) { - super(); - isTransparent_ = transparent; - renderer_ = new CefRenderer(transparent); - clientHandler_ = clientHandler; - url_ = url; - context_ = context; - parent_ = parent; - inspectAt_ = inspectAt; - createGLCanvas(); - } - - @Override - public Component getUIComponent() { - return canvas_; - } - - @Override - public CefRenderHandler getRenderHandler() { - return this; - } - - @Override - public synchronized void close() { - if (context_ != null) context_.dispose(); - if (parent_ != null) { - parent_.closeDevTools(); - parent_.devTools_ = null; - parent_ = null; - } - super.close(); - } - - @Override - public synchronized CefBrowser getDevTools() { - return getDevTools(null); - } - - @Override - public synchronized CefBrowser getDevTools(Point inspectAt) { - if (devTools_ == null) { - devTools_ = new CefBrowserOsr( - clientHandler_, url_, isTransparent_, context_, this, inspectAt); - } - return devTools_; - } - - private long getWindowHandle() { - if (window_handle_ == 0) { - NativeSurface surface = canvas_.getNativeSurface(); - if (surface != null) { - surface.lockSurface(); - window_handle_ = getWindowHandle(surface.getSurfaceHandle()); - surface.unlockSurface(); - assert(window_handle_ != 0); - } - } - return window_handle_; - } - - @SuppressWarnings("serial") - private void createGLCanvas() { - GLProfile glprofile = GLProfile.getMaxFixedFunc(true); - GLCapabilities glcapabilities = new GLCapabilities(glprofile); - canvas_ = new GLCanvas(glcapabilities) { - @Override - public void paint(Graphics g) { - if (parent_ != null) { - createDevTools(parent_, clientHandler_, getWindowHandle(), isTransparent_, null, - inspectAt_); - } else { - createBrowser(clientHandler_, getWindowHandle(), url_, isTransparent_, null, - context_); - } - super.paint(g); - } - }; - - canvas_.addGLEventListener(new GLEventListener() { - @Override - public void reshape( - GLAutoDrawable glautodrawable, int x, int y, int width, int height) { - browser_rect_.setBounds(x, y, width, height); - screenPoint_ = canvas_.getLocationOnScreen(); - wasResized(width, height); - } - - @Override - public void init(GLAutoDrawable glautodrawable) { - renderer_.initialize(glautodrawable.getGL().getGL2()); - } - - @Override - public void dispose(GLAutoDrawable glautodrawable) { - renderer_.cleanup(glautodrawable.getGL().getGL2()); - } - - @Override - public void display(GLAutoDrawable glautodrawable) { - renderer_.render(glautodrawable.getGL().getGL2()); - } - }); - - canvas_.addMouseListener(new MouseListener() { - @Override - public void mousePressed(MouseEvent e) { - sendMouseEvent(e); - } - - @Override - public void mouseReleased(MouseEvent e) { - sendMouseEvent(e); - } - - @Override - public void mouseEntered(MouseEvent e) { - sendMouseEvent(e); - } - - @Override - public void mouseExited(MouseEvent e) { - sendMouseEvent(e); - } - - @Override - public void mouseClicked(MouseEvent e) { - sendMouseEvent(e); - } - }); - - canvas_.addMouseMotionListener(new MouseMotionListener() { - @Override - public void mouseMoved(MouseEvent e) { - sendMouseEvent(e); - } - - @Override - public void mouseDragged(MouseEvent e) { - sendMouseEvent(e); - } - }); - - canvas_.addMouseWheelListener(new MouseWheelListener() { - @Override - public void mouseWheelMoved(MouseWheelEvent e) { - sendMouseWheelEvent(e); - } - }); - - canvas_.addKeyListener(new KeyListener() { - @Override - public void keyTyped(KeyEvent e) { - sendKeyEvent(e); - } - - @Override - public void keyPressed(KeyEvent e) { - sendKeyEvent(e); - } - - @Override - public void keyReleased(KeyEvent e) { - sendKeyEvent(e); - } - }); - - canvas_.setFocusable(true); - canvas_.addFocusListener(new FocusListener() { - @Override - public void focusLost(FocusEvent e) { - setFocus(false); - } - - @Override - public void focusGained(FocusEvent e) { - // Dismiss any Java menus that are currently displayed. - MenuSelectionManager.defaultManager().clearSelectedPath(); - setFocus(true); - } - }); - } - - @Override - public Rectangle getViewRect(CefBrowser browser) { - return browser_rect_; - } - - @Override - public Point getScreenPoint(CefBrowser browser, Point viewPoint) { - Point screenPoint = new Point(screenPoint_); - screenPoint.translate(viewPoint.x, viewPoint.y); - return screenPoint; - } - - @Override - public void onPopupShow(CefBrowser browser, boolean show) { - if (!show) { - renderer_.clearPopupRects(); - invalidate(); - } - } - - @Override - public void onPopupSize(CefBrowser browser, Rectangle size) { - renderer_.onPopupSize(size); - } - - @Override - public void onPaint(CefBrowser browser, boolean popup, Rectangle[] dirtyRects, - ByteBuffer buffer, int width, int height) { - if (canvas_ == null || canvas_.getContext() == null) return; - - canvas_.getContext().makeCurrent(); - renderer_.onPaint(canvas_.getGL().getGL2(), popup, dirtyRects, buffer, width, height); - canvas_.getContext().release(); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - canvas_.display(); - } - }); - } - - @Override - public void onCursorChange(CefBrowser browser, final int cursorType) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - canvas_.setCursor(new Cursor(cursorType)); - } - }); - } - - @Override - public boolean startDragging(CefBrowser browser, CefDragData dragData, int mask, int x, int y) { - // TODO(JCEF) Prepared for DnD support using OSR mode. - return false; - } - - @Override - public void updateDragCursor(CefBrowser browser, int operation) { - // TODO(JCEF) Prepared for DnD support using OSR mode. - } -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefBrowserWindow.java b/wizard-browser/src/main/java/org/cef/browser/CefBrowserWindow.java deleted file mode 100644 index 3d7f595..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefBrowserWindow.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import java.awt.Component; - -/** - * Interface representing system dependent methods for the browser. - */ -public interface CefBrowserWindow { - /** - * Get the window handle for the given UI object. - * - * @param comp a UI component - * @return a window pointer if any - */ - public long getWindowHandle(Component comp); -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefBrowserWr.java b/wizard-browser/src/main/java/org/cef/browser/CefBrowserWr.java deleted file mode 100644 index ad0a38c..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefBrowserWr.java +++ /dev/null @@ -1,359 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import java.awt.BorderLayout; -import java.awt.Canvas; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.MouseInfo; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.HierarchyBoundsListener; -import java.awt.event.HierarchyEvent; -import java.awt.event.HierarchyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseWheelEvent; -import java.util.Date; - -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.MenuSelectionManager; -import javax.swing.SwingUtilities; -import javax.swing.Timer; -import javax.swing.ToolTipManager; - -import org.cef.OS; -import org.cef.handler.CefClientHandler; -import org.cef.handler.CefWindowHandler; -import org.cef.handler.CefWindowHandlerAdapter; - -/** - * This class represents a windowed rendered browser. - * The visibility of this class is "package". To create a new - * CefBrowser instance, please use CefBrowserFactory. - */ -class CefBrowserWr extends CefBrowser_N { - private Canvas canvas_ = null; - private Component component_ = null; - private Rectangle content_rect_ = new Rectangle(0, 0, 0, 0); - private long window_handle_ = 0; - private CefClientHandler clientHandler_; - private String url_; - private CefRequestContext context_; - private CefBrowserWr parent_ = null; - private Point inspectAt_ = null; - private CefBrowserWr devTools_ = null; - private boolean isDisposed = false; - private Timer delayedUpdate_ = new Timer(100, new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - createUIIfRequired(); - if (OS.isMacintosh()) doUpdate(); - } - }); - } - }); - private CefWindowHandlerAdapter win_handler_ = new CefWindowHandlerAdapter() { - private Point lastPos = new Point(-1, -1); - private long[] nextClick = new long[MouseInfo.getNumberOfButtons()]; - private int[] clickCnt = new int[MouseInfo.getNumberOfButtons()]; - - @Override - public Rectangle getRect(CefBrowser browser) { - synchronized (content_rect_) { - return content_rect_; - } - } - - @Override - public void onMouseEvent(CefBrowser browser, int event, final int screenX, - final int screenY, final int modifier, final int button) { - final Point pt = new Point(screenX, screenY); - if (event == MouseEvent.MOUSE_MOVED) { - // Remove mouse-moved events if the position of the cursor hasn't - // changed. - if (pt.equals(lastPos)) return; - lastPos = pt; - - // Change mouse-moved event to mouse-dragged event if the left mouse - // button is pressed. - if ((modifier & MouseEvent.BUTTON1_DOWN_MASK) != 0) - event = MouseEvent.MOUSE_DRAGGED; - } - - final int finalEvent = event; - - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - // Send mouse event to the root UI component instead to the browser UI. - // Otherwise no mouse-entered and no mouse-exited events would be fired. - Component parent = SwingUtilities.getRoot(component_); - if (parent == null) { - return; - } - SwingUtilities.convertPointFromScreen(pt, parent); - - int clickCnt = 0; - long now = new Date().getTime(); - if (finalEvent == MouseEvent.MOUSE_WHEEL) { - int scrollType = MouseWheelEvent.WHEEL_UNIT_SCROLL; - int rotation = button > 0 ? 1 : -1; - component_.dispatchEvent(new MouseWheelEvent(parent, finalEvent, now, - modifier, pt.x, pt.y, 0, false, scrollType, 3, rotation)); - } else { - clickCnt = getClickCount(finalEvent, button); - component_.dispatchEvent(new MouseEvent(parent, finalEvent, now, modifier, - pt.x, pt.y, screenX, screenY, clickCnt, false, button)); - } - - // Always fire a mouse-clicked event after a mouse-released event. - if (finalEvent == MouseEvent.MOUSE_RELEASED) { - component_.dispatchEvent( - new MouseEvent(parent, MouseEvent.MOUSE_CLICKED, now, modifier, - pt.x, pt.y, screenX, screenY, clickCnt, false, button)); - } - } - }); - } - - public int getClickCount(int event, int button) { - // avoid exceptions by using modulo - int idx = button % nextClick.length; - - switch (event) { - case MouseEvent.MOUSE_PRESSED: - long currTime = new Date().getTime(); - if (currTime > nextClick[idx]) { - nextClick[idx] = currTime - + (Integer) Toolkit.getDefaultToolkit().getDesktopProperty( - "awt.multiClickInterval"); - clickCnt[idx] = 1; - } else { - clickCnt[idx]++; - } - // FALL THRU - case MouseEvent.MOUSE_RELEASED: - return clickCnt[idx]; - default: - return 0; - } - } - }; - - CefBrowserWr(CefClientHandler clientHandler, String url, CefRequestContext context) { - this(clientHandler, url, context, null, null); - } - - @SuppressWarnings("serial") - private CefBrowserWr(CefClientHandler clientHandler, String url, CefRequestContext context, - CefBrowserWr parent, Point inspectAt) { - super(); - clientHandler_ = clientHandler; - url_ = url; - context_ = context; - parent_ = parent; - inspectAt_ = inspectAt; - delayedUpdate_.setRepeats(false); - - // Disabling lightweight of popup menu is required because - // otherwise it will be displayed behind the content of component_ - JPopupMenu.setDefaultLightWeightPopupEnabled(false); - ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); - - // We're using a JComponent instead of a Canvas now because the - // JComponent has clipping informations, which aren't accessible for Canvas. - component_ = new JPanel(new BorderLayout()) { - @Override - public void setBounds(int x, int y, int width, int height) { - super.setBounds(x, y, width, height); - wasResized(width, height); - } - - @Override - public void setBounds(Rectangle r) { - setBounds(r.x, r.y, r.width, r.height); - } - - @Override - public void setSize(int width, int height) { - super.setSize(width, height); - wasResized(width, height); - } - - @Override - public void setSize(Dimension d) { - setSize(d.width, d.height); - } - - @Override - public void paint(Graphics g) { - // If the user resizes the UI component, the new size and clipping - // informations are forwarded to the native code. - // But on Mac the last resize information doesn't resize the native UI - // accurately (sometimes the native UI is too small). An easy way to - // solve this, is to send the last Update-Information again. Therefore - // we're setting up a delayedUpdate timer which is reset each time - // paint is called. This prevents the us of sending the UI update too - // often. - doUpdate(); - delayedUpdate_.restart(); - } - }; - // On windows we have to use a Canvas because its a heavyweight component - // and we need its native HWND as parent for the browser UI. - if (OS.isWindows()) { - canvas_ = new Canvas(); - ((JPanel) component_).add(canvas_, BorderLayout.CENTER); - } - - // Initial minimal size of the component. Otherwise the UI won't work - // accordingly in panes like JSplitPane. - component_.setMinimumSize(new Dimension(0, 0)); - component_.setFocusable(true); - component_.addFocusListener(new FocusListener() { - @Override - public void focusLost(FocusEvent e) { - setFocus(false); - } - - @Override - public void focusGained(FocusEvent e) { - // Dismiss any Java menus that are currently displayed. - MenuSelectionManager.defaultManager().clearSelectedPath(); - setFocus(true); - } - }); - component_.addHierarchyBoundsListener(new HierarchyBoundsListener() { - @Override - public void ancestorResized(HierarchyEvent e) { - doUpdate(); - } - @Override - public void ancestorMoved(HierarchyEvent e) { - doUpdate(); - } - }); - component_.addHierarchyListener(new HierarchyListener() { - @Override - public void hierarchyChanged(HierarchyEvent e) { - if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) { - setWindowVisibility(e.getChanged().isVisible()); - } - } - }); - } - - @Override - public Component getUIComponent() { - return component_; - } - - @Override - public CefWindowHandler getWindowHandler() { - return win_handler_; - } - - @Override - public synchronized void close() { - isDisposed = true; - if (context_ != null) context_.dispose(); - if (parent_ != null) { - parent_.closeDevTools(); - parent_.devTools_ = null; - parent_ = null; - } - super.close(); - } - - @Override - public synchronized CefBrowser getDevTools() { - return getDevTools(null); - } - - @Override - public synchronized CefBrowser getDevTools(Point inspectAt) { - if (devTools_ == null) - devTools_ = new CefBrowserWr(clientHandler_, url_, context_, this, inspectAt); - return devTools_; - } - - private long getWindowHandle() { - if (window_handle_ == 0 && OS.isMacintosh()) { - try { - Class cls = Class.forName("org.cef.browser.mac.CefBrowserWindowMac"); - CefBrowserWindow browserWindow = (CefBrowserWindow) cls.newInstance(); - if (browserWindow != null) { - window_handle_ = browserWindow.getWindowHandle(component_); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - } - return window_handle_; - } - - private void doUpdate() { - if (isDisposed) return; - - Rectangle clipping = ((JPanel) component_).getVisibleRect(); - - if (OS.isMacintosh()) { - Container parent = component_.getParent(); - Point contentPos = component_.getLocation(); - while (parent != null) { - Container next = parent.getParent(); - if (next != null && next instanceof Window) break; - Point parentPos = parent.getLocation(); - contentPos.translate(parentPos.x, parentPos.y); - parent = next; - } - contentPos.translate(clipping.x, clipping.y); - - Point browserPos = clipping.getLocation(); - browserPos.x *= -1; - browserPos.y *= -1; - - synchronized (content_rect_) { - content_rect_ = new Rectangle(contentPos, clipping.getSize()); - Rectangle browserRect = new Rectangle(browserPos, component_.getSize()); - updateUI(content_rect_, browserRect); - } - } else { - synchronized (content_rect_) { - content_rect_ = component_.getBounds(); - updateUI(clipping, content_rect_); - } - } - } - - private void createUIIfRequired() { - if (getNativeRef("CefBrowser") == 0 && !isDisposed) { - if (parent_ != null) { - createDevTools(parent_, clientHandler_, getWindowHandle(), false, - OS.isWindows() ? canvas_ : component_, inspectAt_); - } else { - createBrowser(clientHandler_, getWindowHandle(), url_, false, - OS.isWindows() ? canvas_ : component_, context_); - } - } - } -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefBrowser_N.java b/wizard-browser/src/main/java/org/cef/browser/CefBrowser_N.java deleted file mode 100644 index af10e61..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefBrowser_N.java +++ /dev/null @@ -1,685 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseWheelEvent; -import java.awt.Component; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Vector; - -import org.cef.callback.CefDragData; -import org.cef.callback.CefNativeAdapter; -import org.cef.callback.CefPdfPrintCallback; -import org.cef.callback.CefRunFileDialogCallback; -import org.cef.callback.CefStringVisitor; -import org.cef.handler.CefClientHandler; -import org.cef.handler.CefRenderHandler; -import org.cef.handler.CefDialogHandler.FileDialogMode; -import org.cef.handler.CefWindowHandler; -import org.cef.misc.CefPdfPrintSettings; -import org.cef.network.CefRequest; - -/** - * This class represents all methods which are connected to the - * native counterpart CEF. - * The visibility of this class is "package". To create a new - * CefBrowser instance, please use CefBrowserFactory. - */ -abstract class CefBrowser_N extends CefNativeAdapter implements CefBrowser { - private boolean isPending_ = false; - - @Override - public CefRenderHandler getRenderHandler() { - return null; - } - - @Override - public CefWindowHandler getWindowHandler() { - return null; - } - - /** - * Create a new browser. - */ - protected void createBrowser(CefClientHandler clientHandler, long windowHandle, String url, - boolean transparent, Component canvas, CefRequestContext context) { - if (getNativeRef("CefBrowser") == 0 && !isPending_) { - try { - isPending_ = N_CreateBrowser( - clientHandler, windowHandle, url, transparent, canvas, context); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - } - - /** - * Create a new browser as dev tools - */ - protected final void createDevTools(CefBrowser parent, CefClientHandler clientHandler, - long windowHandle, boolean transparent, Component canvas, Point inspectAt) { - if (getNativeRef("CefBrowser") == 0 && !isPending_) { - try { - isPending_ = N_CreateDevTools( - parent, clientHandler, windowHandle, transparent, canvas, inspectAt); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - } - - /** - * Returns the native window handle for the specified native surface handle. - */ - protected final long getWindowHandle(long surfaceHandle) { - try { - return N_GetWindowHandle(surfaceHandle); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return 0; - } - - @Override - protected void finalize() throws Throwable { - close(); - super.finalize(); - } - - @Override - public boolean canGoBack() { - try { - return N_CanGoBack(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public void goBack() { - try { - N_GoBack(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean canGoForward() { - try { - return N_CanGoForward(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public void goForward() { - try { - N_GoForward(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean isLoading() { - try { - return N_IsLoading(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public void reload() { - try { - N_Reload(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void reloadIgnoreCache() { - try { - N_ReloadIgnoreCache(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void stopLoad() { - try { - N_StopLoad(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public int getIdentifier() { - try { - return N_GetIdentifier(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return -1; - } - } - - @Override - public CefFrame getMainFrame() { - try { - return N_GetMainFrame(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public CefFrame getFocusedFrame() { - try { - return N_GetFocusedFrame(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public CefFrame getFrame(long identifier) { - try { - return N_GetFrame(identifier); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public CefFrame getFrame(String name) { - try { - return N_GetFrame2(name); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public Vector getFrameIdentifiers() { - try { - return N_GetFrameIdentifiers(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public Vector getFrameNames() { - try { - return N_GetFrameNames(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public int getFrameCount() { - try { - return N_GetFrameCount(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return -1; - } - } - - @Override - public boolean isPopup() { - try { - return N_IsPopup(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean hasDocument() { - try { - return N_HasDocument(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - public void viewSource() { - try { - N_ViewSource(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void getSource(CefStringVisitor visitor) { - try { - N_GetSource(visitor); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void getText(CefStringVisitor visitor) { - try { - N_GetText(visitor); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void loadRequest(CefRequest request) { - try { - N_LoadRequest(request); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void loadURL(String url) { - try { - N_LoadURL(url); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void loadString(String val, String url) { - try { - N_LoadString(val, url); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void executeJavaScript(String code, String url, int line) { - try { - N_ExecuteJavaScript(code, url, line); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public String getURL() { - try { - return N_GetURL(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return ""; - } - - @Override - public void close() { - try { - N_Close(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setFocus(boolean enable) { - try { - N_SetFocus(enable); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setWindowVisibility(boolean visible) { - try { - N_SetWindowVisibility(visible); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public double getZoomLevel() { - try { - return N_GetZoomLevel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0.0; - } - - @Override - public void setZoomLevel(double zoomLevel) { - try { - N_SetZoomLevel(zoomLevel); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void runFileDialog(FileDialogMode mode, String title, String defaultFilePath, - Vector acceptFilters, int selectedAcceptFilter, - CefRunFileDialogCallback callback) { - try { - N_RunFileDialog( - mode, title, defaultFilePath, acceptFilters, selectedAcceptFilter, callback); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void startDownload(String url) { - try { - N_StartDownload(url); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void print() { - try { - N_Print(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void printToPDF(String path, CefPdfPrintSettings settings, CefPdfPrintCallback callback) { - if (path == null || path.isEmpty()) { - throw new IllegalArgumentException("path was null or empty"); - } - try { - N_PrintToPDF(path, settings, callback); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void find(int identifier, String searchText, boolean forward, boolean matchCase, - boolean findNext) { - try { - N_Find(identifier, searchText, forward, matchCase, findNext); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void stopFinding(boolean clearSelection) { - try { - N_StopFinding(clearSelection); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - protected final void closeDevTools() { - try { - N_CloseDevTools(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void replaceMisspelling(String word) { - try { - N_ReplaceMisspelling(word); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Notify that the browser was resized. - * @param width The new width of the browser - * @param height The new height of the browser - */ - protected final void wasResized(int width, int height) { - try { - N_WasResized(width, height); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Invalidate the UI. - */ - protected final void invalidate() { - try { - N_Invalidate(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Send a key event. - * @param e The event to send. - */ - protected final void sendKeyEvent(KeyEvent e) { - try { - N_SendKeyEvent(e); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Send a mouse event. - * @param e The event to send. - */ - protected final void sendMouseEvent(MouseEvent e) { - try { - N_SendMouseEvent(e); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Send a mouse wheel event. - * @param e The event to send. - */ - protected final void sendMouseWheelEvent(MouseWheelEvent e) { - try { - N_SendMouseWheelEvent(e); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Call this method when the user drags the mouse into the web view (before - * calling DragTargetDragOver/DragTargetLeave/DragTargetDrop). - * |drag_data| should not contain file contents as this type of data is not - * allowed to be dragged into the web view. File contents can be removed using - * CefDragData::ResetFileContents (for example, if |drag_data| comes from - * CefRenderHandler::StartDragging). - * This method is only used when window rendering is disabled. - */ - protected final void dragTargetDragEnter( - CefDragData dragData, Point pos, int modifiers, int allowedOps) { - try { - N_DragTargetDragEnter(dragData, pos, modifiers, allowedOps); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Call this method each time the mouse is moved across the web view during - * a drag operation (after calling DragTargetDragEnter and before calling - * DragTargetDragLeave/DragTargetDrop). - * This method is only used when window rendering is disabled. - */ - protected final void dragTargetDragOver(Point pos, int modifiers, int allowedOps) { - try { - N_DragTargetDragOver(pos, modifiers, allowedOps); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Call this method when the user drags the mouse out of the web view (after - * calling DragTargetDragEnter). - * This method is only used when window rendering is disabled. - */ - protected final void dragTargetDragLeave() { - try { - N_DragTargetDragLeave(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Call this method when the user completes the drag operation by dropping - * the object onto the web view (after calling DragTargetDragEnter). - * The object being dropped is |drag_data|, given as an argument to - * the previous DragTargetDragEnter call. - * This method is only used when window rendering is disabled. - */ - protected final void dragTargetDrop(Point pos, int modifiers) { - try { - N_DragTargetDrop(pos, modifiers); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Call this method when the drag operation started by a - * CefRenderHandler.startDragging call has ended either in a drop or - * by being cancelled. |x| and |y| are mouse coordinates relative to the - * upper-left corner of the view. If the web view is both the drag source - * and the drag target then all DragTarget* methods should be called before - * DragSource* methods. - * This method is only used when window rendering is disabled. - */ - protected final void dragSourceEndedAt(Point pos, int operation) { - try { - N_DragSourceEndedAt(pos, operation); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - /** - * Call this method when the drag operation started by a - * CefRenderHandler.startDragging call has completed. This method may be - * called immediately without first calling DragSourceEndedAt to cancel a - * drag operation. If the web view is both the drag source and the drag - * target then all DragTarget* methods should be called before DragSource* - * methods. - * This method is only used when window rendering is disabled. - */ - protected final void dragSourceSystemDragEnded() { - try { - N_DragSourceSystemDragEnded(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - protected final void updateUI(Rectangle contentRect, Rectangle browserRect) { - try { - N_UpdateUI(contentRect, browserRect); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native boolean N_CreateBrowser(CefClientHandler clientHandler, long windowHandle, - String url, boolean transparent, Component canvas, CefRequestContext context); - private final native boolean N_CreateDevTools(CefBrowser parent, CefClientHandler clientHandler, - long windowHandle, boolean transparent, Component canvas, Point inspectAt); - private final native long N_GetWindowHandle(long surfaceHandle); - private final native boolean N_CanGoBack(); - private final native void N_GoBack(); - private final native boolean N_CanGoForward(); - private final native void N_GoForward(); - private final native boolean N_IsLoading(); - private final native void N_Reload(); - private final native void N_ReloadIgnoreCache(); - private final native void N_StopLoad(); - private final native int N_GetIdentifier(); - private final native CefFrame N_GetMainFrame(); - private final native CefFrame N_GetFocusedFrame(); - private final native CefFrame N_GetFrame(long identifier); - private final native CefFrame N_GetFrame2(String name); - private final native Vector N_GetFrameIdentifiers(); - private final native Vector N_GetFrameNames(); - private final native int N_GetFrameCount(); - private final native boolean N_IsPopup(); - private final native boolean N_HasDocument(); - private final native void N_ViewSource(); - private final native void N_GetSource(CefStringVisitor visitor); - private final native void N_GetText(CefStringVisitor visitor); - private final native void N_LoadRequest(CefRequest request); - private final native void N_LoadURL(String url); - private final native void N_LoadString(String val, String url); - private final native void N_ExecuteJavaScript(String code, String url, int line); - private final native String N_GetURL(); - private final native void N_Close(); - private final native void N_SetFocus(boolean enable); - private final native void N_SetWindowVisibility(boolean visible); - private final native double N_GetZoomLevel(); - private final native void N_SetZoomLevel(double zoomLevel); - private final native void N_RunFileDialog(FileDialogMode mode, String title, - String defaultFilePath, Vector acceptFilters, int selectedAcceptFilter, - CefRunFileDialogCallback callback); - private final native void N_StartDownload(String url); - private final native void N_Print(); - private final native void N_PrintToPDF(String path, CefPdfPrintSettings settings, CefPdfPrintCallback callback); - private final native void N_Find(int identifier, String searchText, boolean forward, - boolean matchCase, boolean findNext); - private final native void N_StopFinding(boolean clearSelection); - private final native void N_CloseDevTools(); - private final native void N_ReplaceMisspelling(String word); - private final native void N_WasResized(int width, int height); - private final native void N_Invalidate(); - private final native void N_SendKeyEvent(KeyEvent e); - private final native void N_SendMouseEvent(MouseEvent e); - private final native void N_SendMouseWheelEvent(MouseWheelEvent e); - private final native void N_DragTargetDragEnter( - CefDragData dragData, Point pos, int modifiers, int allowed_ops); - private final native void N_DragTargetDragOver(Point pos, int modifiers, int allowed_ops); - private final native void N_DragTargetDragLeave(); - private final native void N_DragTargetDrop(Point pos, int modifiers); - private final native void N_DragSourceEndedAt(Point pos, int operation); - private final native void N_DragSourceSystemDragEnded(); - private final native void N_UpdateUI(Rectangle contentRect, Rectangle browserRect); -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefFrame.java b/wizard-browser/src/main/java/org/cef/browser/CefFrame.java deleted file mode 100644 index c308f66..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefFrame.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -/** - * Interface representing a frame. - */ -public interface CefFrame { - /** - * Returns the globally unique identifier for this frame or < 0 if the - * underlying frame does not yet exist. - * @return The frame identifier - */ - long getIdentifier(); - - /** - * Emits the URL currently loaded in this frame. - * @return the URL currently loaded in this frame. - */ - String getURL(); - - /** - * Returns the name for this frame. If the frame has an assigned name (for - * example, set via the iframe "name" attribute) then that value will be - * returned. Otherwise a unique name will be constructed based on the frame - * parent hierarchy. The main (top-level) frame will always have an empty name - * value. - * @return The frame name - */ - String getName(); - - /** - * Returns true if this is the main (top-level) frame. - * @return True if this frame is top-level otherwise false. - */ - boolean isMain(); - - /** - * True if this object is currently attached to a valid frame. - * @return True if valid otherwise false. - */ - boolean isValid(); - - /** - * Returns true if this is the focused frame. - * @return True if valid otherwise false. - */ - boolean isFocused(); - - /** - * Returns the parent of this frame or NULL if this is the main (top-level) - * frame. - * @return The parent frame or NULL if this is the main frame - */ - CefFrame getParent(); - - /** - * Execute a string of JavaScript code in this frame. The url - * parameter is the URL where the script in question can be found, if any. - * The renderer may request this URL to show the developer the source of the - * error. The line parameter is the base line number to use for error - * reporting. - * - * @param code The code to be executed. - * @param url The URL where the script in question can be found. - * @param line The base line number to use for error reporting. - */ - public void executeJavaScript(String code, String url, int line); -} \ No newline at end of file diff --git a/wizard-browser/src/main/java/org/cef/browser/CefFrame_N.java b/wizard-browser/src/main/java/org/cef/browser/CefFrame_N.java deleted file mode 100644 index 30f0f07..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefFrame_N.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import org.cef.callback.CefNativeAdapter; - -/** - * This class represents all methods which are connected to the - * native counterpart CEF. - * The visibility of this class is "package". - */ -class CefFrame_N extends CefNativeAdapter implements CefFrame { - @Override - protected void finalize() throws Throwable { - try { - N_CefFrame_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } finally { - super.finalize(); - } - } - - @Override - public long getIdentifier() { - try { - return N_GetIdentifier(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return -1; - } - } - - @Override - public String getURL() { - try { - return N_GetURL(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public String getName() { - try { - return N_GetName(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public boolean isMain() { - try { - return N_IsMain(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return false; - } - } - - @Override - public boolean isValid() { - try { - return N_IsValid(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return false; - } - } - - @Override - public boolean isFocused() { - try { - return N_IsFocused(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return false; - } - } - - @Override - public CefFrame getParent() { - try { - return N_GetParent(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public void executeJavaScript(String code, String url, int line) { - try { - N_ExecuteJavaScript(code, url, line); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_CefFrame_DTOR(); - private final native int N_GetIdentifier(); - private final native String N_GetURL(); - private final native String N_GetName(); - private final native boolean N_IsMain(); - private final native boolean N_IsValid(); - private final native boolean N_IsFocused(); - private final native CefFrame N_GetParent(); - private final native void N_ExecuteJavaScript(String code, String url, int line); -} \ No newline at end of file diff --git a/wizard-browser/src/main/java/org/cef/browser/CefMessageRouter.java b/wizard-browser/src/main/java/org/cef/browser/CefMessageRouter.java deleted file mode 100644 index 66c08df..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefMessageRouter.java +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import org.cef.handler.CefMessageRouterHandler; - -/** - * The below classes implement support for routing aynchronous messages between - * JavaScript running in the renderer process and C++ running in the browser - * process. An application interacts with the router by passing it data from - * standard CEF C++ callbacks (OnBeforeBrowse, OnProcessMessageRecieved, - * OnContextCreated, etc). The renderer-side router supports generic JavaScript - * callback registration and execution while the browser-side router supports - * application-specific logic via one or more application-provided Handler - * instances. - * - * The renderer-side router implementation exposes a query function and a cancel - * function via the JavaScript 'window' object: - * - * // Create and send a new query. - * var request_id = window.cefQuery({ - * request: 'my_request', - * persistent: false, - * onSuccess: function(response) {}, - * onFailure: function(error_code, error_message) {} - * }); - * - * // Optionally cancel the query. - * window.cefQueryCancel(request_id); - * - * When |window.cefQuery| is executed the request is sent asynchronously to one - * or more C++ Handler objects registered in the browser process. Each C++ - * Handler can choose to either handle or ignore the query in the - * Handler::OnQuery callback. If a Handler chooses to handle the query then it - * should execute Callback::Success when a response is available or - * Callback::Failure if an error occurs. This will result in asynchronous - * execution of the associated JavaScript callback in the renderer process. Any - * queries unhandled by C++ code in the browser process will be automatically - * canceled and the associated JavaScript onFailure callback will be executed - * with an error code of -1. - * - * Queries can be either persistent or non-persistent. If the query is - * persistent than the callbacks will remain registered until one of the - * following conditions are met: - * - * A. The query is canceled in JavaScript using the |window.cefQueryCancel| - * function. - * B. The query is canceled in C++ code using the Callback::Failure function. - * C. The context associated with the query is released due to browser - * destruction, navigation or renderer process termination. - * - * If the query is non-persistent then the registration will be removed after - * the JavaScript callback is executed a single time. If a query is canceled for - * a reason other than Callback::Failure being executed then the associated - * Handler's OnQueryCanceled method will be called. - * - * Some possible usage patterns include: - * - * One-time Request. Use a non-persistent query to send a JavaScript request. - * The Handler evaluates the request and returns the response. The query is - * then discarded. - * - * Broadcast. Use a persistent query to register as a JavaScript broadcast - * receiver. The Handler keeps track of all registered Callbacks and executes - * them sequentially to deliver the broadcast message. - * - * Subscription. Use a persistent query to register as a JavaScript subscription - * receiver. The Handler initiates the subscription feed on the first request - * and delivers responses to all registered subscribers as they become - * available. The Handler cancels the subscription feed when there are no - * longer any registered JavaScript receivers. - * - * Message routing occurs on a per-browser and per-context basis. Consequently, - * additional application logic can be applied by restricting which browser or - * context instances are passed into the router. If you choose to use this - * approach do so cautiously. In order for the router to function correctly any - * browser or context instance passed into a single router callback must then - * be passed into all router callbacks. - * - * There is generally no need to have multiple renderer-side routers unless you - * wish to have multiple bindings with different JavaScript function names. It - * can be useful to have multiple browser-side routers with different client- - * provided Handler instances when implementing different behaviors on a per- - * browser basis. - * - * This implementation places no formatting restrictions on payload content. - * An application may choose to exchange anything from simple formatted - * strings to serialized XML or JSON data. - * - * - * EXAMPLE USAGE - * - * 1. Define the router configuration. You can optionally specify settings - * like the JavaScript function names. The configuration must be the same in - * both the browser and renderer processes. If using multiple routers in the - * same application make sure to specify unique function names for each - * router configuration. - * - * // Example config object showing the default values. - * CefMessageRouterConfig config = new CefMessageRouterConfig(); - * config.jsQueryFunction = "cefQuery"; - * config.jsCancelFunction = "cefQueryCancel"; - * - * 2. Create an instance of CefMessageRouter in the browser process. - * - * messageRouter_ = CefMessageRouter.create(config); - * - * 3. Register one or more Handlers. The Handler instances must either outlive - * the router or be removed from the router before they're deleted. - * - * messageRouter_.addHandler(myHandler); - * - * 4. Add your message router to all CefClient instances you want to get your - * JavaScript code be handled. - * - * myClient.addMessageRouter(messageRouter_); - * - * 4. Execute the query function from JavaScript code. - * - * window.cefQuery({request: 'my_request', - * persistent: false, - * onSuccess: function(response) { print(response); }, - * onFailure: function(error_code, error_message) {} }); - * - * 5. Handle the query in your CefMessageRouterHandler.onQuery implementation - * and execute the appropriate callback either immediately or asynchronously. - * - * public boolean onQuery(CefBrowser browser, - * long query_id, - * String request, - * boolean persistent, - * CefQueryCallback callback) { - * if (request.indexOf("my_request") == 0) { - * callback.success("my_response"); - * return true; - * } - * return false; // Not handled. - * } - * - * 6. Notice that the success callback is executed in JavaScript. - */ -public abstract class CefMessageRouter { - private final CefMessageRouterConfig routerConfig_; - - /** - * Used to configure the query router. If using multiple router pairs make - * sure to choose values that do not conflict. - */ - public static class CefMessageRouterConfig { - /** - * Name of the JavaScript function that will be added to the 'window' object - * for sending a query. The default value is "cefQuery". - */ - public String jsQueryFunction; - - /** - * Name of the JavaScript function that will be added to the 'window' object - * for canceling a pending query. The default value is "cefQueryCancel". - */ - public String jsCancelFunction; - - public CefMessageRouterConfig() { - this("cefQuery", "cefQueryCancel"); - } - - public CefMessageRouterConfig(String queryFunction, String cancelFunction) { - jsQueryFunction = queryFunction; - jsCancelFunction = cancelFunction; - } - } - - // This CTOR can't be called directly. Call method create() instead. - CefMessageRouter(CefMessageRouterConfig routerConfig) { - routerConfig_ = routerConfig; - } - - /** - * Create a new router with the specified configuration. - * - * @param config router configuration - * @return - */ - public static final CefMessageRouter create() { - return CefMessageRouter.create(null, null); - } - - public static final CefMessageRouter create(CefMessageRouterConfig config) { - return CefMessageRouter.create(config, null); - } - - public static final CefMessageRouter create(CefMessageRouterHandler handler) { - return CefMessageRouter.create(null, handler); - } - - public static final CefMessageRouter create( - CefMessageRouterConfig config, CefMessageRouterHandler handler) { - CefMessageRouter router = CefMessageRouter_N.createNative(config); - if (router != null && handler != null) router.addHandler(handler, true); - return router; - } - - /** - * Must be called if the CefMessageRouter instance isn't used any more - */ - public abstract void dispose(); - - public final CefMessageRouterConfig getMessageRouterConfig() { - return routerConfig_; - } - - /** - * Add a new query handler. If |first| is true it will be added as the first - * handler, otherwise it will be added as the last handler. Returns true if - * the handler is added successfully or false if the handler has already been - * added. Must be called on the browser process UI thread. The Handler object - * must either outlive the router or be removed before deletion. - * - * @param handler the according handler to be added - * @param first if If set to true it will be added as the first handler - * @return true if the handler is added successfully - */ - public abstract boolean addHandler(CefMessageRouterHandler handler, boolean first); - - /** - * Remove an existing query handler. Any pending queries associated with the - * handler will be canceled. Handler.OnQueryCanceled will be called and the - * associated JavaScript onFailure callback will be executed with an error - * code of -1. Returns true if the handler is removed successfully or false - * if the handler is not found. Must be called on the browser process UI - * thread. - * - * @param handler the according handler to be removed - * @return true if the handler is removed successfully - */ - public abstract boolean removeHandler(CefMessageRouterHandler handler); - - /** - * Cancel all pending queries associated with either |browser| or |handler|. - * If both |browser| and |handler| are NULL all pending queries will be - * canceled. Handler::OnQueryCanceled will be called and the associated - * JavaScript onFailure callback will be executed in all cases with an error - * code of -1. - * - * @param browser may be empty - * @param handler may be empty - */ - public abstract void cancelPending(CefBrowser browser, CefMessageRouterHandler handler); - - /** - * Returns the number of queries currently pending for the specified |browser| - * and/or |handler|. Either or both values may be empty. Must be called on the - * browser process UI thread. - * - * @param browser may be empty - * @param handler may be empty - * @return the number of queries currently pending - */ - public abstract int getPendingCount(CefBrowser browser, CefMessageRouterHandler handler); -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefMessageRouter_N.java b/wizard-browser/src/main/java/org/cef/browser/CefMessageRouter_N.java deleted file mode 100644 index 16809fb..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefMessageRouter_N.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import org.cef.callback.CefNative; -import org.cef.handler.CefMessageRouterHandler; - -class CefMessageRouter_N extends CefMessageRouter implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - private CefMessageRouter_N(CefMessageRouterConfig config) { - super(config); - } - - public static final CefMessageRouter createNative(CefMessageRouterConfig config) { - // keep a reference to the request and client objects. - CefMessageRouter_N result = new CefMessageRouter_N(config); - try { - result.N_Create(config); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - if (result.N_CefHandle == 0) return null; - return result; - } - - @Override - public void dispose() { - try { - N_Dispose(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean addHandler(CefMessageRouterHandler handler, boolean first) { - try { - return N_AddHandler(handler, first); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return false; - } - } - - @Override - public boolean removeHandler(CefMessageRouterHandler handler) { - try { - return N_RemoveHandler(handler); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return false; - } - } - - @Override - public void cancelPending(CefBrowser browser, CefMessageRouterHandler handler) { - try { - N_CancelPending(browser, handler); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public int getPendingCount(CefBrowser browser, CefMessageRouterHandler handler) { - try { - return N_GetPendingCount(browser, handler); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return 0; - } - } - - private final native void N_Create(CefMessageRouterConfig config); - private final native void N_Dispose(); - private final native boolean N_AddHandler(CefMessageRouterHandler handler, boolean first); - private final native boolean N_RemoveHandler(CefMessageRouterHandler handler); - private final native void N_CancelPending(CefBrowser browser, CefMessageRouterHandler handler); - private final native int N_GetPendingCount(CefBrowser browser, CefMessageRouterHandler handler); -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefRenderer.java b/wizard-browser/src/main/java/org/cef/browser/CefRenderer.java deleted file mode 100644 index 7a62f13..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefRenderer.java +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import java.awt.Rectangle; -import java.nio.ByteBuffer; -import java.nio.FloatBuffer; -import javax.media.opengl.GL2; - -class CefRenderer { - private boolean transparent_; - private GL2 initialized_context_ = null; - private int[] texture_id_ = new int[1]; - private int view_width_ = 0; - private int view_height_ = 0; - private float spin_x_ = 0f; - private float spin_y_ = 0f; - private Rectangle popup_rect_ = new Rectangle(0, 0, 0, 0); - private Rectangle original_popup_rect_ = new Rectangle(0, 0, 0, 0); - private boolean use_draw_pixels_ = false; - - protected CefRenderer(boolean transparent) { - transparent_ = transparent; - } - - protected boolean isTransparent() { - return transparent_; - } - - @SuppressWarnings("static-access") - protected void initialize(GL2 gl2) { - if (initialized_context_ == gl2) return; - - initialized_context_ = gl2; - - if (!gl2.getContext().isHardwareRasterizer()) { - // Workaround for Windows Remote Desktop which requires pot textures. - System.out.println( - "opengl rendering may be slow as hardware rendering isn't available"); - use_draw_pixels_ = true; - return; - } - - gl2.glHint(gl2.GL_POLYGON_SMOOTH_HINT, gl2.GL_NICEST); - - gl2.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - - // Necessary for non-power-of-2 textures to render correctly. - gl2.glPixelStorei(gl2.GL_UNPACK_ALIGNMENT, 1); - - // Create the texture. - gl2.glGenTextures(1, texture_id_, 0); - assert(texture_id_[0] != 0); - - gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]); - gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MIN_FILTER, gl2.GL_NEAREST); - gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MAG_FILTER, gl2.GL_NEAREST); - gl2.glTexEnvf(gl2.GL_TEXTURE_ENV, gl2.GL_TEXTURE_ENV_MODE, gl2.GL_MODULATE); - } - - protected void cleanup(GL2 gl2) { - if (texture_id_[0] != 0) gl2.glDeleteTextures(1, texture_id_, 0); - } - - @SuppressWarnings("static-access") - protected void render(GL2 gl2) { - if (use_draw_pixels_ || view_width_ == 0 || view_height_ == 0) return; - - assert(initialized_context_ != null); - - final float[] vertex_data = {// tu, tv, x, y, z - 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, - 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f}; - FloatBuffer vertices = FloatBuffer.wrap(vertex_data); - - gl2.glClear(gl2.GL_COLOR_BUFFER_BIT | gl2.GL_DEPTH_BUFFER_BIT); - - gl2.glMatrixMode(gl2.GL_MODELVIEW); - gl2.glLoadIdentity(); - - // Match GL units to screen coordinates. - gl2.glViewport(0, 0, view_width_, view_height_); - gl2.glMatrixMode(gl2.GL_PROJECTION); - gl2.glLoadIdentity(); - - // Draw the background gradient. - gl2.glPushAttrib(gl2.GL_ALL_ATTRIB_BITS); - gl2.glBegin(gl2.GL_QUADS); - gl2.glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // red - gl2.glVertex2f(-1.0f, -1.0f); - gl2.glVertex2f(1.0f, -1.0f); - gl2.glColor4f(0.0f, 0.0f, 1.0f, 1.0f); // blue - gl2.glVertex2f(1.0f, 1.0f); - gl2.glVertex2f(-1.0f, 1.0f); - gl2.glEnd(); - gl2.glPopAttrib(); - - // Rotate the view based on the mouse spin. - if (spin_x_ != 0) gl2.glRotatef(-spin_x_, 1.0f, 0.0f, 0.0f); - if (spin_y_ != 0) gl2.glRotatef(-spin_y_, 0.0f, 1.0f, 0.0f); - - if (transparent_) { - // Alpha blending style. Texture values have premultiplied alpha. - gl2.glBlendFunc(gl2.GL_ONE, gl2.GL_ONE_MINUS_SRC_ALPHA); - - // Enable alpha blending. - gl2.glEnable(gl2.GL_BLEND); - } - - // Enable 2D textures. - gl2.glEnable(gl2.GL_TEXTURE_2D); - - // Draw the facets with the texture. - assert(texture_id_[0] != 0); - gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]); - gl2.glInterleavedArrays(gl2.GL_T2F_V3F, 0, vertices); - gl2.glDrawArrays(gl2.GL_QUADS, 0, 4); - - // Disable 2D textures. - gl2.glDisable(gl2.GL_TEXTURE_2D); - - if (transparent_) { - // Disable alpha blending. - gl2.glDisable(gl2.GL_BLEND); - } - } - - protected void onPopupSize(Rectangle rect) { - if (rect.width <= 0 || rect.height <= 0) return; - original_popup_rect_ = rect; - popup_rect_ = getPopupRectInWebView(original_popup_rect_); - } - - protected Rectangle getPopupRect() { - return (Rectangle) popup_rect_.clone(); - } - - protected Rectangle getPopupRectInWebView(Rectangle original_rect) { - Rectangle rc = original_rect; - // if x or y are negative, move them to 0. - if (rc.x < 0) rc.x = 0; - if (rc.y < 0) rc.y = 0; - // if popup goes outside the view, try to reposition origin - if (rc.x + rc.width > view_width_) rc.x = view_width_ - rc.width; - if (rc.y + rc.height > view_height_) rc.y = view_height_ - rc.height; - // if x or y became negative, move them to 0 again. - if (rc.x < 0) rc.x = 0; - if (rc.y < 0) rc.y = 0; - return rc; - } - - protected void clearPopupRects() { - popup_rect_.setBounds(0, 0, 0, 0); - original_popup_rect_.setBounds(0, 0, 0, 0); - } - - @SuppressWarnings("static-access") - protected void onPaint(GL2 gl2, boolean popup, Rectangle[] dirtyRects, ByteBuffer buffer, - int width, int height) { - initialize(gl2); - - if (use_draw_pixels_) { - gl2.glRasterPos2f(-1, 1); - gl2.glPixelZoom(1, -1); - gl2.glDrawPixels(width, height, GL2.GL_BGRA, GL2.GL_UNSIGNED_BYTE, buffer); - return; - } - - if (transparent_) { - // Enable alpha blending. - gl2.glEnable(gl2.GL_BLEND); - } - - // Enable 2D textures. - gl2.glEnable(gl2.GL_TEXTURE_2D); - - assert(texture_id_[0] != 0); - gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]); - - if (!popup) { - int old_width = view_width_; - int old_height = view_height_; - - view_width_ = width; - view_height_ = height; - - gl2.glPixelStorei(gl2.GL_UNPACK_ROW_LENGTH, view_width_); - - if (old_width != view_width_ || old_height != view_height_) { - // Update/resize the whole texture. - gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_PIXELS, 0); - gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_ROWS, 0); - gl2.glTexImage2D(gl2.GL_TEXTURE_2D, 0, gl2.GL_RGBA, view_width_, view_height_, 0, - gl2.GL_BGRA, gl2.GL_UNSIGNED_INT_8_8_8_8_REV, buffer); - } else { - // Update just the dirty rectangles. - for (int i = 0; i < dirtyRects.length; ++i) { - Rectangle rect = dirtyRects[i]; - gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_PIXELS, rect.x); - gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_ROWS, rect.y); - gl2.glTexSubImage2D(gl2.GL_TEXTURE_2D, 0, rect.x, rect.y, rect.width, - rect.height, gl2.GL_BGRA, gl2.GL_UNSIGNED_INT_8_8_8_8_REV, buffer); - } - } - } else if (popup && popup_rect_.width > 0 && popup_rect_.height > 0) { - int skip_pixels = 0, x = popup_rect_.x; - int skip_rows = 0, y = popup_rect_.y; - int w = width; - int h = height; - - // Adjust the popup to fit inside the view. - if (x < 0) { - skip_pixels = -x; - x = 0; - } - if (y < 0) { - skip_rows = -y; - y = 0; - } - if (x + w > view_width_) w -= x + w - view_width_; - if (y + h > view_height_) h -= y + h - view_height_; - - // Update the popup rectangle. - gl2.glPixelStorei(gl2.GL_UNPACK_ROW_LENGTH, width); - gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_PIXELS, skip_pixels); - gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_ROWS, skip_rows); - gl2.glTexSubImage2D(gl2.GL_TEXTURE_2D, 0, x, y, w, h, gl2.GL_BGRA, - gl2.GL_UNSIGNED_INT_8_8_8_8_REV, buffer); - } - - // Disable 2D textures. - gl2.glDisable(gl2.GL_TEXTURE_2D); - - if (transparent_) { - // Disable alpha blending. - gl2.glDisable(gl2.GL_BLEND); - } - } - - protected void setSpin(float spinX, float spinY) { - spin_x_ = spinX; - spin_y_ = spinY; - } - - protected void incrementSpin(float spinDX, float spinDY) { - spin_x_ -= spinDX; - spin_y_ -= spinDY; - } -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefRequestContext.java b/wizard-browser/src/main/java/org/cef/browser/CefRequestContext.java deleted file mode 100644 index 26fa66a..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefRequestContext.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import org.cef.handler.CefRequestContextHandler; - -/** - * A request context provides request handling for a set of related browser - * objects. A request context is specified when creating a new browser object - * via the CefClient.createBrowser method. Browser objects with different - * request contexts will never be hosted in the same render process. Browser - * objects with the same request context may or may not be hosted in the same - * render process depending on the process model. Browser objects created - * indirectly via the JavaScript window.open function or targeted links will - * share the same render process and the same request context as the source - * browser. When running in single-process mode there is only a single render - * process (the main process) and so all browsers created in single-process mode - * will share the same request context. This will be the first request context - * passed into the CefClient.createBrowser method and all other request - * context objects will be ignored. - */ -public abstract class CefRequestContext { - // This CTOR can't be called directly. Call method create() instead. - CefRequestContext() {} - - /** - * Returns the global context object. - */ - public static final CefRequestContext getGlobalContext() { - return CefRequestContext_N.getGlobalContextNative(); - } - - /** - * Creates a new context object with the specified handler. - */ - public static final CefRequestContext createContext(CefRequestContextHandler handler) { - return CefRequestContext_N.createNative(handler); - } - - public abstract void dispose(); - - /** - * Returns true if this object is the global context. - */ - public abstract boolean isGlobal(); - - /** - * Returns the handler for this context if any. - */ - public abstract CefRequestContextHandler getHandler(); -} diff --git a/wizard-browser/src/main/java/org/cef/browser/CefRequestContext_N.java b/wizard-browser/src/main/java/org/cef/browser/CefRequestContext_N.java deleted file mode 100644 index 622a9ab..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/CefRequestContext_N.java +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.browser; - -import org.cef.callback.CefNative; -import org.cef.handler.CefRequestContextHandler; - -class CefRequestContext_N extends CefRequestContext implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - private static CefRequestContext_N globalInstance = null; - private CefRequestContextHandler handler = null; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefRequestContext_N() { - super(); - } - - static final CefRequestContext_N getGlobalContextNative() { - CefRequestContext_N result = null; - try { - result = CefRequestContext_N.N_GetGlobalContext(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - - if (globalInstance == null) { - globalInstance = result; - } else if (globalInstance.N_CefHandle == result.N_CefHandle) { - result.N_CefRequestContext_DTOR(); - } - return globalInstance; - } - - static final CefRequestContext_N createNative(CefRequestContextHandler handler) { - CefRequestContext_N result = null; - try { - result = CefRequestContext_N.N_CreateContext(handler); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - if (result != null) result.handler = handler; - return result; - } - - @Override - public void dispose() { - try { - N_CefRequestContext_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean isGlobal() { - try { - return N_IsGlobal(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public CefRequestContextHandler getHandler() { - return handler; - } - - private final static native CefRequestContext_N N_GetGlobalContext(); - private final static native CefRequestContext_N N_CreateContext( - CefRequestContextHandler handler); - private final native boolean N_IsGlobal(); - private final native void N_CefRequestContext_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/browser/mac/CefBrowserWindowMac.java b/wizard-browser/src/main/java/org/cef/browser/mac/CefBrowserWindowMac.java deleted file mode 100644 index 034804c..0000000 --- a/wizard-browser/src/main/java/org/cef/browser/mac/CefBrowserWindowMac.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -/*package org.cef.browser.mac; - -import java.awt.Component; -import java.awt.peer.ComponentPeer; -import sun.lwawt.LWComponentPeer; -import sun.lwawt.PlatformWindow; -import sun.lwawt.macosx.CFRetainedResource; -import sun.lwawt.macosx.CPlatformWindow; - -import org.cef.browser.CefBrowserWindow; - -public class CefBrowserWindowMac implements CefBrowserWindow { - @Override - public long getWindowHandle(Component comp) { - final long[] result = new long[1]; - while (comp != null) { - if (comp.isLightweight()) { - comp = comp.getParent(); - continue; - } - @SuppressWarnings("deprecation") - ComponentPeer peer = comp.getPeer(); - if (peer instanceof LWComponentPeer) { - @SuppressWarnings("rawtypes") - PlatformWindow pWindow = ((LWComponentPeer) peer).getPlatformWindow(); - if (pWindow instanceof CPlatformWindow) { - ((CPlatformWindow) pWindow).execute(new CFRetainedResource.CFNativeAction() { - @Override - public void run(long l) { - result[0] = l; - } - }); - break; - } - } - comp = comp.getParent(); - } - return result[0]; - } -} -*/ \ No newline at end of file diff --git a/wizard-browser/src/main/java/org/cef/callback/CefAuthCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefAuthCallback.java deleted file mode 100644 index 9cef71b..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefAuthCallback.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Callback interface used for asynchronous continuation of authentication - * requests. - */ -public interface CefAuthCallback { - /** - * Continue the authentication request. - */ - public void Continue(String username, String password); - - /** - * Cancel the authentication request. - */ - public void cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefAuthCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefAuthCallback_N.java deleted file mode 100644 index 5485f26..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefAuthCallback_N.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefAuthCallback_N extends CefNativeAdapter implements CefAuthCallback { - CefAuthCallback_N() {} - - @Override - public void Continue(String username, String password) { - try { - N_Continue(username, password); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void cancel() { - try { - N_Cancel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(String username, String password); - private final native void N_Cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefBeforeDownloadCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefBeforeDownloadCallback.java deleted file mode 100644 index 442eb49..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefBeforeDownloadCallback.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Callback interface used to asynchronously continue a download. - */ -public interface CefBeforeDownloadCallback { - /** - * Call to continue the download. - * @param downloadPath Set it to the full file path for the download - * including the file name or leave blank to use the suggested name and - * the default temp directory. - * @param showDialog Set it to true if you do wish to show the default - * "Save As" dialog. - */ - public void Continue(String downloadPath, boolean showDialog); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefBeforeDownloadCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefBeforeDownloadCallback_N.java deleted file mode 100644 index 4e53d9d..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefBeforeDownloadCallback_N.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefBeforeDownloadCallback_N extends CefNativeAdapter implements CefBeforeDownloadCallback { - CefBeforeDownloadCallback_N() {} - - @Override - public void Continue(String downloadPath, boolean showDialog) { - try { - N_Continue(downloadPath, showDialog); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(String downloadPath, boolean showDialog); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefCallback.java deleted file mode 100644 index 9d4f405..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefCallback.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Generic callback interface used for asynchronous continuation. - */ -public interface CefCallback { - /** - * Continue processing. - */ - void Continue(); - - /** - * Cancel processing. - */ - void cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefCallback_N.java deleted file mode 100644 index 1671906..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefCallback_N.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefCallback_N extends CefNativeAdapter implements CefCallback { - CefCallback_N() {} - - @Override - public void Continue() { - try { - N_Continue(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void cancel() { - try { - N_Cancel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(); - private final native void N_Cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefCommandLine.java b/wizard-browser/src/main/java/org/cef/callback/CefCommandLine.java deleted file mode 100644 index 65a553b..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefCommandLine.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Map; -import java.util.Vector; - -/** - * Class used to create and/or parse command line arguments. Arguments with - * '--', '-' and, on Windows, '/' prefixes are considered switches. Switches - * will always precede any arguments without switch prefixes. Switches can - * optionally have a value specified using the '=' delimiter (e.g. - * "-switch=value"). An argument of "--" will terminate switch parsing with all - * subsequent tokens, regardless of prefix, being interpreted as non-switch - * arguments. Switch names are considered case-insensitive. - */ -public interface CefCommandLine { - /** - * Reset the command-line switches and arguments but leave the program - * component unchanged. - */ - public void reset(); - /** - * Get the program part of the command line string (the first item). - */ - public String getProgram(); - /** - * Set the program part of the command line string (the first item). - * @param program Name of the program. - */ - public void setProgram(String program); - /** - * Checks if the command line has switches. - * @return true if the command line has switches. - */ - public boolean hasSwitches(); - /** - * Checks if the command line has a specific switches. - * @param name A switch name to test for. - * @return true if the command line contains the given switch. - */ - public boolean hasSwitch(String name); - /** - * Returns the value associated with the given switch. If the switch has no - * value or isn't present this method returns the empty string. - * @param name the name of the switch. - * @return the value of the switch. - */ - public String getSwitchValue(String name); - /** - * Returns the map of switch names and values. If a switch has no value an - * empty string is returned. - * @return Map of switches and each value. - */ - public Map getSwitches(); - /** - * Add a switch with an empty value to the end of the command line. - * @param name name of the switch. - */ - public void appendSwitch(String name); - /** - * Add a switch with the specified value to the end of the command line. - * @param name name of the switch. - * @param value value for the switch. - */ - public void appendSwitchWithValue(String name, String value); - /** - * Tests if there are remaining command line arguments. - * @return True if there are remaining command line arguments. - */ - public boolean hasArguments(); - /** - * Get the remaining command line arguments. - * @return Vector of command line arguments. - */ - public Vector getArguments(); - /** - * Add an argument to the end of the command line. - * @param argument name of the argument. - */ - public void appendArgument(String argument); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefCommandLine_N.java b/wizard-browser/src/main/java/org/cef/callback/CefCommandLine_N.java deleted file mode 100644 index 5566c44..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefCommandLine_N.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Map; -import java.util.Vector; - -class CefCommandLine_N extends CefNativeAdapter implements CefCommandLine { - @Override - public void reset() { - try { - N_reset(); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - @Override - public String getProgram() { - try { - return N_getProgram(); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return null; - } - - @Override - public void setProgram(String program) { - try { - N_setProgram(program); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - @Override - public boolean hasSwitches() { - try { - return N_hasSwitches(); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return false; - } - - @Override - public boolean hasSwitch(String name) { - try { - return N_hasSwitch(name); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return false; - } - - @Override - public String getSwitchValue(String name) { - try { - return N_getSwitchValue(name); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return null; - } - - @Override - public Map getSwitches() { - try { - return N_getSwitches(); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return null; - } - - @Override - public void appendSwitch(String name) { - try { - N_appendSwitch(name); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - @Override - public void appendSwitchWithValue(String name, String value) { - try { - N_appendSwitchWithValue(name, value); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - @Override - public boolean hasArguments() { - try { - return N_hasArguments(); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return false; - } - - @Override - public Vector getArguments() { - try { - return N_getArguments(); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return null; - } - - @Override - public void appendArgument(String argument) { - try { - N_appendArgument(argument); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - @Override - public String toString() { - String result = "CefCommandLine [program=\'" + getProgram() + "\'"; - if (hasSwitches()) { - Map switches = getSwitches(); - result += ", switches=" + switches; - } - if (hasArguments()) { - Vector arguments = getArguments(); - result += ", arguments=" + arguments; - } - return result + "]"; - } - - private final native void N_reset(); - private final native String N_getProgram(); - private final native void N_setProgram(String program); - private final native boolean N_hasSwitches(); - private final native boolean N_hasSwitch(String name); - private final native String N_getSwitchValue(String name); - private final native Map N_getSwitches(); - private final native void N_appendSwitch(String name); - private final native void N_appendSwitchWithValue(String name, String value); - private final native boolean N_hasArguments(); - private final native Vector N_getArguments(); - private final native void N_appendArgument(String argument); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefCompletionCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefCompletionCallback.java deleted file mode 100644 index 7349390..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefCompletionCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Generic callback interface used for asynchronous completion. - */ -public interface CefCompletionCallback { - /** - * Method that will be called once the task is complete. - */ - public abstract void onComplete(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefContextMenuParams.java b/wizard-browser/src/main/java/org/cef/callback/CefContextMenuParams.java deleted file mode 100644 index e2c4d58..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefContextMenuParams.java +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Vector; - -/** - * Provides information about the context menu state. The methods of this class - * can only be accessed on browser process the UI thread. - */ -public interface CefContextMenuParams { - /** - * Supported context menu type flags. - */ - public static final class TypeFlags { - public final static int CM_TYPEFLAG_NONE = 0; //!< No node is selected. - public final static int CM_TYPEFLAG_PAGE = 1 << 0; //!< The top page is selected. - public final static int CM_TYPEFLAG_FRAME = 1 << 1; //!< A subframe page is selected. - public final static int CM_TYPEFLAG_LINK = 1 << 2; //!< A link is selected. - public final static int CM_TYPEFLAG_MEDIA = 1 << 3; //!< A media node is selected. - public final static int CM_TYPEFLAG_SELECTION = 1 - << 4; //!< There is a textual or mixed selection that is selected. - public final static int CM_TYPEFLAG_EDITABLE = 1 << 5; //!< An editable element is selected. - } - - /** - * Supported context menu media types. - */ - public enum MediaType { - CM_MEDIATYPE_NONE, //!< No special node is in context. - CM_MEDIATYPE_IMAGE, //!< An image node is selected. - CM_MEDIATYPE_VIDEO, //!< A video node is selected. - CM_MEDIATYPE_AUDIO, //!< An audio node is selected. - CM_MEDIATYPE_FILE, //!< A file node is selected. - CM_MEDIATYPE_PLUGIN, //!< A plugin node is selected. - } - - /** - * Supported context menu media state bit flags. - */ - public static final class MediaStateFlags { - public final static int CM_MEDIAFLAG_NONE = 0; - public final static int CM_MEDIAFLAG_ERROR = 1 << 0; - public final static int CM_MEDIAFLAG_PAUSED = 1 << 1; - public final static int CM_MEDIAFLAG_MUTED = 1 << 2; - public final static int CM_MEDIAFLAG_LOOP = 1 << 3; - public final static int CM_MEDIAFLAG_CAN_SAVE = 1 << 4; - public final static int CM_MEDIAFLAG_HAS_AUDIO = 1 << 5; - public final static int CM_MEDIAFLAG_HAS_VIDEO = 1 << 6; - public final static int CM_MEDIAFLAG_CONTROL_ROOT_ELEMENT = 1 << 7; - public final static int CM_MEDIAFLAG_CAN_PRINT = 1 << 8; - public final static int CM_MEDIAFLAG_CAN_ROTATE = 1 << 9; - } - - /** - * Supported context menu edit state bit flags. - */ - public static final class EditStateFlags { - public final static int CM_EDITFLAG_NONE = 0; - public final static int CM_EDITFLAG_CAN_UNDO = 1 << 0; - public final static int CM_EDITFLAG_CAN_REDO = 1 << 1; - public final static int CM_EDITFLAG_CAN_CUT = 1 << 2; - public final static int CM_EDITFLAG_CAN_COPY = 1 << 3; - public final static int CM_EDITFLAG_CAN_PASTE = 1 << 4; - public final static int CM_EDITFLAG_CAN_DELETE = 1 << 5; - public final static int CM_EDITFLAG_CAN_SELECT_ALL = 1 << 6; - public final static int CM_EDITFLAG_CAN_TRANSLATE = 1 << 7; - } - - /** - * Returns the X coordinate of the mouse where the context menu was invoked. - * Coords are relative to the associated RenderView's origin. - */ - int getXCoord(); - - /** - * Returns the Y coordinate of the mouse where the context menu was invoked. - * Coords are relative to the associated RenderView's origin. - */ - int getYCoord(); - - /** - * Returns flags representing the type of node that the context menu was - * invoked on. See TypeFlags for supported values - */ - int getTypeFlags(); - - /** - * Returns the URL of the link, if any, that encloses the node that the - * context menu was invoked on. - */ - String getLinkUrl(); - - /** - * Returns the link URL, if any, to be used ONLY for "copy link address". We - * don't validate this field in the frontend process. - */ - String getUnfilteredLinkUrl(); - - /** - * Returns the source URL, if any, for the element that the context menu was - * invoked on. Example of elements with source URLs are img, audio, and video. - */ - String getSourceUrl(); - - /** - * Returns true if the context menu was invoked on an image which has - * non-empty contents. - */ - boolean hasImageContents(); - - /** - * Returns the URL of the top level page that the context menu was invoked on. - */ - String getPageUrl(); - - /** - * Returns the URL of the subframe that the context menu was invoked on. - */ - String getFrameUrl(); - - /** - * Returns the character encoding of the subframe that the context menu was - * invoked on. - */ - String getFrameCharset(); - - /** - * Returns the type of context node that the context menu was invoked on. - */ - MediaType getMediaType(); - - /** - * Returns flags representing the actions supported by the media element, if - * any, that the context menu was invoked on. See MediaStateFlags for possible - * values. - */ - int getMediaStateFlags(); - - /** - * Returns the text of the selection, if any, that the context menu was - * invoked on. - */ - - String getSelectionText(); - - /** - * Returns the text of the misspelled word, if any, that the context menu was - * invoked on. - */ - String getMisspelledWord(); - - /** - * Returns true if suggestions exist, false otherwise. Fills in |suggestions| - * from the spell check service for the misspelled word if there is one. - */ - boolean getDictionarySuggestions(Vector suggestions); - - /** - * Returns true if the context menu was invoked on an editable node. - */ - - boolean isEditable(); - - /** - * Returns true if the context menu was invoked on an editable node where - * spell-check is enabled. - */ - - boolean isSpellCheckEnabled(); - - /** - * Returns flags representing the actions supported by the editable node, if - * any, that the context menu was invoked on. See EditStateFlags for possible - * values. - */ - int getEditStateFlags(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefContextMenuParams_N.java b/wizard-browser/src/main/java/org/cef/callback/CefContextMenuParams_N.java deleted file mode 100644 index 5cce356..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefContextMenuParams_N.java +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Vector; - -class CefContextMenuParams_N extends CefNativeAdapter implements CefContextMenuParams { - CefContextMenuParams_N() {} - - @Override - public int getXCoord() { - try { - return N_GetXCoord(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public int getYCoord() { - try { - return N_GetYCoord(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public int getTypeFlags() { - try { - return N_GetTypeFlags(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public String getLinkUrl() { - try { - return N_GetLinkUrl(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getUnfilteredLinkUrl() { - try { - return N_GetUnfilteredLinkUrl(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getSourceUrl() { - try { - return N_GetSourceUrl(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public boolean hasImageContents() { - try { - return N_HasImageContents(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public String getPageUrl() { - try { - return N_GetPageUrl(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getFrameUrl() { - try { - return N_GetFrameUrl(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getFrameCharset() { - try { - return N_GetFrameCharset(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public MediaType getMediaType() { - try { - return N_GetMediaType(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public int getMediaStateFlags() { - try { - return N_GetMediaStateFlags(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public String getSelectionText() { - try { - return N_GetSelectionText(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getMisspelledWord() { - try { - return N_GetMisspelledWord(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public boolean getDictionarySuggestions(Vector suggestions) { - try { - return N_GetDictionarySuggestions(suggestions); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isEditable() { - try { - return N_IsEditable(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isSpellCheckEnabled() { - try { - return N_IsSpellCheckEnabled(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public int getEditStateFlags() { - try { - return N_GetEditStateFlags(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - private final native int N_GetXCoord(); - private final native int N_GetYCoord(); - private final native int N_GetTypeFlags(); - private final native String N_GetLinkUrl(); - private final native String N_GetUnfilteredLinkUrl(); - private final native String N_GetSourceUrl(); - private final native boolean N_HasImageContents(); - private final native String N_GetPageUrl(); - private final native String N_GetFrameUrl(); - private final native String N_GetFrameCharset(); - private final native MediaType N_GetMediaType(); - private final native int N_GetMediaStateFlags(); - private final native String N_GetSelectionText(); - private final native String N_GetMisspelledWord(); - private final native boolean N_GetDictionarySuggestions(Vector suggestions); - private final native boolean N_IsEditable(); - private final native boolean N_IsSpellCheckEnabled(); - private final native int N_GetEditStateFlags(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefCookieVisitor.java b/wizard-browser/src/main/java/org/cef/callback/CefCookieVisitor.java deleted file mode 100644 index 1d55764..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefCookieVisitor.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import org.cef.misc.BoolRef; -import org.cef.network.CefCookie; - -/** - * Interface to implement for visiting cookie values. The methods of this class - * will always be called on the IO thread. - */ -public interface CefCookieVisitor { - /** - * Method that will be called once for each cookie. |count| is the 0-based - * index for the current cookie. |total| is the total number of cookies. - * Set |deleteCookie| to true to delete the cookie currently being visited. - * Return false to stop visiting cookies. This method may never be called if - * no cookies are found. - */ - public abstract boolean visit(CefCookie cookie, int count, int total, BoolRef delete); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefDownloadItem.java b/wizard-browser/src/main/java/org/cef/callback/CefDownloadItem.java deleted file mode 100644 index b9302dd..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefDownloadItem.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Date; - -/** - * Class used to represent a download item. - */ -public interface CefDownloadItem { - /** - * Returns true if this object is valid. Do not call any other methods if this - * function returns false. - */ - boolean isValid(); - - /** - * Returns true if the download is in progress. - */ - boolean isInProgress(); - - /** - * Returns true if the download is complete. - */ - boolean isComplete(); - - /** - * Returns true if the download has been canceled or interrupted. - */ - boolean isCanceled(); - - /** - * Returns a simple speed estimate in bytes/s. - */ - long getCurrentSpeed(); - - /** - * Returns the rough percent complete or -1 if the receive total size is - * unknown. - */ - int getPercentComplete(); - - /** - * Returns the total number of bytes. - */ - long getTotalBytes(); - - /** - * Returns the number of received bytes. - */ - long getReceivedBytes(); - - /** - * Returns the time that the download started. - */ - Date getStartTime(); - - /** - * Returns the time that the download ended. - */ - Date getEndTime(); - - /** - * Returns the full path to the downloaded or downloading file. - */ - String getFullPath(); - - /** - * Returns the unique identifier for this download. - */ - int getId(); - - /** - * Returns the URL. - */ - String getURL(); - - /** - * Returns the suggested file name. - */ - String getSuggestedFileName(); - - /** - * Returns the content disposition. - */ - String getContentDisposition(); - - /** - * Returns the mime type. - */ - String getMimeType(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefDownloadItemCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefDownloadItemCallback.java deleted file mode 100644 index e5ed8cd..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefDownloadItemCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Callback interface used to asynchronously cancel a download. - */ -public interface CefDownloadItemCallback { - /** - * Call to cancel the download. - */ - public void cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefDownloadItemCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefDownloadItemCallback_N.java deleted file mode 100644 index 11109e5..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefDownloadItemCallback_N.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefDownloadItemCallback_N extends CefNativeAdapter implements CefDownloadItemCallback { - CefDownloadItemCallback_N() {} - - @Override - public void cancel() { - try { - N_Cancel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefDownloadItem_N.java b/wizard-browser/src/main/java/org/cef/callback/CefDownloadItem_N.java deleted file mode 100644 index c7dbc24..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefDownloadItem_N.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Date; - -class CefDownloadItem_N extends CefNativeAdapter implements CefDownloadItem { - protected void finalize() throws Throwable { - super.finalize(); - } - - CefDownloadItem_N() {} - - @Override - public boolean isValid() { - try { - return N_IsValid(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isInProgress() { - try { - return N_IsInProgress(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isComplete() { - try { - return N_IsComplete(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isCanceled() { - try { - return N_IsCanceled(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public long getCurrentSpeed() { - try { - return N_GetCurrentSpeed(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public int getPercentComplete() { - try { - return N_GetPercentComplete(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public long getTotalBytes() { - try { - return N_GetTotalBytes(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public long getReceivedBytes() { - try { - return N_GetReceivedBytes(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public Date getStartTime() { - try { - return N_GetStartTime(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public Date getEndTime() { - try { - return N_GetEndTime(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getFullPath() { - try { - return N_GetFullPath(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public int getId() { - try { - return N_GetId(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public String getURL() { - try { - return N_GetURL(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getSuggestedFileName() { - try { - return N_GetSuggestedFileName(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getContentDisposition() { - try { - return N_GetContentDisposition(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getMimeType() { - try { - return N_GetMimeType(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - private final native boolean N_IsValid(); - private final native boolean N_IsInProgress(); - private final native boolean N_IsComplete(); - private final native boolean N_IsCanceled(); - private final native long N_GetCurrentSpeed(); - private final native int N_GetPercentComplete(); - private final native long N_GetTotalBytes(); - private final native long N_GetReceivedBytes(); - private final native Date N_GetStartTime(); - private final native Date N_GetEndTime(); - private final native String N_GetFullPath(); - private final native int N_GetId(); - private final native String N_GetURL(); - private final native String N_GetSuggestedFileName(); - private final native String N_GetContentDisposition(); - private final native String N_GetMimeType(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefDragData.java b/wizard-browser/src/main/java/org/cef/callback/CefDragData.java deleted file mode 100644 index 3fe1bee..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefDragData.java +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.io.OutputStream; -import java.util.Vector; - -/** - * Class used to represent drag data. The methods of this class may be called - * on any thread. - */ -public abstract class CefDragData { - // This CTOR can't be called directly. Call method create() instead. - CefDragData() {} - - @Override - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - /** - * Create a new CefDragData object. - */ - public static final CefDragData create() { - return CefDragData_N.createNative(); - } - - /** - * Returns a copy of the current object - */ - public abstract CefDragData clone(); - - /** - * Removes the native reference from an unused object. - */ - public abstract void dispose(); - - /** - * Test if the object is set to read-only. - * @return true if this object is read-only. - */ - public abstract boolean isReadOnly(); - - /** - * Returns true if the drag data is a link. - */ - public abstract boolean isLink(); - - /** - * Returns true if the drag data is a text or html fragment. - */ - public abstract boolean isFragment(); - - /** - * Returns true if the drag data is a file. - */ - public abstract boolean isFile(); - - /** - * Return the link URL that is being dragged. - */ - public abstract String getLinkURL(); - - /** - * Return the title associated with the link being dragged. - */ - public abstract String getLinkTitle(); - - /** - * Return the metadata, if any, associated with the link being dragged. - */ - public abstract String getLinkMetadata(); - - /** - * Return the plain text fragment that is being dragged. - */ - public abstract String getFragmentText(); - - /** - * Return the text/html fragment that is being dragged. - */ - public abstract String getFragmentHtml(); - - /** - * Return the base URL that the fragment came from. This value is used for - * resolving relative URLs and may be empty. - */ - public abstract String getFragmentBaseURL(); - - /** - * Write the contents of the file being dragged out of the web view into - * |writer|. Returns the number of bytes sent to |writer|. If |writer| is - * NULL this method will return the size of the file contents in bytes. - * Call getFileName() to get a suggested name for the file. - * - * @param writer Writes the contents into this object. - * @return The number of bytes sent to writer. If writer is NULL the size of - * the file contents in bytes is returned. - */ - public abstract int getFileContents(OutputStream writer); - - /** - * Return the name of the file being dragged out of the browser window. - */ - public abstract String getFileName(); - - /** - * Retrieve the list of file names that are being dragged into the browser - * window. - */ - public abstract boolean getFileNames(Vector names); - - /** - * Set the link URL that is being dragged. - * @param url The link URL to be set. - */ - public abstract void setLinkURL(String url); - - /** - * Set the title associated with the link being dragged. - * @param title The tile associated with the link. - */ - public abstract void setLinkTitle(String title); - - /** - * Set the metadata associated with the link being dragged. - * @param data The metadata associated with the link. - */ - public abstract void setLinkMetadata(String data); - - /** - * Set the plain text fragment that is being dragged. - * @param text The plain text fragment to be set. - */ - public abstract void setFragmentText(String text); - - /** - * Set the text/html fragment that is being dragged. - * @param html The html fragment to be set. - */ - public abstract void setFragmentHtml(String html); - - /** - * Set the base URL that the fragment came from. - * @param baseUrl The base URL to be set. - */ - public abstract void setFragmentBaseURL(String baseUrl); - - /** - * Reset the file contents. You should do this before calling - * CefBrowser.dragTargetDragEnter as the web view does not allow us to - * drag in this kind of data. - */ - public abstract void resetFileContents(); - - /** - * Add a file that is being dragged into the webview. - * @param path The file and path to be set. - * @param displayName The name to be displayed. - */ - public abstract void addFile(String path, String displayName); - - @Override - public String toString() { - return "CefDragData [isReadOnly()=" + isReadOnly() + ", isLink()=" + isLink() - + ", isFragment()=" + isFragment() + ", isFile()=" + isFile() + ", getLinkURL()=" - + getLinkURL() + ", getLinkTitle()=" + getLinkTitle() + ", getLinkMetadata()=" - + getLinkMetadata() + ", getFragmentText()=" + getFragmentText() - + ", getFragmentHtml()=" + getFragmentHtml() + ", getFragmentBaseURL()=" - + getFragmentBaseURL() + ", getFileName()=" + getFileName() + "]"; - } -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefDragData_N.java b/wizard-browser/src/main/java/org/cef/callback/CefDragData_N.java deleted file mode 100644 index 0a963ca..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefDragData_N.java +++ /dev/null @@ -1,287 +0,0 @@ -package org.cef.callback; - -import java.io.OutputStream; -import java.util.Vector; - -class CefDragData_N extends CefDragData implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefDragData_N() { - super(); - } - - public static CefDragData createNative() { - try { - return CefDragData_N.N_Create(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public CefDragData clone() { - try { - return N_Clone(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return null; - } - } - - @Override - public void dispose() { - try { - N_Dispose(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean isReadOnly() { - try { - return N_IsReadOnly(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - return true; - } - } - - @Override - public boolean isLink() { - try { - return N_IsLink(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isFragment() { - try { - return N_IsFragment(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isFile() { - try { - return N_IsFile(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public String getLinkURL() { - try { - return N_GetLinkURL(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getLinkTitle() { - try { - return N_GetLinkTitle(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getLinkMetadata() { - try { - return N_GetLinkMetadata(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getFragmentText() { - try { - return N_GetFragmentText(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getFragmentHtml() { - try { - return N_GetFragmentHtml(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getFragmentBaseURL() { - try { - return N_GetFragmentBaseURL(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public int getFileContents(OutputStream writer) { - try { - return N_GetFileContents(writer); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public String getFileName() { - try { - return N_GetFileName(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public boolean getFileNames(Vector names) { - try { - return N_GetFileNames(names); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - public void setLinkURL(String url) { - try { - N_SetLinkURL(url); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void setLinkTitle(String title) { - try { - N_SetLinkTitle(title); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void setLinkMetadata(String data) { - try { - N_SetLinkMetadata(data); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void setFragmentText(String text) { - try { - N_SetFragmentText(text); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void setFragmentHtml(String html) { - try { - N_SetFragmentHtml(html); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void setFragmentBaseURL(String baseUrl) { - try { - N_SetFragmentBaseURL(baseUrl); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void resetFileContents() { - try { - N_ResetFileContents(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - public void addFile(String path, String displayName) { - try { - N_AddFile(path, displayName); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native static CefDragData_N N_Create(); - private final native CefDragData_N N_Clone(); - private final native void N_Dispose(); - private final native boolean N_IsReadOnly(); - private final native boolean N_IsLink(); - private final native boolean N_IsFragment(); - private final native boolean N_IsFile(); - private final native String N_GetLinkURL(); - private final native String N_GetLinkTitle(); - private final native String N_GetLinkMetadata(); - private final native String N_GetFragmentText(); - private final native String N_GetFragmentHtml(); - private final native String N_GetFragmentBaseURL(); - private final native int N_GetFileContents(OutputStream writer); - private final native String N_GetFileName(); - private final native boolean N_GetFileNames(Vector names); - private final native void N_SetLinkURL(String url); - private final native void N_SetLinkTitle(String title); - private final native void N_SetLinkMetadata(String data); - private final native void N_SetFragmentText(String text); - private final native void N_SetFragmentHtml(String html); - private final native void N_SetFragmentBaseURL(String baseUrl); - private final native void N_ResetFileContents(); - private final native void N_AddFile(String path, String displayName); - - @Override - public String toString() { - Vector names = new Vector<>(); - getFileNames(names); - String fileNamesStr = "{"; - for (String s : names) fileNamesStr += s + ","; - fileNamesStr += "}"; - - return "CefDragData_N [isLink()=" + isLink() + ", isFragment()=" + isFragment() - + ", isFile()=" + isFile() + ", getLinkURL()=" + getLinkURL() - + ", getLinkTitle()=" + getLinkTitle() + ", getLinkMetadata()=" + getLinkMetadata() - + ", getFragmentText()=" + getFragmentText() + ", getFragmentHtml()=" - + getFragmentHtml() + ", getFragmentBaseURL()=" + getFragmentBaseURL() - + ", getFileName()=" + getFileName() + ", getFileNames(vector)=" + fileNamesStr - + "]"; - } -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefFileDialogCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefFileDialogCallback.java deleted file mode 100644 index 1bbb0b3..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefFileDialogCallback.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Vector; - -/** - * Callback interface for asynchronous continuation of file dialog requests. - */ -public interface CefFileDialogCallback { - /** - * Continue the file selection with the specified file_paths. This may be - * a single value or a list of values depending on the dialog mode. An empty - * value is treated the same as calling Cancel(). - * - * @param selectedAcceptFilter 0-based index of the value selected from the - * accept filters array passed to CefDialogHandler::OnFileDialog. - * @param filePaths list of selected file paths or an empty list. - */ - public void Continue(int selectedAcceptFilter, Vector filePaths); - - /** - * Cancel the file selection. - */ - public void Cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefFileDialogCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefFileDialogCallback_N.java deleted file mode 100644 index 200ff5d..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefFileDialogCallback_N.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Vector; - -class CefFileDialogCallback_N extends CefNativeAdapter implements CefFileDialogCallback { - CefFileDialogCallback_N() {} - - @Override - public void Continue(int selectedAcceptFilter, Vector filePaths) { - try { - N_Continue(selectedAcceptFilter, filePaths); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void Cancel() { - try { - N_Cancel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(int selectedAcceptFilter, Vector filePaths); - private final native void N_Cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefGeolocationCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefGeolocationCallback.java deleted file mode 100644 index 961fb42..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefGeolocationCallback.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Callback interface used for asynchronous continuation of geolocation - * permission requests. - */ -public interface CefGeolocationCallback { - /** - * Call to allow or deny geolocation access. - */ - public void Continue(boolean allow); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefGeolocationCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefGeolocationCallback_N.java deleted file mode 100644 index aa00fa3..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefGeolocationCallback_N.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefGeolocationCallback_N extends CefNativeAdapter implements CefGeolocationCallback { - CefGeolocationCallback_N() {} - - @Override - public void Continue(boolean allow) { - try { - N_Continue(allow); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(boolean allow); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefJSDialogCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefJSDialogCallback.java deleted file mode 100644 index bb30a6a..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefJSDialogCallback.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Callback interface used for asynchronous continuation of JavaScript dialog - * requests. - */ -public interface CefJSDialogCallback { - /** - * Continue the JS dialog request. - * - * @param success Set to true if the OK button was pressed. - * @param user_input The value should be specified for prompt dialogs. - */ - public void Continue(boolean success, String user_input); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefJSDialogCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefJSDialogCallback_N.java deleted file mode 100644 index a99fd5d..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefJSDialogCallback_N.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefJSDialogCallback_N extends CefNativeAdapter implements CefJSDialogCallback { - CefJSDialogCallback_N() {} - - @Override - public void Continue(boolean success, String user_input) { - try { - N_Continue(success, user_input); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(boolean success, String user_input); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefMenuModel.java b/wizard-browser/src/main/java/org/cef/callback/CefMenuModel.java deleted file mode 100644 index 9f89806..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefMenuModel.java +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import org.cef.misc.BoolRef; -import org.cef.misc.IntRef; - -/** - * Supports creation and modification of menus. See cef_menu_id_t for the - * command ids that have default implementations. All user-defined command ids - * should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. The methods of - * this class can only be accessed on the browser process the UI thread. - */ -public interface CefMenuModel { - public static final class MenuId { - public static final int MENU_ID_BACK = 100; - public static final int MENU_ID_FORWARD = 101; - public static final int MENU_ID_RELOAD = 102; - public static final int MENU_ID_RELOAD_NOCACHE = 103; - public static final int MENU_ID_STOPLOAD = 104; - - // Editing. - public static final int MENU_ID_UNDO = 110; - public static final int MENU_ID_REDO = 111; - public static final int MENU_ID_CUT = 112; - public static final int MENU_ID_COPY = 113; - public static final int MENU_ID_PASTE = 114; - public static final int MENU_ID_DELETE = 115; - public static final int MENU_ID_SELECT_ALL = 116; - - // Miscellaneous. - public static final int MENU_ID_FIND = 130; - public static final int MENU_ID_PRINT = 131; - public static final int MENU_ID_VIEW_SOURCE = 132; - - // Spell checking word correction suggestions. - public static final int MENU_ID_SPELLCHECK_SUGGESTION_0 = 200; - public static final int MENU_ID_SPELLCHECK_SUGGESTION_1 = 201; - public static final int MENU_ID_SPELLCHECK_SUGGESTION_2 = 202; - public static final int MENU_ID_SPELLCHECK_SUGGESTION_3 = 203; - public static final int MENU_ID_SPELLCHECK_SUGGESTION_4 = 204; - public static final int MENU_ID_SPELLCHECK_SUGGESTION_LAST = 204; - public static final int MENU_ID_NO_SPELLING_SUGGESTIONS = 205; - - // All user-defined menu IDs should come between MENU_ID_USER_FIRST and - // MENU_ID_USER_LAST to avoid overlapping the Chromium and CEF ID ranges - // defined in the tools/gritsettings/resource_ids file. - public static final int MENU_ID_USER_FIRST = 26500; - public static final int MENU_ID_USER_LAST = 28500; - } - - /** - * Supported menu item types. - */ - public enum MenuItemType { - MENUITEMTYPE_NONE, - MENUITEMTYPE_COMMAND, - MENUITEMTYPE_CHECK, - MENUITEMTYPE_RADIO, - MENUITEMTYPE_SEPARATOR, - MENUITEMTYPE_SUBMENU, - } - - /** - * Clears the menu. Returns true on success. - */ - boolean clear(); - - /** - * Returns the number of items in this menu. - */ - int getCount(); - - /** - * Add a separator to the menu. Returns true on success. - */ - boolean addSeparator(); - - /** - * Add an item to the menu. Returns true on success. - */ - boolean addItem(int command_id, String label); - - /** - * Add a check item to the menu. Returns true on success. - */ - boolean addCheckItem(int command_id, String label); - - /** - * Add a radio item to the menu. Only a single item with the specified - * |group_id| can be checked at a time. Returns true on success. - */ - boolean addRadioItem(int command_id, String label, int group_id); - - /** - * Add a sub-menu to the menu. The new sub-menu is returned. - */ - CefMenuModel addSubMenu(int command_id, String label); - - /** - * Insert a separator in the menu at the specified |index|. Returns true on - * success. - */ - boolean insertSeparatorAt(int index); - - /** - * Insert an item in the menu at the specified |index|. Returns true on - * success. - */ - boolean insertItemAt(int index, int command_id, String label); - - /** - * Insert a check item in the menu at the specified |index|. Returns true on - * success. - */ - boolean insertCheckItemAt(int index, int command_id, String label); - - /** - * Insert a radio item in the menu at the specified |index|. Only a single - * item with the specified |group_id| can be checked at a time. Returns true - * on success. - */ - boolean insertRadioItemAt(int index, int command_id, String label, int group_id); - - /** - * Insert a sub-menu in the menu at the specified |index|. The new sub-menu - * is returned. - */ - CefMenuModel insertSubMenuAt(int index, int command_id, String label); - - /** - * Removes the item with the specified |command_id|. Returns true on success. - */ - boolean remove(int command_id); - - /** - * Removes the item at the specified |index|. Returns true on success. - */ - boolean removeAt(int index); - - /** - * Returns the index associated with the specified |command_id| or -1 if not - * found due to the command id not existing in the menu. - */ - int getIndexOf(int command_id); - - /** - * Returns the command id at the specified |index| or -1 if not found due to - * invalid range or the index being a separator. - */ - int getCommandIdAt(int index); - - /** - * Sets the command id at the specified |index|. Returns true on success. - */ - boolean setCommandIdAt(int index, int command_id); - - /** - * Returns the label for the specified |command_id| or empty if not found. - */ - String getLabel(int command_id); - - /** - * Returns the label at the specified |index| or empty if not found due to - * invalid range or the index being a separator. - */ - String getLabelAt(int index); - - /** - * Sets the label for the specified |command_id|. Returns true on success. - */ - boolean setLabel(int command_id, String label); - - /** - * Set the label at the specified |index|. Returns true on success. - */ - boolean setLabelAt(int index, String label); - - /** - * Returns the item type for the specified |command_id|. - */ - MenuItemType getType(int command_id); - - /** - * Returns the item type at the specified |index|. - */ - MenuItemType getTypeAt(int index); - - /** - * Returns the group id for the specified |command_id| or -1 if invalid. - */ - int getGroupId(int command_id); - - /** - * Returns the group id at the specified |index| or -1 if invalid. - */ - int getGroupIdAt(int index); - - /** - * Sets the group id for the specified |command_id|. Returns true on success. - */ - boolean setGroupId(int command_id, int group_id); - - /** - * Sets the group id at the specified |index|. Returns true on success. - */ - boolean setGroupIdAt(int index, int group_id); - - /** - * Returns the submenu for the specified |command_id| or empty if invalid. - */ - CefMenuModel getSubMenu(int command_id); - - /** - * Returns the submenu at the specified |index| or empty if invalid. - */ - CefMenuModel getSubMenuAt(int index); - - /** - * Returns true if the specified |command_id| is visible. - */ - boolean isVisible(int command_id); - - /** - * Returns true if the specified |index| is visible. - */ - boolean isVisibleAt(int index); - - /** - * Change the visibility of the specified |command_id|. Returns true on - * success. - */ - boolean setVisible(int command_id, boolean visible); - - /** - * Change the visibility at the specified |index|. Returns true on success. - */ - boolean setVisibleAt(int index, boolean visible); - - /** - * Returns true if the specified |command_id| is enabled. - */ - boolean isEnabled(int command_id); - - /** - * Returns true if the specified |index| is enabled. - */ - boolean isEnabledAt(int index); - - /** - * Change the enabled status of the specified |command_id|. Returns true on - * success. - */ - boolean setEnabled(int command_id, boolean enabled); - - /** - * Change the enabled status at the specified |index|. Returns true on - * success. - */ - boolean setEnabledAt(int index, boolean enabled); - - /** - * Returns true if the specified |command_id| is checked. Only applies to - * check and radio items. - */ - boolean isChecked(int command_id); - - /** - * Returns true if the specified |index| is checked. Only applies to check - * and radio items. - */ - boolean isCheckedAt(int index); - - /** - * Check the specified |command_id|. Only applies to check and radio items. - * Returns true on success. - */ - boolean setChecked(int command_id, boolean checked); - - /** - * Check the specified |index|. Only applies to check and radio items. Returns - * true on success. - */ - boolean setCheckedAt(int index, boolean checked); - - /** - * Returns true if the specified |command_id| has a keyboard accelerator - * assigned. - */ - boolean hasAccelerator(int command_id); - - /** - * Returns true if the specified |index| has a keyboard accelerator assigned. - */ - boolean hasAcceleratorAt(int index); - - /** - * Set the keyboard accelerator for the specified |command_id|. |key_code| can - * be any key or character value. Returns true on success. - */ - boolean setAccelerator(int command_id, int key_code, boolean shift_pressed, - boolean ctrl_pressed, boolean alt_pressed); - - /** - * Set the keyboard accelerator at the specified |index|. |key_code| can be - * any key or character value. Returns true on success. - */ - boolean setAcceleratorAt(int index, int key_code, boolean shift_pressed, boolean ctrl_pressed, - boolean alt_pressed); - - /** - * Remove the keyboard accelerator for the specified |command_id|. Returns - * true on success. - */ - boolean removeAccelerator(int command_id); - - /** - * Remove the keyboard accelerator at the specified |index|. Returns true on - * success. - */ - boolean removeAcceleratorAt(int index); - - /** - * Retrieves the keyboard accelerator for the specified |command_id|. Returns - * true on success. - */ - boolean getAccelerator(int command_id, IntRef key_code, BoolRef shift_pressed, - BoolRef ctrl_pressed, BoolRef alt_pressed); - - /** - * Retrieves the keyboard accelerator for the specified |index|. Returns true - * on success. - */ - boolean getAcceleratorAt(int index, IntRef key_code, BoolRef shift_pressed, - BoolRef ctrl_pressed, BoolRef alt_pressed); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefMenuModel_N.java b/wizard-browser/src/main/java/org/cef/callback/CefMenuModel_N.java deleted file mode 100644 index e864ccb..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefMenuModel_N.java +++ /dev/null @@ -1,561 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import org.cef.misc.BoolRef; -import org.cef.misc.IntRef; - -class CefMenuModel_N extends CefNativeAdapter implements CefMenuModel { - public CefMenuModel_N() {} - - @Override - public boolean clear() { - try { - return N_Clear(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public int getCount() { - try { - return N_GetCount(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public boolean addSeparator() { - try { - return N_AddSeparator(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean addItem(int command_id, String label) { - try { - return N_AddItem(command_id, label); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean addCheckItem(int command_id, String label) { - try { - return N_AddCheckItem(command_id, label); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean addRadioItem(int command_id, String label, int group_id) { - try { - return N_AddRadioItem(command_id, label, group_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public CefMenuModel addSubMenu(int command_id, String label) { - try { - return N_AddSubMenu(command_id, label); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public boolean insertSeparatorAt(int index) { - try { - return N_InsertSeparatorAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean insertItemAt(int index, int command_id, String label) { - try { - return N_InsertItemAt(index, command_id, label); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean insertCheckItemAt(int index, int command_id, String label) { - try { - return N_InsertCheckItemAt(index, command_id, label); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean insertRadioItemAt(int index, int command_id, String label, int group_id) { - try { - return N_InsertRadioItemAt(index, command_id, label, group_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public CefMenuModel insertSubMenuAt(int index, int command_id, String label) { - try { - return N_InsertSubMenuAt(index, command_id, label); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public boolean remove(int command_id) { - try { - return N_Remove(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean removeAt(int index) { - try { - return N_RemoveAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public int getIndexOf(int command_id) { - try { - return N_GetIndexOf(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public int getCommandIdAt(int index) { - try { - return N_GetCommandIdAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public boolean setCommandIdAt(int index, int command_id) { - try { - return N_SetCommandIdAt(index, command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public String getLabel(int command_id) { - try { - return N_GetLabel(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getLabelAt(int index) { - try { - return N_GetLabelAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public boolean setLabel(int command_id, String label) { - try { - return N_SetLabel(command_id, label); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setLabelAt(int index, String label) { - try { - return N_SetLabelAt(index, label); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public MenuItemType getType(int command_id) { - try { - return N_GetType(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public MenuItemType getTypeAt(int index) { - try { - return N_GetTypeAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public int getGroupId(int command_id) { - try { - return N_GetGroupId(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public int getGroupIdAt(int index) { - try { - return N_GetGroupIdAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public boolean setGroupId(int command_id, int group_id) { - try { - return N_SetGroupId(command_id, group_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setGroupIdAt(int index, int group_id) { - try { - return N_SetGroupIdAt(index, group_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public CefMenuModel getSubMenu(int command_id) { - try { - return N_GetSubMenu(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public CefMenuModel getSubMenuAt(int index) { - try { - return N_GetSubMenuAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public boolean isVisible(int command_id) { - try { - return N_IsVisible(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isVisibleAt(int index) { - try { - return N_IsVisibleAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setVisible(int command_id, boolean visible) { - try { - return N_SetVisible(command_id, visible); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setVisibleAt(int index, boolean visible) { - try { - return N_SetVisibleAt(index, visible); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isEnabled(int command_id) { - try { - return N_IsEnabled(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isEnabledAt(int index) { - try { - return N_IsEnabledAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setEnabled(int command_id, boolean enabled) { - try { - return N_SetEnabled(command_id, enabled); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setEnabledAt(int index, boolean enabled) { - try { - return N_SetEnabledAt(index, enabled); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isChecked(int command_id) { - try { - return N_IsChecked(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isCheckedAt(int index) { - try { - return N_IsCheckedAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setChecked(int command_id, boolean checked) { - try { - return N_SetChecked(command_id, checked); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setCheckedAt(int index, boolean checked) { - try { - return N_SetCheckedAt(index, checked); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean hasAccelerator(int command_id) { - try { - return N_HasAccelerator(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean hasAcceleratorAt(int index) { - try { - return N_HasAcceleratorAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setAccelerator(int command_id, int key_code, boolean shift_pressed, - boolean ctrl_pressed, boolean alt_pressed) { - try { - return N_SetAccelerator(command_id, key_code, shift_pressed, ctrl_pressed, alt_pressed); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setAcceleratorAt(int index, int key_code, boolean shift_pressed, - boolean ctrl_pressed, boolean alt_pressed) { - try { - return N_SetAcceleratorAt(index, key_code, shift_pressed, ctrl_pressed, alt_pressed); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean removeAccelerator(int command_id) { - try { - return N_RemoveAccelerator(command_id); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean removeAcceleratorAt(int index) { - try { - return N_RemoveAcceleratorAt(index); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean getAccelerator(int command_id, IntRef key_code, BoolRef shift_pressed, - BoolRef ctrl_pressed, BoolRef alt_pressed) { - try { - return N_GetAccelerator(command_id, key_code, shift_pressed, ctrl_pressed, alt_pressed); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean getAcceleratorAt(int index, IntRef key_code, BoolRef shift_pressed, - BoolRef ctrl_pressed, BoolRef alt_pressed) { - try { - return N_GetAcceleratorAt(index, key_code, shift_pressed, ctrl_pressed, alt_pressed); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - private final native boolean N_Clear(); - private final native int N_GetCount(); - private final native boolean N_AddSeparator(); - private final native boolean N_AddItem(int command_id, String label); - private final native boolean N_AddCheckItem(int command_id, String label); - private final native boolean N_AddRadioItem(int command_id, String label, int group_id); - private final native CefMenuModel N_AddSubMenu(int command_id, String label); - private final native boolean N_InsertSeparatorAt(int index); - private final native boolean N_InsertItemAt(int index, int command_id, String label); - private final native boolean N_InsertCheckItemAt(int index, int command_id, String label); - private final native boolean N_InsertRadioItemAt( - int index, int command_id, String label, int group_id); - private final native CefMenuModel N_InsertSubMenuAt(int index, int command_id, String label); - private final native boolean N_Remove(int command_id); - private final native boolean N_RemoveAt(int index); - private final native int N_GetIndexOf(int command_id); - private final native int N_GetCommandIdAt(int index); - private final native boolean N_SetCommandIdAt(int index, int command_id); - private final native String N_GetLabel(int command_id); - private final native String N_GetLabelAt(int index); - private final native boolean N_SetLabel(int command_id, String label); - private final native boolean N_SetLabelAt(int index, String label); - private final native MenuItemType N_GetType(int command_id); - private final native MenuItemType N_GetTypeAt(int index); - private final native int N_GetGroupId(int command_id); - private final native int N_GetGroupIdAt(int index); - private final native boolean N_SetGroupId(int command_id, int group_id); - private final native boolean N_SetGroupIdAt(int index, int group_id); - private final native CefMenuModel N_GetSubMenu(int command_id); - private final native CefMenuModel N_GetSubMenuAt(int index); - private final native boolean N_IsVisible(int command_id); - private final native boolean N_IsVisibleAt(int index); - private final native boolean N_SetVisible(int command_id, boolean visible); - private final native boolean N_SetVisibleAt(int index, boolean visible); - private final native boolean N_IsEnabled(int command_id); - private final native boolean N_IsEnabledAt(int index); - private final native boolean N_SetEnabled(int command_id, boolean enabled); - private final native boolean N_SetEnabledAt(int index, boolean enabled); - private final native boolean N_IsChecked(int command_id); - private final native boolean N_IsCheckedAt(int index); - private final native boolean N_SetChecked(int command_id, boolean checked); - private final native boolean N_SetCheckedAt(int index, boolean checked); - private final native boolean N_HasAccelerator(int command_id); - private final native boolean N_HasAcceleratorAt(int index); - private final native boolean N_SetAccelerator(int command_id, int key_code, - boolean shift_pressed, boolean ctrl_pressed, boolean alt_pressed); - private final native boolean N_SetAcceleratorAt(int index, int key_code, boolean shift_pressed, - boolean ctrl_pressed, boolean alt_pressed); - private final native boolean N_RemoveAccelerator(int command_id); - private final native boolean N_RemoveAcceleratorAt(int index); - private final native boolean N_GetAccelerator(int command_id, IntRef key_code, - BoolRef shift_pressed, BoolRef ctrl_pressed, BoolRef alt_pressed); - private final native boolean N_GetAcceleratorAt(int index, IntRef key_code, - BoolRef shift_pressed, BoolRef ctrl_pressed, BoolRef alt_pressed); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefNative.java b/wizard-browser/src/main/java/org/cef/callback/CefNative.java deleted file mode 100644 index d72d88b..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefNative.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * The methods of this interface are triggered by the native code - * to store and get the JNI counterparts of the JCEF implementation. - */ -public interface CefNative { - /** - * Method is called by the native code to store a reference - * to an implemented native JNI counterpart. - * - * @param identifer The name of the interface class (e.g. CefFocusHandler). - * @param nativeRef The reference to the native code. - */ - public void setNativeRef(String identifer, long nativeRef); - - /** - * Method is called by the native code to get the reference - * to an previous stored identifier. - * - * @param identifer The name of the interface class (e.g. CefFocusHandler). - * @return The stored reference value of the native code. - */ - public long getNativeRef(String identifer); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefNativeAdapter.java b/wizard-browser/src/main/java/org/cef/callback/CefNativeAdapter.java deleted file mode 100644 index aa227e2..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefNativeAdapter.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.cef.callback; - -public class CefNativeAdapter implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefPdfPrintCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefPdfPrintCallback.java deleted file mode 100644 index 7bedd5c..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefPdfPrintCallback.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Callback interface for CefBrowser.PrintToPDF(). The methods of this class - * will be called on the browser process UI thread. - */ -public interface CefPdfPrintCallback { - - /** - * Method that will be executed when the PDF printing has completed. |path| - * is the output path. |ok| will be true if the printing completed - * successfully or false otherwise. - * @param path The path of the PDF file that was written. - * @param ok True if printing completed or false otherwise. - */ - public abstract void onPdfPrintFinished(String path, boolean ok); - -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefPrintDialogCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefPrintDialogCallback.java deleted file mode 100644 index 88e5c6a..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefPrintDialogCallback.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import org.cef.misc.CefPrintSettings; - -/** - * Callback interface for asynchronous continuation of print dialog requests. - */ -public interface CefPrintDialogCallback { - /** - * Continue printing with the specified |settings|. - */ - void Continue(CefPrintSettings settings); - - /** - * Cancel the printing. - */ - void cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefPrintDialogCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefPrintDialogCallback_N.java deleted file mode 100644 index 63e35d4..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefPrintDialogCallback_N.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import org.cef.misc.CefPrintSettings; - -class CefPrintDialogCallback_N extends CefNativeAdapter implements CefPrintDialogCallback { - CefPrintDialogCallback_N() {} - - @Override - public void Continue(CefPrintSettings settings) { - try { - N_Continue(settings); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void cancel() { - try { - N_Cancel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(CefPrintSettings settings); - private final native void N_Cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefPrintJobCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefPrintJobCallback.java deleted file mode 100644 index f042537..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefPrintJobCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Callback interface for asynchronous continuation of print job requests. - */ -public interface CefPrintJobCallback { - /** - * Indicate completion of the print job. - */ - void Continue(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefPrintJobCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefPrintJobCallback_N.java deleted file mode 100644 index 6e9f1d1..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefPrintJobCallback_N.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefPrintJobCallback_N extends CefNativeAdapter implements CefPrintJobCallback { - CefPrintJobCallback_N() {} - - @Override - public void Continue() { - try { - N_Continue(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefQueryCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefQueryCallback.java deleted file mode 100644 index 0972bf2..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefQueryCallback.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Interface representing a query callback. - */ -public interface CefQueryCallback { - /** - * Notify the associated JavaScript onSuccess callback that the query has - * completed successfully. - * @param response Response passed to JavaScript. - */ - public void success(String response); - - /** - * Notify the associated JavaScript onFailure callback that the query has - * failed. - * @param error_code Error code passed to JavaScript. - * @param error_message Error message passed to JavaScript. - */ - public void failure(int error_code, String error_message); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefQueryCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefQueryCallback_N.java deleted file mode 100644 index 7d526e9..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefQueryCallback_N.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefQueryCallback_N extends CefNativeAdapter implements CefQueryCallback { - // Constructor is called by native code. - CefQueryCallback_N() {} - - @Override - public void success(String response) { - try { - N_Success(response); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void failure(int error_code, String error_message) { - try { - N_Failure(error_code, error_message); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Success(String response); - private final native void N_Failure(int error_code, String error_message); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefRequestCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefRequestCallback.java deleted file mode 100644 index 80706d7..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefRequestCallback.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Callback interface used for asynchronous continuation of quota requests. - */ -public interface CefRequestCallback { - /** - * Continue the url request. - * - * @param allow If set to true the request will be continued. - * Otherwise, the request will be canceled. - */ - void Continue(boolean allow); - - /** - * Cancel the url request. - */ - void Cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefRequestCallback_N.java b/wizard-browser/src/main/java/org/cef/callback/CefRequestCallback_N.java deleted file mode 100644 index 3022ab6..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefRequestCallback_N.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefRequestCallback_N extends CefNativeAdapter implements CefRequestCallback { - CefRequestCallback_N() {} - - @Override - public void Continue(boolean allow) { - try { - N_Continue(allow); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void Cancel() { - try { - N_Cancel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_Continue(boolean allow); - private final native void N_Cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefRunFileDialogCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefRunFileDialogCallback.java deleted file mode 100644 index 21c96da..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefRunFileDialogCallback.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import java.util.Vector; -import org.cef.browser.CefBrowser; - -/** - * Callback interface for CefBrowserHost::RunFileDialog. The methods of this - * class will be called on the browser process UI thread. - */ -public interface CefRunFileDialogCallback { - /** - * Called asynchronously after the file dialog is dismissed. If the selection - * was successful filePaths will be a single value or a list of values - * depending on the dialog mode. If the selection was cancelled filePaths - * will be empty. - * - * @param selectedAcceptFilter 0-based index of the value selected from - * the accept filters array passed to CefBrowserHost::RunFileDialog. - * @param filePaths list of file paths or empty list. - */ - void onFileDialogDismissed(int selectedAcceptFilter, Vector filePaths); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefSchemeHandlerFactory.java b/wizard-browser/src/main/java/org/cef/callback/CefSchemeHandlerFactory.java deleted file mode 100644 index 32701e5..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefSchemeHandlerFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.handler.CefResourceHandler; -import org.cef.network.CefRequest; - -/** - * Class that creates CefResourceHandler instances for handling scheme requests. - * The methods of this class will always be called on the IO thread. - */ -public interface CefSchemeHandlerFactory { - /** - * Return a new resource handler instance to handle the request or an empty - * reference to allow default handling of the request. |browser| and |frame| - * will be the browser window and frame respectively that originated the - * request or NULL if the request did not originate from a browser window - * (for example, if the request came from CefURLRequest). The |request| object - * passed to this method will not contain cookie data. - */ - public CefResourceHandler create( - CefBrowser browser, CefFrame frame, String schemeName, CefRequest request); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefSchemeRegistrar.java b/wizard-browser/src/main/java/org/cef/callback/CefSchemeRegistrar.java deleted file mode 100644 index fa07782..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefSchemeRegistrar.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Class that manages custom scheme registrations. - */ -public interface CefSchemeRegistrar { - /** - * Register a custom scheme. This method should not be called for the built-in - * HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. - * - * If |isStandard| is true the scheme will be treated as a standard scheme. - * Standard schemes are subject to URL canonicalization and parsing rules as - * defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 available - * at http://www.ietf.org/rfc/rfc1738.txt - * - * In particular, the syntax for standard scheme URLs must be of the form: - *
-     *  [scheme]://[username]:[password]@[host]:[port]/[url-path]
-     * 
- * Standard scheme URLs must have a host component that is a fully qualified - * domain name as defined in Section 3.5 of RFC 1034 [13] and Section 2.1 of - * RFC 1123. These URLs will be canonicalized to "scheme://host/path" in the - * simplest case and "scheme://username:password@host:port/path" in the most - * explicit case. For example, "scheme:host/path" and "scheme:///host/path" - * will both be canonicalized to "scheme://host/path". The origin of a - * standard scheme URL is the combination of scheme, host and port (i.e., - * "scheme://host:port" in the most explicit case). - * - * For non-standard scheme URLs only the "scheme:" component is parsed and - * canonicalized. The remainder of the URL will be passed to the handler - * as-is. For example, "scheme:///some%20text" will remain the same. - * Non-standard scheme URLs cannot be used as a target for form submission. - * - * If |isLocal| is true the scheme will be treated with the same security - * rules as those applied to "file" URLs. Normal pages cannot link to or - * access local URLs. Also, by default, local URLs can only perform - * XMLHttpRequest calls to the same URL (origin + path) that originated the - * request. To allow XMLHttpRequest calls from a local URL to other URLs with - * the same origin set the CefSettings.file_access_from_file_urls_allowed - * value to true. To allow XMLHttpRequest calls from a local URL to all - * origins set the CefSettings.universal_access_from_file_urls_allowed value - * to true. - * - * If |isDisplayIsolated| is true the scheme can only be displayed from - * other content hosted with the same scheme. For example, pages in other - * origins cannot create iframes or hyperlinks to URLs with the scheme. For - * schemes that must be accessible from other schemes set this value to false, - * set |is_cors_enabled| to true, and use CORS "Access-Control-Allow-Origin" - * headers to further restrict access. - * - * If |isSecure| is true the scheme will be treated with the same security - * rules as those applied to "https" URLs. For example, loading this scheme - * from other secure schemes will not trigger mixed content warnings. - * - * If |isCorsEnabled| is true the scheme that can be sent CORS requests. - * This value should be true in most cases where |isStandard| is true. - * - * If |isCspBypassing| is true the scheme can bypass Content-Security-Policy - * (CSP) checks. This value should be false in most cases where |isStandard| - * is true. - * - * This function may be called on any thread. It should only be called once - * per unique |schemeName| value. If |schemeName| is already registered or - * if an error occurs this method will return false. - */ - public boolean addCustomScheme(String schemeName, boolean isStandard, boolean isLocal, - boolean isDisplayIsolated, boolean isSecure, boolean isCorsEnabled, - boolean isCspBypassing); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefSchemeRegistrar_N.java b/wizard-browser/src/main/java/org/cef/callback/CefSchemeRegistrar_N.java deleted file mode 100644 index ab5140b..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefSchemeRegistrar_N.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -class CefSchemeRegistrar_N extends CefNativeAdapter implements CefSchemeRegistrar { - @Override - public boolean addCustomScheme(String schemeName, boolean isStandard, boolean isLocal, - boolean isDisplayIsolated, boolean isSecure, boolean isCorsEnabled, - boolean isCspBypassing) { - try { - return N_AddCustomScheme(schemeName, isStandard, isLocal, isDisplayIsolated, isSecure, - isCorsEnabled, isCspBypassing); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - return false; - } - - private final native boolean N_AddCustomScheme(String schemeName, boolean isStandard, - boolean isLocal, boolean isDisplayIsolated, boolean isSecure, boolean isCorsEnabled, - boolean isCspBypassing); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefStringVisitor.java b/wizard-browser/src/main/java/org/cef/callback/CefStringVisitor.java deleted file mode 100644 index 19ee8d7..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefStringVisitor.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Public interface to receive string values asynchronously. - */ -public interface CefStringVisitor { - /** - * Called when the string is available. - * @param string Requested string. - */ - void visit(String string); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefURLRequestClient.java b/wizard-browser/src/main/java/org/cef/callback/CefURLRequestClient.java deleted file mode 100644 index a7d564b..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefURLRequestClient.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import org.cef.network.CefURLRequest; - -/** - * Interface that should be implemented by the CefURLRequest client. The - * methods of this class will be called on the same thread that created the - * request unless otherwise documented. - */ -public interface CefURLRequestClient extends CefNative { - /** - * Notifies the client that the request has completed. Use the - * CefURLRequest::GetRequestStatus method to determine if the request was - * successful or not. - */ - void onRequestComplete(CefURLRequest request); - - /** - * Notifies the client of upload progress. |current| denotes the number of - * bytes sent so far and |total| is the total size of uploading data (or -1 if - * chunked upload is enabled). This method will only be called if the - * UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request. - */ - void onUploadProgress(CefURLRequest request, int current, int total); - - /** - * Notifies the client of download progress. |current| denotes the number of - * bytes received up to the call and |total| is the expected total size of the - * response (or -1 if not determined). - */ - void onDownloadProgress(CefURLRequest request, int current, int total); - - /** - * Called when some part of the response is read. |data| contains the current - * bytes received since the last call. This method will not be called if the - * UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request. - */ - void onDownloadData(CefURLRequest request, byte[] data, int data_length); - - /** - * Called on the IO thread when the browser needs credentials from the user. - * |isProxy| indicates whether the host is a proxy server. |host| contains the - * hostname and |port| contains the port number. Return true to continue the - * request and call CefAuthCallback::Continue() when the authentication - * information is available. Return false to cancel the request. This method - * will only be called for requests initiated from the browser process. - */ - boolean getAuthCredentials(boolean isProxy, String host, int port, String realm, String scheme, - CefAuthCallback callback); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefWebPluginInfoVisitor.java b/wizard-browser/src/main/java/org/cef/callback/CefWebPluginInfoVisitor.java deleted file mode 100644 index c73abf5..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefWebPluginInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -import org.cef.network.CefWebPluginInfo; - -/** - * Interface to implement for visiting web plugin information. The methods of - * this class will be called on the browser process UI thread. - */ -public interface CefWebPluginInfoVisitor { - /** - * Method that will be called once for each plugin. |count| is the 0-based - * index for the current plugin. |total| is the total number of plugins. - * Return false to stop visiting plugins. This method may never be called if - * no plugins are found. - */ - public boolean visit(CefWebPluginInfo info, int count, int total); -} diff --git a/wizard-browser/src/main/java/org/cef/callback/CefWebPluginUnstableCallback.java b/wizard-browser/src/main/java/org/cef/callback/CefWebPluginUnstableCallback.java deleted file mode 100644 index c358ff9..0000000 --- a/wizard-browser/src/main/java/org/cef/callback/CefWebPluginUnstableCallback.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.callback; - -/** - * Interface to implement for receiving unstable plugin information. The methods - * of this class will be called on the browser process IO thread. - */ -public interface CefWebPluginUnstableCallback { - /** - * Method that will be called for the requested plugin. |unstable| will be - * true if the plugin has reached the crash count threshold of 3 times in 120 - * seconds. - */ - public void isUnstable(String path, boolean unstable); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefAppHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefAppHandler.java deleted file mode 100644 index 2891880..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefAppHandler.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.CefApp.CefAppState; -import org.cef.callback.CefCommandLine; -import org.cef.callback.CefSchemeRegistrar; - -/** - * Implement this interface to provide handler implementations. Methods will be - * called by the process and/or thread indicated. - */ -public interface CefAppHandler { - /** - * Provides an opportunity to view and/or modify command-line arguments before - * processing by CEF and Chromium. The |process_type| value will be empty for - * the browser process. Be cautious when using this method to modify - * command-line arguments for non-browser processes as this may result in - * undefined behavior including crashes. - * @param process_type type of process (empty for browser process). - * @param command_line values of the command line. - */ - public void onBeforeCommandLineProcessing(String process_type, CefCommandLine command_line); - - /** - * Provides an opportunity to hook into the native shutdown process. This - * method is invoked if the user tries to terminate the app by sending the - * corresponding key code (e.g. on Mac: CMD+Q) or something similar. If you - * want to proceed with the default behavior of the native system, return - * false. If you want to abort the terminate or if you want to implement your - * own shutdown sequence return true and do the cleanup on your own. - * @return false to proceed with the default behavior, true to abort - * terminate. - */ - public boolean onBeforeTerminate(); - - /** - * Implement this method to get state changes of the CefApp. - * See {@link CefAppState} for a complete list of possible states. - * - * For example, this method can be used e.g. to get informed if CefApp has - * completed its initialization or its shutdown process. - * - * @param state The current state of CefApp. - */ - public void stateHasChanged(CefAppState state); - - /** - * Provides an opportunity to register custom schemes. Do not keep a reference - * to the |registrar| object. This method is called on the main thread for - * each process and the registered schemes should be the same across all - * processes. - */ - public void onRegisterCustomSchemes(CefSchemeRegistrar registrar); - - // Inherited of CefBrowserProcessHandler - /** - * Called on the browser process UI thread immediately after the CEF context - * has been initialized. - */ - public void onContextInitialized(); - - /** - * Return the handler for printing on Linux. If a print handler is not - * provided then printing will not be supported on the Linux platform. - * - * @return a reference to a print handler implementation - */ - public CefPrintHandler getPrintHandler(); - - /** - * Called from any thread when work has been scheduled for the browser process - * main (UI) thread. This callback should schedule a - * CefApp.DoMessageLoopWork() call to happen on the main (UI) thread. - * |delay_ms| is the requested delay in milliseconds. If |delay_ms| is <= 0 - * then the call should happen reasonably soon. If |delay_ms| is > 0 then the - * call should be scheduled to happen after the specified delay and any - * currently pending scheduled call should be cancelled. - */ - public void onScheduleMessagePumpWork(long delay_ms); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefAppHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefAppHandlerAdapter.java deleted file mode 100644 index c1e7063..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefAppHandlerAdapter.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.CefApp; -import org.cef.CefApp.CefAppState; -import org.cef.callback.CefCommandLine; -import org.cef.callback.CefSchemeRegistrar; - -/** - * An abstract adapter class for managing app handler events. - * The methods in this class are using a default implementation. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefAppHandlerAdapter implements CefAppHandler { - private String[] args_; - - public CefAppHandlerAdapter(String[] args) { - args_ = args; - } - - @Override - public void onBeforeCommandLineProcessing(String process_type, CefCommandLine command_line) { - if (process_type.isEmpty() && args_ != null) { - // Forward switches and arguments from Java to Cef - boolean parseSwitchesDone = false; - for (String arg : args_) { - if (parseSwitchesDone || arg.length() < 2) { - command_line.appendArgument(arg); - continue; - } - // Arguments with '--', '-' and, on Windows, '/' prefixes are considered switches. - int switchCnt = arg.startsWith("--") - ? 2 - : arg.startsWith("/") ? 1 : arg.startsWith("-") ? 1 : 0; - switch (switchCnt) { - case 2: - // An argument of "--" will terminate switch parsing with all subsequent - // tokens - if (arg.length() == 2) { - parseSwitchesDone = true; - continue; - } - // FALL THRU - case 1: { - // Switches can optionally have a value specified using the '=' delimiter - // (e.g. "-switch=value"). - String[] switchVals = arg.substring(switchCnt).split("="); - if (switchVals.length == 2) { - command_line.appendSwitchWithValue(switchVals[0], switchVals[1]); - } else { - command_line.appendSwitch(switchVals[0]); - } - break; - } - case 0: - command_line.appendArgument(arg); - break; - } - } - } - } - - @Override - public boolean onBeforeTerminate() { - // The default implementation does nothing - return false; - } - - @Override - public void stateHasChanged(CefAppState state) { - // The default implementation does nothing - } - - @Override - public void onRegisterCustomSchemes(CefSchemeRegistrar registrar) { - // The default implementation does nothing - } - - @Override - public void onContextInitialized() { - // The default implementation does nothing - } - - @Override - public CefPrintHandler getPrintHandler() { - // The default implementation does nothing - return null; - } - - @Override - public void onScheduleMessagePumpWork(long delay_ms) { - CefApp.getInstance().doMessageLoopWork(delay_ms); - } -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefClientHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefClientHandler.java deleted file mode 100644 index 1f8f610..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefClientHandler.java +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.util.HashMap; -import java.util.Vector; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefMessageRouter; -import org.cef.callback.CefNative; - -/** - * Implement this interface to provide handler implementations. - */ -public abstract class CefClientHandler implements CefNative { - // Used internally to store a pointer to the CEF object. - private HashMap N_CefHandle = new HashMap(); - private Vector msgRouters = new Vector<>(); - - @Override - public void setNativeRef(String identifer, long nativeRef) { - synchronized (N_CefHandle) { - N_CefHandle.put(identifer, nativeRef); - } - } - - @Override - public long getNativeRef(String identifer) { - synchronized (N_CefHandle) { - if (N_CefHandle.containsKey(identifer)) return N_CefHandle.get(identifer); - } - return 0; - } - - public CefClientHandler() { - try { - N_CefClientHandler_CTOR(); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void dispose() { - try { - // Call native DTOR if handler will be destroyed - for (int i = 0; i < msgRouters.size(); i++) { - msgRouters.get(i).dispose(); - } - msgRouters.clear(); - - N_CefClientHandler_DTOR(); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - /** - * Returns the java part of the browser implementation. - * @param identifer the unique identifier of the browser. - * @return The found browser or null if none is found. - */ - abstract protected CefBrowser getBrowser(int identifier); - - /** - * Returns a list of all browser instances. - * @return an array of browser Instances. - */ - abstract protected Object[] getAllBrowser(); - - /** - * Return the handler for context menus. If no handler is provided the - * default implementation will be used. - */ - abstract protected CefContextMenuHandler getContextMenuHandler(); - - /** - * Return the handler for dialogs. If no handler is provided the - * default implementation will be used. - */ - abstract protected CefDialogHandler getDialogHandler(); - - /** - * Return the handler for browser display state events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefDisplayHandler getDisplayHandler(); - - /** - * Return the handler for download events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefDownloadHandler getDownloadHandler(); - - /** - * Return the handler for drag events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefDragHandler getDragHandler(); - - /** - * Return the handler for focus events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefFocusHandler getFocusHandler(); - - /** - * Return the handler for geolocation requests. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefGeolocationHandler getGeolocationHandler(); - - /** - * Return the handler for javascript dialog requests. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefJSDialogHandler getJSDialogHandler(); - - /** - * Return the handler for keyboard events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefKeyboardHandler getKeyboardHandler(); - - /** - * Return the handler for browser life span events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefLifeSpanHandler getLifeSpanHandler(); - - /** - * Return the handler for browser load status events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefLoadHandler getLoadHandler(); - - /** - * Return the handler for off-screen rendering events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefRenderHandler getRenderHandler(); - - /** - * Return the handler for browser request events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefRequestHandler getRequestHandler(); - - /** - * Return the handler for windowed rendering events. - * This method is a callback method and is called by - * the native code. - */ - abstract protected CefWindowHandler getWindowHandler(); - - protected synchronized void addMessageRouter(CefMessageRouter h) { - try { - msgRouters.add(h); - N_addMessageRouter(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeContextMenuHandler(CefContextMenuHandler h) { - try { - N_removeContextMenuHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeDialogHandler(CefDialogHandler h) { - try { - N_removeDialogHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeDisplayHandler(CefDisplayHandler h) { - try { - N_removeDisplayHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeDownloadHandler(CefDisplayHandler h) { - try { - N_removeDownloadHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeDragHandler(CefDragHandler h) { - try { - N_removeDragHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeFocusHandler(CefFocusHandler h) { - try { - N_removeFocusHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeGeolocationHandler(CefGeolocationHandler h) { - try { - N_removeGeolocationHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeJSDialogHandler(CefJSDialogHandler h) { - try { - N_removeJSDialogHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeKeyboardHandler(CefKeyboardHandler h) { - try { - N_removeKeyboardHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeLifeSpanHandler(CefLifeSpanHandler h) { - try { - N_removeLifeSpanHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeLoadHandler(CefLoadHandler h) { - try { - N_removeLoadHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected synchronized void removeMessageRouter(CefMessageRouter h) { - try { - msgRouters.remove(h); - N_removeMessageRouter(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeRenderHandler(CefRenderHandler h) { - try { - N_removeRenderHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeRequestHandler(CefRequestHandler h) { - try { - N_removeRequestHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - protected void removeWindowHandler(CefWindowHandler h) { - try { - N_removeWindowHandler(h); - } catch (UnsatisfiedLinkError err) { - err.printStackTrace(); - } - } - - private final native void N_CefClientHandler_CTOR(); - private final native void N_addMessageRouter(CefMessageRouter h); - private final native void N_removeContextMenuHandler(CefContextMenuHandler h); - private final native void N_removeDialogHandler(CefDialogHandler h); - private final native void N_removeDisplayHandler(CefDisplayHandler h); - private final native void N_removeDownloadHandler(CefDisplayHandler h); - private final native void N_removeDragHandler(CefDragHandler h); - private final native void N_removeFocusHandler(CefFocusHandler h); - private final native void N_removeGeolocationHandler(CefGeolocationHandler h); - private final native void N_removeJSDialogHandler(CefJSDialogHandler h); - private final native void N_removeKeyboardHandler(CefKeyboardHandler h); - private final native void N_removeLifeSpanHandler(CefLifeSpanHandler h); - private final native void N_removeLoadHandler(CefLoadHandler h); - private final native void N_removeMessageRouter(CefMessageRouter h); - private final native void N_removeRenderHandler(CefRenderHandler h); - private final native void N_removeRequestHandler(CefRequestHandler h); - private final native void N_removeWindowHandler(CefWindowHandler h); - private final native void N_CefClientHandler_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefContextMenuHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefContextMenuHandler.java deleted file mode 100644 index 14237c4..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefContextMenuHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.callback.CefContextMenuParams; -import org.cef.callback.CefMenuModel; - -/** - * Implement this interface to handle context menu events. The methods of this - * class will be called on the UI thread. - */ -public interface CefContextMenuHandler { - /** - * Supported event bit flags. - */ - public static final class EventFlags { - public final static int EVENTFLAG_NONE = 0; - public final static int EVENTFLAG_CAPS_LOCK_ON = 1 << 0; - public final static int EVENTFLAG_SHIFT_DOWN = 1 << 1; - public final static int EVENTFLAG_CONTROL_DOWN = 1 << 2; - public final static int EVENTFLAG_ALT_DOWN = 1 << 3; - public final static int EVENTFLAG_LEFT_MOUSE_BUTTON = 1 << 4; - public final static int EVENTFLAG_MIDDLE_MOUSE_BUTTON = 1 << 5; - public final static int EVENTFLAG_RIGHT_MOUSE_BUTTON = 1 << 6; - // Mac OS-X command key. - public final static int EVENTFLAG_COMMAND_DOWN = 1 << 7; - public final static int EVENTFLAG_NUM_LOCK_ON = 1 << 8; - public final static int EVENTFLAG_IS_KEY_PAD = 1 << 9; - public final static int EVENTFLAG_IS_LEFT = 1 << 10; - public final static int EVENTFLAG_IS_RIGHT = 1 << 11; - } - - /** - * Called before a context menu is displayed. - * - * @param browser The corresponding browser. - * @param frame The corresponding frame. - * @param params provides information about the context menu state. - * @param model can be cleared to show no context menu or modified - * to show a custom menu. - */ - public void onBeforeContextMenu( - CefBrowser browser, CefFrame frame, CefContextMenuParams params, CefMenuModel model); - - /** - * Called to execute a command selected from the context menu. Return true if - * the command was handled or false for the default implementation. See - * cef_menu_id_t for the command ids that have default implementations. All - * user-defined command ids should be between MENU_ID_USER_FIRST and - * - * @param browser The corresponding browser. - * @param frame The corresponding frame. - * @param params Will have the same values as what was passed to onBeforeContextMenu(). - * @param commandId The id of the command. - * @param eventFlags A combination of event flags defined in EventFlags - * @return true if the command was handled or false for the default implementation. - */ - public boolean onContextMenuCommand(CefBrowser browser, CefFrame frame, - CefContextMenuParams params, int commandId, int eventFlags); - - /** - * Called when the context menu is dismissed irregardless of whether the menu - * was empty or a command was selected. - * - * @param browser The corresponding browser. - * @param frame The corresponding frame. - */ - public void onContextMenuDismissed(CefBrowser browser, CefFrame frame); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefContextMenuHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefContextMenuHandlerAdapter.java deleted file mode 100644 index 1b4557c..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefContextMenuHandlerAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.callback.CefContextMenuParams; -import org.cef.callback.CefMenuModel; - -/** - * An abstract adapter class for receiving context menu events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefContextMenuHandlerAdapter implements CefContextMenuHandler { - @Override - public void onBeforeContextMenu( - CefBrowser browser, CefFrame frame, CefContextMenuParams params, CefMenuModel model) {} - - @Override - public boolean onContextMenuCommand(CefBrowser browser, CefFrame frame, - CefContextMenuParams params, int commandId, int eventFlags) { - return false; - } - - @Override - public void onContextMenuDismissed(CefBrowser browser, CefFrame frame) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefDialogHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefDialogHandler.java deleted file mode 100644 index 0355168..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefDialogHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.util.Vector; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefFileDialogCallback; - -/** - * Implement this interface to handle dialog events. The methods of this class - * will be called on the browser process UI thread. - */ -public interface CefDialogHandler { - /** - * Supported file dialog modes. - */ - enum FileDialogMode { - FILE_DIALOG_OPEN, //!< Requires that the file exists before allowing the user to pick it. - FILE_DIALOG_OPEN_MULTIPLE, //!< Like Open, but allows picking multiple files to open. - FILE_DIALOG_SAVE //!< Allows picking a nonexistent file, and prompts to overwrite if the - //! file already exists. - } - - /** - * Called to run a file chooser dialog. - * - * @param browser - * @param mode represents the type of dialog to display. - * @param title to be used for the dialog and may be empty to show the default - * title ("Open" or "Save" depending on the mode). - * @param defaultFilePath is the path with optional directory and/or file name - * component that should be initially selected in the dialog. - * @param acceptFilters are used to restrict the selectable file types and may - * any combination of (a) valid lower-cased MIME types (e.g. "text/*" or - * "image/*"), (b) individual file extensions (e.g. ".txt" or ".png"), or (c) - * combined description and file extension delimited using "|" and ";" (e.g. - * "Image Types|.png;.gif;.jpg"). - * @param selectedAcceptFilter is the 0-based index of the filter that should - * be selected by default. - * @param callback is a callback handler for handling own file dialogs. - * - * @return To display a custom dialog return true and execute callback. - * To display the default dialog return false. - */ - public boolean onFileDialog(CefBrowser browser, FileDialogMode mode, String title, - String defaultFilePath, Vector acceptFilters, int selectedAcceptFilter, - CefFileDialogCallback callback); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefDisplayHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefDisplayHandler.java deleted file mode 100644 index 4ade74a..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefDisplayHandler.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; - -/** - * Implement this interface to handle events related to browser display state. - * The methods of this class will be called on the UI thread. - */ -public interface CefDisplayHandler { - /** - * Handle address changes. - * @param browser The browser generating the event. - * @param frame The frame generating the event. - * @param url The new address. - */ - public void onAddressChange(CefBrowser browser, CefFrame frame, String url); - - /** - * Handle title changes. - * @param browser The browser generating the event. - * @param title The new title. - */ - public void onTitleChange(CefBrowser browser, String title); - - /** - * Called when the browser is about to display a tooltip. - * - * @param browser The browser generating the event. - * @param text Contains the text that will be displayed in the tooltip. - * @return To handle the display of the tooltip yourself return true. - */ - public boolean onTooltip(CefBrowser browser, String text); - - /** - * Called when the browser receives a status message. - * - * @param browser The browser generating the event. - * @param value Contains the text that will be displayed in the status message. - */ - public void onStatusMessage(CefBrowser browser, String value); - - /** - * Called to display a console message. - * - * @param browser The browser generating the event. - * @param message - * @param source - * @param line - * @return true to stop the message from being output to the console. - */ - public boolean onConsoleMessage(CefBrowser browser, String message, String source, int line); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefDisplayHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefDisplayHandlerAdapter.java deleted file mode 100644 index 47219c4..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefDisplayHandlerAdapter.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; - -/** - * An abstract adapter class for receiving display events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefDisplayHandlerAdapter implements CefDisplayHandler { - @Override - public void onAddressChange(CefBrowser browser, CefFrame frame, String url) { - return; - } - - @Override - public void onTitleChange(CefBrowser browser, String title) { - return; - } - - @Override - public boolean onTooltip(CefBrowser browser, String text) { - return false; - } - - @Override - public void onStatusMessage(CefBrowser browser, String value) { - return; - } - - @Override - public boolean onConsoleMessage(CefBrowser browser, String message, String source, int line) { - return false; - } -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefDownloadHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefDownloadHandler.java deleted file mode 100644 index 3e99051..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefDownloadHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefBeforeDownloadCallback; -import org.cef.callback.CefDownloadItem; -import org.cef.callback.CefDownloadItemCallback; - -/** - * Implement this interface to handle file downloads. The methods of this class - * will called on the browser process UI thread. - */ -public interface CefDownloadHandler { - /** - * Called before a download begins. By default the download will be canceled. - * Execute callback either asynchronously or in this method to continue the download - * if desired. - * - * @param browser The desired browser. - * @param downloadItem The item to be downloaded. Do not keep a reference to it outside this - * method. - * @param suggestedName is the suggested name for the download file. - * @param callback start the download by calling the Continue method - */ - public void onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem, - String suggestedName, CefBeforeDownloadCallback callback); - - /** - * Called when a download's status or progress information has been updated. - * @param browser The desired browser. - * @param downloadItem The downloading item. - * @param callback Execute callback to cancel the download - */ - public void onDownloadUpdated( - CefBrowser browser, CefDownloadItem downloadItem, CefDownloadItemCallback callback); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefDownloadHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefDownloadHandlerAdapter.java deleted file mode 100644 index 8b1f46a..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefDownloadHandlerAdapter.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefBeforeDownloadCallback; -import org.cef.callback.CefDownloadItem; -import org.cef.callback.CefDownloadItemCallback; - -/** - * An abstract adapter class for receiving download events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefDownloadHandlerAdapter implements CefDownloadHandler { - @Override - public void onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem, - String suggestedName, CefBeforeDownloadCallback callback) {} - - @Override - public void onDownloadUpdated( - CefBrowser browser, CefDownloadItem downloadItem, CefDownloadItemCallback callback) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefDragHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefDragHandler.java deleted file mode 100644 index f5fe418..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefDragHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefDragData; - -/** - * Implement this interface to handle events related to dragging. The methods of - * this class will be called on the UI thread. - */ -public interface CefDragHandler { - /** - * - */ - public static final class DragOperationMask { - public static final int DRAG_OPERATION_NONE = 0; - public static final int DRAG_OPERATION_COPY = 1; - public static final int DRAG_OPERATION_LINK = 2; - public static final int DRAG_OPERATION_GENERIC = 4; - public static final int DRAG_OPERATION_PRIVATE = 8; - public static final int DRAG_OPERATION_MOVE = 16; - public static final int DRAG_OPERATION_DELETE = 32; - public static final int DRAG_OPERATION_EVERY = Integer.MAX_VALUE; - } - - /** - * Called when an external drag event enters the browser window. - * - * @param browser The corresponding browser. - * @param dragData contains the drag event data - * @param mask represents the type of drag operation. See DragOperationMask for possible values. - * @return false for default drag handling behavior or true to - * cancel the drag event. - */ - public boolean onDragEnter(CefBrowser browser, CefDragData dragData, int mask); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefFocusHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefFocusHandler.java deleted file mode 100644 index 57a9327..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefFocusHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; - -/** - * Implement this interface to handle events related to focus. The methods of - * this class will be called on the UI thread. - */ -public interface CefFocusHandler { - /** - * Focus sources. - */ - enum FocusSource { - FOCUS_SOURCE_NAVIGATION, //!< The source is explicit navigation via the API (LoadURL(), - //! etc). - FOCUS_SOURCE_SYSTEM //!< The source is a system-generated focus event. - } - - /** - * Called when the browser component is about to loose focus. - * For instance, if focus was on the last HTML element and the - * user pressed the TAB key. - * @param browser The browser generating the event. - * @param next will be true if the browser is giving focus to the - * next component and false if the browser is giving focus - * to the previous component. - */ - public void onTakeFocus(CefBrowser browser, boolean next); - - /** - * Called when the browser component is requesting focus. - * @param browser The browser generating the event. - * @param source indicates/ where the focus request is originating from. - * - * @return false to allow the focus to be set or true to cancel setting the focus. - */ - public boolean onSetFocus(CefBrowser browser, FocusSource source); - - /** - * Called when the browser component has received focus. - * @param browser The browser generating the event. - */ - public void onGotFocus(CefBrowser browser); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefFocusHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefFocusHandlerAdapter.java deleted file mode 100644 index 9936b19..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefFocusHandlerAdapter.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; - -/** - * An abstract adapter class for receiving focus events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefFocusHandlerAdapter implements CefFocusHandler { - @Override - public void onTakeFocus(CefBrowser browser, boolean next) { - return; - } - - @Override - public boolean onSetFocus(CefBrowser browser, FocusSource source) { - return false; - } - - @Override - public void onGotFocus(CefBrowser browser) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefGeolocationHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefGeolocationHandler.java deleted file mode 100644 index 0185c05..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefGeolocationHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefGeolocationCallback; - -/** - * Implement this interface to handle events related to geolocation permission - * requests. The methods of this class will be called on the browser process IO - * thread. - */ -public interface CefGeolocationHandler { - /** - * Called when a page requests permission to access geolocation information. - * Return true and call CefGeolocationCallback.Continue() either in this - * method or at a later time to continue or cancel the request. - * Return false to cancel the request immediately. - * @param browser The corresponding browser. - * @param requesting_url is the URL requesting permission. - * @param request_id is the unique ID for the permission request. - * @param callback Call CefGeolocationCallback.Continue to allow or deny the - * permission request. - */ - public boolean onRequestGeolocationPermission(CefBrowser browser, String requesting_url, - int request_id, CefGeolocationCallback callback); - - /** - * Called when a geolocation access request is canceled. - * @param browser The corresponding browser. - * @param request_id is the unique ID for the permission request. - */ - public void onCancelGeolocationPermission(CefBrowser browser, int request_id); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefGeolocationHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefGeolocationHandlerAdapter.java deleted file mode 100644 index 2a6ddb8..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefGeolocationHandlerAdapter.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefGeolocationCallback; - -/** - * An abstract adapter class for receiving geolocation requests. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefGeolocationHandlerAdapter implements CefGeolocationHandler { - @Override - public boolean onRequestGeolocationPermission(CefBrowser browser, String requesting_url, - int request_id, CefGeolocationCallback callback) { - return false; - } - - @Override - public void onCancelGeolocationPermission(CefBrowser browser, int request_id) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefJSDialogHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefJSDialogHandler.java deleted file mode 100644 index 5a8085c..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefJSDialogHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefJSDialogCallback; -import org.cef.misc.BoolRef; - -/** - * Implement this interface to handle events related to JavaScript dialogs. The - * methods of this class will be called on the UI thread. - */ -public interface CefJSDialogHandler { - /** - * Supported JavaScript dialog types. - */ - public static enum JSDialogType { - JSDIALOGTYPE_ALERT, - JSDIALOGTYPE_CONFIRM, - JSDIALOGTYPE_PROMPT, - } - - /** - * Called to run a JavaScript dialog. Set suppress_message to true and - * return false to suppress the message (suppressing messages is preferable - * to immediately executing the callback as this is used to detect presumably - * malicious behavior like spamming alert messages in onbeforeunload). Set - * suppress_message to false and return false to use the default - * implementation (the default implementation will show one modal dialog at a - * time and suppress any additional dialog requests until the displayed dialog - * is dismissed). Return true if the application will use a custom dialog or - * if the callback has been executed immediately. Custom dialogs may be either - * modal or modeless. If a custom dialog is used the application must execute - * callback once the custom dialog is dismissed. - * - * @param browser The corresponding browser. - * @param origin_url The originating url. - * @param dialog_type the dialog type. - * @param message_text the text to be displayed. - * @param default_prompt_text value will be specified for prompt dialogs only. - * @param callback execute callback once the custom dialog is dismissed. - * @param suppress_message set to true to suppress displaying the message. - * @return false to use the default dialog implementation. Return true if the - * application will use a custom dialog. - */ - public boolean onJSDialog(CefBrowser browser, String origin_url, JSDialogType dialog_type, - String message_text, String default_prompt_text, CefJSDialogCallback callback, - BoolRef suppress_message); - - /** - * Called to run a dialog asking the user if they want to leave a page. Return - * false to use the default dialog implementation. Return true if the - * application will use a custom dialog or if the callback has been executed - * immediately. Custom dialogs may be either modal or modeless. If a custom - * dialog is used the application must execute callback once the custom - * dialog is dismissed. - * - * @param browser The corresponding browser. - * @param message_text The text to be displayed. - * @param is_reload true if the page is reloaded. - * @param callback execute callback once the custom dialog is dismissed. - * @return false to use the default dialog implementation. Return true if the - * application will use a custom dialog. - */ - public boolean onBeforeUnloadDialog(CefBrowser browser, String message_text, boolean is_reload, - CefJSDialogCallback callback); - - /** - * Called to cancel any pending dialogs and reset any saved dialog state. Will - * be called due to events like page navigation irregardless of whether any - * dialogs are currently pending. - */ - public void onResetDialogState(CefBrowser browser); - - /** - * Called when the default implementation dialog is closed. - */ - public void onDialogClosed(CefBrowser browser); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefJSDialogHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefJSDialogHandlerAdapter.java deleted file mode 100644 index 4bbad36..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefJSDialogHandlerAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefJSDialogCallback; -import org.cef.misc.BoolRef; - -/** - * An abstract adapter class for receiving javascript dialog requests. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefJSDialogHandlerAdapter implements CefJSDialogHandler { - @Override - public boolean onJSDialog(CefBrowser browser, String origin_url, JSDialogType dialog_type, - String message_text, String default_prompt_text, CefJSDialogCallback callback, - BoolRef suppress_message) { - return false; - } - - @Override - public boolean onBeforeUnloadDialog(CefBrowser browser, String message_text, boolean is_reload, - CefJSDialogCallback callback) { - return false; - } - - @Override - public void onResetDialogState(CefBrowser browser) {} - - @Override - public void onDialogClosed(CefBrowser browser) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefKeyboardHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefKeyboardHandler.java deleted file mode 100644 index 72027b8..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefKeyboardHandler.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.misc.BoolRef; - -/** - * Implement this interface to handle events related to keyboard input. The - * methods of this class will be called on the UI thread. - */ -public interface CefKeyboardHandler { - /** - * Structure representing keyboard event information. - */ - public static final class CefKeyEvent { - /** - * Key event types. - */ - public static enum EventType { - /** - * Notification that a key transitioned from "up" to "down" - */ - KEYEVENT_RAWKEYDOWN, - - /** - * Notification that a key was pressed. This does not necessarily - * correspond to a character depending on the key and language. Use - * KEYEVENT_CHAR for character input. - */ - KEYEVENT_KEYDOWN, - - /** - * Notification that a key was released - */ - KEYEVENT_KEYUP, - - /** - * Notification that a character was typed. Use this for text input. Key - * down events may generate 0, 1, or more than one character event - * depending on the key, locale, and operating system. - */ - KEYEVENT_CHAR - } - - CefKeyEvent(EventType typeAttr, int modifiersAttr, int windows_key_codeAttr, - int native_key_codeAttr, boolean is_system_keyAttr, char characterAttr, - char unmodified_characterAttr, boolean focus_on_editable_fieldAttr) { - type = typeAttr; - modifiers = modifiersAttr; - windows_key_code = windows_key_codeAttr; - native_key_code = native_key_codeAttr; - is_system_key = is_system_keyAttr; - character = characterAttr; - unmodified_character = unmodified_characterAttr; - focus_on_editable_field = focus_on_editable_fieldAttr; - } - - /** - * The type of keyboard event. - */ - public final EventType type; - - /** - * Bit flags describing any pressed modifier keys. - * @see org.cef.handler.CefContextMenuHandler.EventFlags for values. - */ - public final int modifiers; - - /** - * The Windows key code for the key event. This value is used by the DOM - * specification. Sometimes it comes directly from the event (i.e. on - * Windows) and sometimes it's determined using a mapping function. See - * WebCore/platform/chromium/KeyboardCodes.h for the list of values. - */ - public final int windows_key_code; - - /** - * The actual key code genenerated by the platform. - */ - public final int native_key_code; - - /** - * Indicates whether the event is considered a "system key" event (see - * http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details). - * This value will always be false on non-Windows platforms. - */ - public final boolean is_system_key; - - /** - * The character generated by the keystroke. - */ - public final char character; - - /** - * Same as character but unmodified by any concurrently-held modifiers - * (except shift). This is useful for working out shortcut keys. - **/ - public final char unmodified_character; - - /** - * True if the focus is currently on an editable field on the page. This is - * useful for determining if standard key events should be intercepted. - */ - public final boolean focus_on_editable_field; - - @Override - public String toString() { - return "CefKeyEvent [type=" + type + ", modifiers=" + modifiers - + ", windows_key_code=" + windows_key_code - + ", native_key_code=" + native_key_code + ", is_system_key=" + is_system_key - + ", character=" + character + ", unmodified_character=" + unmodified_character - + ", focus_on_editable_field=" + focus_on_editable_field + "]"; - } - } - - /** - * Called before a keyboard event is sent to the renderer. - * - * @param browser the corresponding browser. - * @param event contains information about the keyboard event. - * @param is_keyboard_shortcut set to true and return false, if - * the event will be handled in OnKeyEvent() as a keyboard shortcut. - * @return true if the event was handled or false otherwise. - */ - public boolean onPreKeyEvent( - CefBrowser browser, CefKeyEvent event, BoolRef is_keyboard_shortcut); - - /** - * Called after the renderer and JavaScript in the page has had a chance to - * handle the event. - * - * @param browser the corresponding browser. - * @param event contains information about the keyboard event. - * @return true if the keyboard event was handled or false otherwise. - */ - public boolean onKeyEvent(CefBrowser browser, CefKeyEvent event); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefKeyboardHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefKeyboardHandlerAdapter.java deleted file mode 100644 index af37023..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefKeyboardHandlerAdapter.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.misc.BoolRef; - -/** - * An abstract adapter class for receiving keyboard events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefKeyboardHandlerAdapter implements CefKeyboardHandler { - @Override - public boolean onPreKeyEvent( - CefBrowser browser, CefKeyEvent event, BoolRef is_keyboard_shortcut) { - return false; - } - - @Override - public boolean onKeyEvent(CefBrowser browser, CefKeyEvent event) { - return false; - } -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefLifeSpanHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefLifeSpanHandler.java deleted file mode 100644 index bb90605..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefLifeSpanHandler.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; - -/** - * Implement this interface to handle events related to browser life span. The - * methods of this class will be called on the UI thread unless otherwise - * indicated. - */ -public interface CefLifeSpanHandler { - /** - * Called on the IO thread before a new popup window is created. The |browser| - * and |frame| parameters represent the source of the popup request. The - * |target_url| and |target_frame_name| values may be empty if none were - * specified with the request. The |popupFeatures| structure contains - * information about the requested popup window. To allow creation of the - * popup window optionally modify |windowInfo|, |client|, |settings| and - * |no_javascript_access| and return false. To cancel creation of the popup - * window return true. The |client| and |settings| values will default to the - * source browser's values. The |no_javascript_access| value indicates whether - * the new browser window should be scriptable and in the same process as the - * source browser. - * - * @param browser The source of the popup request. - * @param frame The source of the popup request. - * @param target_url May be empty if none is specified with the request. - * @param target_frame_name May be empty if none is specified with the request. - * @param target_disposition Indicates where the user intended to open - * the popup (e.g. current tab, new tab, etc). - * @param user_gesture Will be true if the popup was opened via explicit user - * gesture (e.g. clicking a link) or false if the popup opened automatically - * (e.g. via the DomContentLoaded event). - * @param popupFeatures Contains information about the requested popup window - * @param windowInfo Can be modified. - * @param client Can be modified. - * @param settings Can be modified. - * @param no_javascript_access Can be modified. - * @return To cancel creation of the popup window return true. - */ - // TODO(jcef) forward all params form JNI to Java (the commented out ones) - boolean onBeforePopup( - CefBrowser browser, CefFrame frame, String target_url, String target_frame_name - // WindowOpenDisposition target_disposition, - // bool user_gesture, - // CefPopupFeatures popupFeatures, - // CefWindowInfo windowInfo, - // CefClient client, - // CefBrowserSettings settings, - // boolean no_javascript_access - ); - - /** - * Handle creation of a new browser window. - * @param browser The browser generating the event. - */ - public void onAfterCreated(CefBrowser browser); - - /** - * Called when a browser has received a request to close. - * - * If CEF created an OS window for the browser returning false will send an OS - * close notification to the browser window's top-level owner (e.g. WM_CLOSE - * on Windows, performClose: on OS-X and "delete_event" on Linux). If no OS - * window exists (window rendering disabled) returning false will cause the - * browser object to be destroyed immediately. Return true if the browser is - * parented to another window and that other window needs to receive close - * notification via some non-standard technique. - * - * @param browser The browser generating the event. - * @return false will send an OS close notification to the browser window's top-level owner. - */ - public boolean doClose(CefBrowser browser); - - /** - * Called just before a browser is destroyed. - * - * Release all references to the - * browser object and do not attempt to execute any methods on the browser - * object after this callback returns. If this is a modal window and a custom - * modal loop implementation was provided in runModal() this callback should - * be used to exit the custom modal loop. See doClose() documentation for - * additional usage information. - * - * @param browser The browser generating the event. - */ - void onBeforeClose(CefBrowser browser); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefLifeSpanHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefLifeSpanHandlerAdapter.java deleted file mode 100644 index c5409c7..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefLifeSpanHandlerAdapter.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; - -/** - * An abstract adapter class for receiving life span events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefLifeSpanHandlerAdapter implements CefLifeSpanHandler { - @Override - public boolean onBeforePopup( - CefBrowser browser, CefFrame frame, String target_url, String target_frame_name) { - return false; - } - - @Override - public void onAfterCreated(CefBrowser browser) {} - - @Override - public boolean doClose(CefBrowser browser) { - return false; - } - - @Override - public void onBeforeClose(CefBrowser browser) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefLoadHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefLoadHandler.java deleted file mode 100644 index 2d0e3b7..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefLoadHandler.java +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.util.HashMap; -import java.util.Map; -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.network.CefRequest.TransitionType; - -/** - * Implement this interface to handle events related to browser load status. - */ -public interface CefLoadHandler { - enum ErrorCode { - ERR_NONE(0), - ERR_FAILED(-2), - ERR_ABORTED(-3), - ERR_INVALID_ARGUMENT(-4), - ERR_INVALID_HANDLE(-5), - ERR_FILE_NOT_FOUND(-6), - ERR_TIMED_OUT(-7), - ERR_FILE_TOO_BIG(-8), - ERR_UNEXPECTED(-9), - ERR_ACCESS_DENIED(-10), - ERR_NOT_IMPLEMENTED(-11), - ERR_CONNECTION_CLOSED(-100), - ERR_CONNECTION_RESET(-101), - ERR_CONNECTION_REFUSED(-102), - ERR_CONNECTION_ABORTED(-103), - ERR_CONNECTION_FAILED(-104), - ERR_NAME_NOT_RESOLVED(-105), - ERR_INTERNET_DISCONNECTED(-106), - ERR_SSL_PROTOCOL_ERROR(-107), - ERR_ADDRESS_INVALID(-108), - ERR_ADDRESS_UNREACHABLE(-109), - ERR_SSL_CLIENT_AUTH_CERT_NEEDED(-110), - ERR_TUNNEL_CONNECTION_FAILED(-111), - ERR_NO_SSL_VERSIONS_ENABLED(-112), - ERR_SSL_VERSION_OR_CIPHER_MISMATCH(-113), - ERR_SSL_RENEGOTIATION_REQUESTED(-114), - ERR_CERT_COMMON_NAME_INVALID(-200), - ERR_CERT_BEGIN(-200), // same as ERR_CERT_COMMON_NAME_INVALID - ERR_CERT_DATE_INVALID(-201), - ERR_CERT_AUTHORITY_INVALID(-202), - ERR_CERT_CONTAINS_ERRORS(-203), - ERR_CERT_NO_REVOCATION_MECHANISM(-204), - ERR_CERT_UNABLE_TO_CHECK_REVOCATION(-205), - ERR_CERT_REVOKED(-206), - ERR_CERT_INVALID(-207), - ERR_CERT_WEAK_SIGNATURE_ALGORITHM(-208), - // -209 is available: was ERR_CERT_NOT_IN_DNS. - ERR_CERT_NON_UNIQUE_NAME(-210), - ERR_CERT_WEAK_KEY(-211), - ERR_CERT_NAME_CONSTRAINT_VIOLATION(-212), - ERR_CERT_VALIDITY_TOO_LONG(-213), - ERR_CERT_END(-213), // same as ERR_CERT_VALIDITY_TOO_LONG - ERR_INVALID_URL(-300), - ERR_DISALLOWED_URL_SCHEME(-301), - ERR_UNKNOWN_URL_SCHEME(-302), - ERR_TOO_MANY_REDIRECTS(-310), - ERR_UNSAFE_REDIRECT(-311), - ERR_UNSAFE_PORT(-312), - ERR_INVALID_RESPONSE(-320), - ERR_INVALID_CHUNKED_ENCODING(-321), - ERR_METHOD_NOT_SUPPORTED(-322), - ERR_UNEXPECTED_PROXY_AUTH(-323), - ERR_EMPTY_RESPONSE(-324), - ERR_RESPONSE_HEADERS_TOO_BIG(-325), - ERR_CACHE_MISS(-400), - ERR_INSECURE_RESPONSE(-501); - - static private final Map CODES = new HashMap<>(); - static { - for (ErrorCode ec : ErrorCode.values()) { - // only put first value into map (so enums listed first have - // priority over others for duplicate error code values) - if (!CODES.containsKey(ec.code)) { - CODES.put(ec.code, ec); - } - } - } - - private final int code; - - ErrorCode(int code) { - this.code = code; - } - - /** - * Gets the underlying native chrome embedded framework error code value - * as an integer. - * @return The error code as an integer - */ - public int getCode() { - return code; - } - - /** - * Finds the ErrorCode by the native chrome embedded framework integer-based - * error code value. - * @param code The integer-based raw error code - * @return The Java enum mapped to that error code or null if none was found - */ - static public ErrorCode findByCode(int code) { - return CODES.get(code); - } - } - - /** - * Called when the loading state has changed. This callback will be executed - * twice -- once when loading is initiated either programmatically or by user - * action, and once when loading is terminated due to completion, cancellation - * of failure. - * - * @param browser The affected browser. - * @param isLoading true if it is loading. - * @param canGoBack true if you can navigate back. - * @param canGoForward true if you can navigate forward. - */ - public void onLoadingStateChange( - CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward); - - /** - * Called when the browser begins loading a frame. The frameIdentifer value will - * never be empty. Multiple frames may be loading at the same time. Sub-frames may - * start or continue loading after the main frame load has ended. This method - * may not be called for a particular frame if the load request for that frame - * fails. For notification of overall browser load status use - * OnLoadingStateChange instead. - * - * @param browser The affected browser. - * @param frame The loading frame. - * @param transitionType The transition type - */ - public void onLoadStart(CefBrowser browser, CefFrame frame, TransitionType transitionType); - - /** - * Called when the browser is done loading a frame. The frameIdentifer value will - * never be empty. Multiple frames may be loading at the same time. Sub-frames may - * start or continue loading after the main frame load has ended. This method - * will always be called for all frames irrespective of whether the request - * completes successfully. - * - * @param browser The affected browser. - * @param frame The loading frame. - * @param httpStatusCode The status code of the load. - */ - public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode); - - /** - * Called when the resource load for a navigation fails or is canceled. - * - * @param browser The affected browser. - * @param frame The loading frame. - * @param errorCode The error code number. - * @param errorText The error text. - * @param failedUrl The URL that failed to load. - */ - public void onLoadError(CefBrowser browser, CefFrame frame, ErrorCode errorCode, - String errorText, String failedUrl); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefLoadHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefLoadHandlerAdapter.java deleted file mode 100644 index edbbae1..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefLoadHandlerAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.network.CefRequest.TransitionType; - -/** - * An abstract adapter class for receiving load events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefLoadHandlerAdapter implements CefLoadHandler { - @Override - public void onLoadingStateChange( - CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward) {} - - @Override - public void onLoadStart(CefBrowser browser, CefFrame frame, TransitionType transitionType) {} - - @Override - public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) {} - - @Override - public void onLoadError(CefBrowser browser, CefFrame frame, ErrorCode errorCode, - String errorText, String failedUrl) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefMessageRouterHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefMessageRouterHandler.java deleted file mode 100644 index 8eea291..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefMessageRouterHandler.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.callback.CefNative; -import org.cef.callback.CefQueryCallback; - -/** - * Implement this interface to handle queries. All methods will be executed on - * the browser process UI thread. - */ -public interface CefMessageRouterHandler extends CefNative { - /** - * Called when the browser receives a JavaScript query. - * @param browser The browser generating the event. - * @param frame The frame generating the event. - * @param query_id The unique ID for the query. - * @param persistent True if the query is persistent. - * @param callback Object used to continue or cancel the query asynchronously. - * - * @return true to handle the query or false to propagate the query to other - * registered handlers, if any. If no handlers return true from this method - * then the query will be automatically canceled with an error code of -1 - * delivered to the JavaScript onFailure callback. - */ - public boolean onQuery(CefBrowser browser, CefFrame frame, long query_id, String request, - boolean persistent, CefQueryCallback callback); - - /** - * Called when a pending JavaScript query is canceled. - * @param browser The browser generating the event. - * @param frame The frame generating the event. - * @param query_id The unique ID for the query. - */ - public void onQueryCanceled(CefBrowser browser, CefFrame frame, long query_id); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefMessageRouterHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefMessageRouterHandlerAdapter.java deleted file mode 100644 index 044b83f..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefMessageRouterHandlerAdapter.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.callback.CefNativeAdapter; -import org.cef.callback.CefQueryCallback; - -/** - * An abstract adapter class for receiving message router events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefMessageRouterHandlerAdapter - extends CefNativeAdapter implements CefMessageRouterHandler { - @Override - public boolean onQuery(CefBrowser browser, CefFrame frame, long query_id, String request, - boolean persistent, CefQueryCallback callback) { - return false; - } - - @Override - public void onQueryCanceled(CefBrowser browser, CefFrame frame, long query_id) { - return; - } -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefPrintHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefPrintHandler.java deleted file mode 100644 index 089be24..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefPrintHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.awt.Dimension; -import org.cef.browser.CefBrowser; -import org.cef.callback.CefNative; -import org.cef.callback.CefPrintDialogCallback; -import org.cef.callback.CefPrintJobCallback; -import org.cef.misc.CefPrintSettings; - -/** - * Implement this interface to handle printing on Linux. The methods of this - * class will be called on the browser process UI thread. - */ -public interface CefPrintHandler extends CefNative { - /** - * Called when printing has started for the specified |browser|. This method - * will be called before the other onPrint*() methods and irrespective of how - * printing was initiated (e.g. CefBrowser::print(), JavaScript window.print() - * or PDF extension print button). - */ - void onPrintStart(CefBrowser browser); - - /** - * Synchronize |settings| with client state. If |get_defaults| is true then - * populate |settings| with the default print settings. Do not keep a - * reference to |settings| outside of this callback. - */ - void onPrintSettings(CefPrintSettings settings, boolean get_defaults); - - /** - * Show the print dialog. Execute |callback| once the dialog is dismissed. - * Return true if the dialog will be displayed or false to cancel the - * printing immediately. - * - */ - boolean onPrintDialog(boolean has_selection, CefPrintDialogCallback callback); - - /** - * Send the print job to the printer. Execute |callback| once the job is - * completed. Return true if the job will proceed or false to cancel the job - * immediately. - */ - boolean onPrintJob(String document_name, String pdf_file_path, CefPrintJobCallback callback); - - /** - * Reset client state related to printing. - */ - void onPrintReset(); - - /** - * Called when PrintToPDF is requested for a browser. Returns the page size - * (as measured in microns) to use. - * @param deviceUnitsPerInch The DPI of the print. Use this to calculate - * the page size to use. - * @return The page size - */ - Dimension getPdfPaperSize(int deviceUnitsPerInch); - -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefPrintHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefPrintHandlerAdapter.java deleted file mode 100644 index 8decd85..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefPrintHandlerAdapter.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.awt.Dimension; -import org.cef.browser.CefBrowser; -import org.cef.callback.CefNativeAdapter; -import org.cef.callback.CefPrintDialogCallback; -import org.cef.callback.CefPrintJobCallback; -import org.cef.misc.CefPrintSettings; - -/** - * An abstract adapter class for receiving print events on Linux. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefPrintHandlerAdapter extends CefNativeAdapter implements CefPrintHandler { - @Override - public void onPrintStart(CefBrowser browser) { - // The default implementation does nothing - } - - @Override - public void onPrintSettings(CefPrintSettings settings, boolean get_defaults) { - // The default implementation does nothing - } - - @Override - public boolean onPrintDialog(boolean has_selection, CefPrintDialogCallback callback) { - // The default implementation does nothing - return false; - } - - @Override - public boolean onPrintJob( - String document_name, String pdf_file_path, CefPrintJobCallback callback) { - // The default implementation does nothing - return false; - } - - @Override - public void onPrintReset() { - // The default implementation does nothing - } - - @Override - public Dimension getPdfPaperSize(int deviceUnitsPerInch) { - // default implementation is A4 letter size - // @ 300 DPI, A4 is 2480 x 3508 - // @ 150 DPI, A4 is 1240 x 1754 - int adjustedWidth = (int)(((double)deviceUnitsPerInch/300d)*2480d); - int adjustedHeight = (int)(((double)deviceUnitsPerInch/300d)*3508d); - return new Dimension(adjustedWidth, adjustedHeight); - } -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefRenderHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefRenderHandler.java deleted file mode 100644 index 832d245..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefRenderHandler.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.awt.Point; -import java.awt.Rectangle; -import java.nio.ByteBuffer; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefDragData; - -/** - * Implement this interface to handle events when window rendering is disabled. - * The methods of this class will be called on the UI thread. - */ -public interface CefRenderHandler { - /** - * Retrieve the view rectangle. - * @param browser The browser generating the event. - * @return The view rectangle. - */ - public Rectangle getViewRect(CefBrowser browser); - /** - * Retrieve the screen point for the specified view point. - * @param browser The browser generating the event. - * @param viewPoint The point in the view. - * @return The screen point. - */ - public Point getScreenPoint(CefBrowser browser, Point viewPoint); - - /** - * Show or hide the popup window. - * @param browser The browser generating the event. - * @param show True if the popup window is being shown. - */ - public void onPopupShow(CefBrowser browser, boolean show); - - /** - * Size the popup window. - * @param browser The browser generating the event. - * @param size Size of the popup window. - */ - public void onPopupSize(CefBrowser browser, Rectangle size); - - /** - * Handle painting. - * @param browser The browser generating the event. - * @param popup True if painting a popup window. - * @param dirtyRects Array of dirty regions. - * @param buffer Pixel buffer for the whole window. - * @param width Width of the buffer. - * @param height Height of the buffer. - */ - public void onPaint(CefBrowser browser, boolean popup, Rectangle[] dirtyRects, - ByteBuffer buffer, int width, int height); - - /** - * Handle cursor changes. - * @param browser The browser generating the event. - * @param cursor The new cursor. - */ - public void onCursorChange(CefBrowser browser, int cursor); - - /** - * Called when the user starts dragging content in the web view. Contextual - * information about the dragged content is supplied by dragData. - * OS APIs that run a system message loop may be used within the - * StartDragging call. - * - * Return false to abort the drag operation. Don't call any of - * CefBrowser-dragSource*Ended* methods after returning false. - * - * Return true to handle the drag operation. Call - * CefBrowser.dragSourceEndedAt and CefBrowser.ragSourceSystemDragEnded either - * synchronously or asynchronously to inform the web view that the drag - * operation has ended. - * @param browser The browser generating the event. - * @param dragData Contextual information about the dragged content - * @param mask Describes the allowed operation (none, move, copy, link). - * @param x Coordinate within CefBrowser - * @param y Coordinate within CefBrowser - * @return false to abort the drag operation or true to handle the drag operation. - */ - public boolean startDragging(CefBrowser browser, CefDragData dragData, int mask, int x, int y); - - /** - * Called when the web view wants to update the mouse cursor during a - * drag & drop operation. - * - * @param browser The browser generating the event. - * @param operation Describes the allowed operation (none, move, copy, link). - */ - public void updateDragCursor(CefBrowser browser, int operation); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefRenderHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefRenderHandlerAdapter.java deleted file mode 100644 index 4df55dc..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefRenderHandlerAdapter.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.awt.Point; -import java.awt.Rectangle; -import java.nio.ByteBuffer; - -import org.cef.browser.CefBrowser; -import org.cef.callback.CefDragData; - -/** - * An abstract adapter class for receiving render events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefRenderHandlerAdapter implements CefRenderHandler { - @Override - public void onCursorChange(CefBrowser browser, int cursorIdentifer) { - return; - } - - @Override - public Rectangle getViewRect(CefBrowser browser) { - return new Rectangle(0, 0, 0, 0); - } - - @Override - public Point getScreenPoint(CefBrowser browser, Point viewPoint) { - return new Point(0, 0); - } - - @Override - public void onPopupShow(CefBrowser browser, boolean show) {} - - @Override - public void onPopupSize(CefBrowser browser, Rectangle size) {} - - @Override - public void onPaint(CefBrowser browser, boolean popup, Rectangle[] dirtyRects, - ByteBuffer buffer, int width, int height) {} - - @Override - public boolean startDragging(CefBrowser browser, CefDragData dragData, int mask, int x, int y) { - return false; - } - - @Override - public void updateDragCursor(CefBrowser browser, int operation) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefRequestContextHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefRequestContextHandler.java deleted file mode 100644 index 19bf328..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefRequestContextHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.network.CefCookieManager; -import org.cef.network.CefWebPluginInfo; - -/** - * Implement this interface to provide handler implementations. - */ -public interface CefRequestContextHandler { - /** - * Called on the IO thread to retrieve the cookie manager. The global cookie - * manager will be used if this method returns NULL. - */ - CefCookieManager getCookieManager(); - - /** - * Called on multiple browser process threads before a plugin instance is - * loaded. - * @param mime_type is the mime type of the plugin that will be loaded. - * @param plugin_url is the content URL that the plugin will load and may be - * empty. - * @param is_main_frame will be true if the plugin is being loaded in the main - * (top-level) frame. - * @param top_origin_url is the URL for the top-level frame that contains the - * plugin when loading a specific plugin instance or empty when - * building the initial list of enabled plugins for 'navigator.plugins' - * JavaScript state. - * @param plugin_info includes additional information about the plugin that - * will be loaded. |plugin_policy| is the recommended policy. - * @return true to block loading of the plugin. - */ - boolean onBeforePluginLoad(String mime_type, String plugin_url, boolean is_main_frame, - String top_origin_url, CefWebPluginInfo plugin_info); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefRequestContextHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefRequestContextHandlerAdapter.java deleted file mode 100644 index 6bb5dc9..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefRequestContextHandlerAdapter.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.network.CefCookieManager; -import org.cef.network.CefWebPluginInfo; - -/** - * An abstract adapter class for receiving browser request context events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefRequestContextHandlerAdapter implements CefRequestContextHandler { - @Override - public CefCookieManager getCookieManager() { - return null; - } - - @Override - public boolean onBeforePluginLoad(String mime_type, String plugin_url, boolean is_main_frame, - String top_origin_url, CefWebPluginInfo plugin_info) { - return false; - } -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefRequestHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefRequestHandler.java deleted file mode 100644 index 644292e..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefRequestHandler.java +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.callback.CefAuthCallback; -import org.cef.callback.CefRequestCallback; -import org.cef.misc.BoolRef; -import org.cef.misc.StringRef; -import org.cef.network.CefRequest; -import org.cef.network.CefResponse; -import org.cef.network.CefURLRequest; - -/** - * Implement this interface to handle events related to browser requests. The - * methods of this class will be called on the thread indicated. - */ -public interface CefRequestHandler { - /** - * Process termination status values. - */ - enum TerminationStatus { - TS_ABNORMAL_TERMINATION, //!< Non-zero exit status. - TS_PROCESS_WAS_KILLED, //!< SIGKILL or task manager kill. - TS_PROCESS_CRASHED //!< Segmentation fault. - } - - /** - * Called on the UI thread before browser navigation. Return true to cancel - * the navigation or false to allow the navigation to proceed. The request - * object cannot be modified in this callback. - * - * CefLoadHandler.onLoadingStateChange() will be called twice in all cases. - * If the navigation is allowed CefLoadHandler.onLoadStart() and - * CefLoadHandler.onLoadEnd() will be called. If the navigation is canceled - * CefLoadHandler.onLoadError() will be called with an errorCode value of - * ERR_ABORTED. - * - * @param browser The corresponding browser. - * @param frame The frame generating the event. Instance only valid within - * the scope of this method. - * @param request The request itself. Can't be modified. - * @param is_redirect true if the request was redirected. - * @return true to cancel or false to allow to proceed. - */ - boolean onBeforeBrowse( - CefBrowser browser, CefFrame frame, CefRequest request, boolean is_redirect); - - /** - * Called on the IO thread before a resource request is loaded. - * - * @param browser The corresponding browser. - * @param frame The frame generating the event. Instance only valid within - * the scope of this method. - * @param request The request object may be modified. - * @param callback The request object may be modified. - * @return To cancel the request return true otherwise return false. - */ - boolean onBeforeResourceLoad(CefBrowser browser, CefFrame frame, CefRequest request - // CefRequestCallback callback - ); - - /** - * Called on the IO thread before a resource is loaded. To allow the resource - * to load normally return NULL. To specify a handler for the resource return - * a CefResourceHandler object. The |request| object should not be modified in - * this callback. - * - * @param browser The corresponding browser. - * @param frame The frame generating the event. Instance only valid within - * the scope of this method. - * @param request The request itself. Should not be modified in this callback. - * @return a CefResourceHandler instance or NULL. - */ - CefResourceHandler getResourceHandler(CefBrowser browser, CefFrame frame, CefRequest request); - - /** - * Called on the IO thread when a resource load is redirected. - * - * @param browser The corresponding browser. - * @param frame The frame generating the event. Instance only valid within - * the scope of this method. - * @param request The request itself. Should not be modified in this callback. - * @param response The response that resulted in the redirect. Should not be - * modified in this callback. - * @param new_url Contains the new URL and can be changed if desired. - */ - void onResourceRedirect(CefBrowser browser, CefFrame frame, CefRequest request, - CefResponse response, StringRef new_url); - - /** - * Called on the IO thread when a resource response is received. To allow the - * resource to load normally return false. To redirect or retry the resource - * modify |request| (url, headers or post body) and return true. The - * |response| object cannot be modified in this callback. - * @param browser The corresponding browser. - * @param frame The frame generating the event. Instance only valid within - * the scope of this method. - * @param request The request itself. To redirect or retry the resource - * modify |request| (url, headers or post body) and return true - * @param response The response that resulted in the redirect. Should not be - * modified in this callback. - * @return True if request modified or false otherwise - */ - boolean onResourceResponse( - CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response); - - /** - * Called on the IO thread when a resource load has completed. |request| and - * |response| represent the request and response respectively and cannot be - * modified in this callback. |status| indicates the load completion status. - * |received_content_length| is the number of response bytes actually read. - * @param browser The corresponding browser. - * @param frame The frame generating the event. Instance only valid within - * the scope of this method. - * @param request The request itself. Should not be modified in this callback. - * @param response The response that resulted in the redirect. Should not be - * modified in this callback. - * @param status The load completion status - * @param receivedContentLength The number of bytes read - */ - void onResourceLoadComplete(CefBrowser browser, CefFrame frame, CefRequest request, - CefResponse response, CefURLRequest.Status status, long receivedContentLength); - - /** - * Called on the IO thread when the browser needs credentials from the user. - * Return true to continue the request and call CefAuthCallback::Continue() - * when the authentication information is available. - * Return false to cancel the request. - * - * @param browser The corresponding browser. - * @param frame The frame generating the event. Instance only valid within - * the scope of this method. - * @param isProxy indicates whether the host is a proxy server. - * @param host contains the hostname. - * @param port contains the port number. - * @param realm The realm of the request. - * @param scheme The scheme of the request. - * @param callback call CefAuthCallback::Continue() when the authentication - * information is available. - * @return true to continue the request or false to cancel. - */ - boolean getAuthCredentials(CefBrowser browser, CefFrame frame, boolean isProxy, String host, - int port, String realm, String scheme, CefAuthCallback callback); - - /** - * Called on the IO thread when JavaScript requests a specific storage quota - * size via the webkitStorageInfo.requestQuota function. - * - * @param browser The corresponding browser. - * @param origin_url is the origin of the page making the request. - * @param new_size is the requested quota size in bytes. - * @param callback call CefRequestCallback::Continue() either in this method or - * at a later time to grant or deny the request. - * @return true to handle the request or false to cancel the request. - */ - boolean onQuotaRequest( - CefBrowser browser, String origin_url, long new_size, CefRequestCallback callback); - - /** - * Called on the UI thread to handle requests for URLs with an unknown - * protocol component. Set |allow_os_execution| to true to attempt execution - * via the registered OS protocol handler, if any. - * SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED - * ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION. - */ - void onProtocolExecution(CefBrowser browser, String url, BoolRef allow_os_execution); - - /** - * Called on the UI thread to handle requests for URLs with an invalid - * SSL certificate. Return true and call CefAllowCertificateErrorCallback:: - * Continue() either in this method or at a later time to continue or cancel - * the request. Return false to cancel the request immediately. If callback - * is empty the error cannot be recovered from and the request will be - * canceled automatically. If "ignore-certificate-errors" command-line switch - * is set all invalid certificates will be accepted without calling this method. - * - * @param browser The corresponding browser. - * @param cert_error Error code describing the error. - * @param request_url The requesting URL. - * @param callback call CefRequestCallback::Continue() to continue - * or cancel the request. - * @return true to handle the request or false to reject it. - */ - boolean onCertificateError(CefBrowser browser, CefLoadHandler.ErrorCode cert_error, - String request_url, CefRequestCallback callback); - - /** - * Called on the browser process UI thread when a plugin has crashed. - * @param browser The corresponding browser. - * @param pluginPath the path of the plugin that crashed. - */ - void onPluginCrashed(CefBrowser browser, String pluginPath); - - /** - * Called on the browser process UI thread when the render process - * terminates unexpectedly. |status| indicates how the process - * terminated. - */ - void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefRequestHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefRequestHandlerAdapter.java deleted file mode 100644 index 182fd27..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefRequestHandlerAdapter.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.callback.CefAuthCallback; -import org.cef.callback.CefRequestCallback; -import org.cef.handler.CefLoadHandler.ErrorCode; -import org.cef.misc.BoolRef; -import org.cef.misc.StringRef; -import org.cef.network.CefRequest; -import org.cef.network.CefResponse; -import org.cef.network.CefURLRequest; - -/** - * An abstract adapter class for receiving browser request events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefRequestHandlerAdapter implements CefRequestHandler { - @Override - public boolean onBeforeBrowse( - CefBrowser browser, CefFrame frame, CefRequest request, boolean is_redirect) { - return false; - } - - @Override - public boolean onBeforeResourceLoad(CefBrowser browser, CefFrame frame, CefRequest request) { - return false; - } - - @Override - public CefResourceHandler getResourceHandler( - CefBrowser browser, CefFrame frame, CefRequest request) { - return null; - } - - @Override - public void onResourceRedirect(CefBrowser browser, CefFrame frame, CefRequest request, - CefResponse response, StringRef new_url) {} - - @Override - public boolean onResourceResponse( - CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response) { - return false; - } - - @Override - public void onResourceLoadComplete(CefBrowser browser, CefFrame frame, CefRequest request, - CefResponse response, CefURLRequest.Status status, long receivedContentLength) {} - - @Override - public boolean getAuthCredentials(CefBrowser browser, CefFrame frame, boolean isProxy, - String host, int port, String realm, String scheme, CefAuthCallback callback) { - return false; - } - - @Override - public boolean onQuotaRequest( - CefBrowser browser, String origin_url, long new_size, CefRequestCallback callback) { - return false; - } - - @Override - public void onProtocolExecution(CefBrowser browser, String url, BoolRef allow_os_execution) {} - - @Override - public boolean onCertificateError(CefBrowser browser, ErrorCode cert_error, String request_url, - CefRequestCallback callback) { - return false; - } - - @Override - public void onPluginCrashed(CefBrowser browser, String pluginPath) {} - - @Override - public void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status) {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefResourceHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefResourceHandler.java deleted file mode 100644 index 12e364d..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefResourceHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.callback.CefCallback; -import org.cef.callback.CefNative; -import org.cef.misc.IntRef; -import org.cef.misc.StringRef; -import org.cef.network.CefCookie; -import org.cef.network.CefRequest; -import org.cef.network.CefResponse; - -/** - * Implement this interface to handle custom resource requests. The methods of - * this class will always be called on the IO thread. - */ -public interface CefResourceHandler extends CefNative { - /** - * Begin processing the request. To handle the request return true and call - * CefCallback::Continue() once the response header information is available - * (CefCallback::Continue() can also be called from inside this method if - * header information is available immediately). To cancel the request return - * false. - */ - boolean processRequest(CefRequest request, CefCallback callback); - - /** - * Retrieve response header information. If the response length is not known - * set |response_length| to -1 and ReadResponse() will be called until it - * returns false. If the response length is known set |response_length| - * to a positive value and ReadResponse() will be called until it returns - * false or the specified number of bytes have been read. Use the |response| - * object to set the mime type, http status code and other optional header - * values. To redirect the request to a new URL set |redirectUrl| to the new - * URL. - */ - void getResponseHeaders(CefResponse response, IntRef response_length, StringRef redirectUrl); - - /** - * Read response data. If data is available immediately copy up to - * |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of - * bytes copied, and return true. To read the data at a later time set - * |bytes_read| to 0, return true and call CefCallback::Continue() when the - * data is available. To indicate response completion return false. - */ - boolean readResponse( - byte[] data_out, int bytes_to_read, IntRef bytes_read, CefCallback callback); - - /** - * Return true if the specified cookie can be sent with the request or false - * otherwise. If false is returned for any cookie then no cookies will be sent - * with the request. - */ - boolean canGetCookie(CefCookie cookie); - - /** - * Return true if the specified cookie returned with the response can be set - * or false otherwise. - */ - boolean canSetCookie(CefCookie cookie); - - /** - * Request processing has been canceled. - */ - void cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefResourceHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefResourceHandlerAdapter.java deleted file mode 100644 index 03184c9..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefResourceHandlerAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import org.cef.callback.CefCallback; -import org.cef.callback.CefNativeAdapter; -import org.cef.misc.IntRef; -import org.cef.misc.StringRef; -import org.cef.network.CefCookie; -import org.cef.network.CefRequest; -import org.cef.network.CefResponse; - -/** - * An abstract adapter class for receiving resource requests. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefResourceHandlerAdapter - extends CefNativeAdapter implements CefResourceHandler { - @Override - public boolean processRequest(CefRequest request, CefCallback callback) { - return false; - } - - @Override - public void getResponseHeaders( - CefResponse response, IntRef response_length, StringRef redirectUrl) {} - - @Override - public boolean readResponse( - byte[] data_out, int bytes_to_read, IntRef bytes_read, CefCallback callback) { - return false; - } - - @Override - public boolean canGetCookie(CefCookie cookie) { - return true; - } - - @Override - public boolean canSetCookie(CefCookie cookie) { - return true; - } - - @Override - public void cancel() {} -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefWindowHandler.java b/wizard-browser/src/main/java/org/cef/handler/CefWindowHandler.java deleted file mode 100644 index 5ecc960..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefWindowHandler.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.awt.Rectangle; - -import org.cef.browser.CefBrowser; - -/** - * Implement this interface to handle events if window rendering is enabled. - * - */ -public interface CefWindowHandler { - /** - * Retrieve the view rectangle. - * @param browser The browser generating the event. - * @return The view rectangle. - */ - public Rectangle getRect(CefBrowser browser); - - /** - * Implement this method to handle mouse events on Windows. - * - * The method is called in case of the following events: - * MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED and MOUSE_WHEEL for a - * horizontal wheel movement. - * - * @param browser The browser generating the event. - * @param event A mouse event like MouseEvent.MOUSE_MOVED. - * @param screenX The absolute X position on the screen. - * @param screenY The absolute Y position on the screen. - * @param modifier The modifier keys down during event (e.g. Shift, Ctrl). - * @param button An integer indicating which mouse button state changed. - * If parameter event is set to MouseEvent.MOUSE_WHEEL, the value of this - * parameter specifies the rotation indicator (negative value for left scroll - * and positive value for right scroll). - */ - public void onMouseEvent( - CefBrowser browser, int event, int screenX, int screenY, int modifier, int button); -} diff --git a/wizard-browser/src/main/java/org/cef/handler/CefWindowHandlerAdapter.java b/wizard-browser/src/main/java/org/cef/handler/CefWindowHandlerAdapter.java deleted file mode 100644 index 327cd42..0000000 --- a/wizard-browser/src/main/java/org/cef/handler/CefWindowHandlerAdapter.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.handler; - -import java.awt.Rectangle; - -import org.cef.browser.CefBrowser; - -/** - * An abstract adapter class for receiving windowed render events. - * The methods in this class are empty. - * This class exists as convenience for creating handler objects. - */ -public abstract class CefWindowHandlerAdapter implements CefWindowHandler { - @Override - public Rectangle getRect(CefBrowser browser) { - return new Rectangle(0, 0, 0, 0); - } - - @Override - public void onMouseEvent( - CefBrowser browser, int event, int screenX, int screenY, int modifier, int button) {} -} diff --git a/wizard-browser/src/main/java/org/cef/misc/BoolRef.java b/wizard-browser/src/main/java/org/cef/misc/BoolRef.java deleted file mode 100644 index 69a37e9..0000000 --- a/wizard-browser/src/main/java/org/cef/misc/BoolRef.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.misc; - -/** - * Helper class for passing boolean values by reference. - */ -public class BoolRef { - private boolean value_; - - public BoolRef() {} - - public BoolRef(boolean value) { - value_ = value; - } - - public void set(boolean value) { - value_ = value; - } - - public boolean get() { - return value_; - } -} diff --git a/wizard-browser/src/main/java/org/cef/misc/CefPageRange.java b/wizard-browser/src/main/java/org/cef/misc/CefPageRange.java deleted file mode 100644 index dee4fdf..0000000 --- a/wizard-browser/src/main/java/org/cef/misc/CefPageRange.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.misc; - -/** - * Class representing a print job page range. - */ -public class CefPageRange { - public int from; - public int to; - - public CefPageRange() {} - - public CefPageRange(int from, int to) { - this.from = from; - this.to = to; - } -} \ No newline at end of file diff --git a/wizard-browser/src/main/java/org/cef/misc/CefPdfPrintSettings.java b/wizard-browser/src/main/java/org/cef/misc/CefPdfPrintSettings.java deleted file mode 100644 index e4866f1..0000000 --- a/wizard-browser/src/main/java/org/cef/misc/CefPdfPrintSettings.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.misc; - -/** - * PDF print settings for browser.printToPDF() - */ -public class CefPdfPrintSettings { - - public enum MarginType { - // Default margins. - DEFAULT, - - // No margins - NONE, - - // Minimum margins. - MINIMUM, - - // Custom margins using the values from CefPdfPrintSettings - CUSTOM - } - - /** - * Set to true to print headers and footers or false to not print - * headers and footers. - */ - public boolean header_footer_enabled; - - /** - * Page title to display in the header. Only used if header_footer_enabled - * is set to true. - */ - public String header_footer_title; - - /** - * URL to display in the footer. Only used if header_footer_enabled is set - * to true. - */ - public String header_footer_url; - - /** - * Set to true for landscape mode or false for portrait mode. - */ - public boolean landscape; - - /** - * Set to true to print background graphics or false to not print - * background graphics. - */ - public boolean backgrounds_enabled; - - /** - * Output page size in microns (1 millimeter = 1000 microns). If either of these - * values is less than or equal to zero then the default paper size will be - * used as returned by the print_handler. A4 is 210 × 297 mm which would - * be 210000 x 297000 microns. US Letter is 215.9 × 279.4 mm which would - * be 215900 x 279400 microns. - */ - public int page_width; - public int page_height; - - /** - * Set to true to print the selection only or false to print all. - */ - public boolean selection_only; - - /** - * The percentage to scale the PDF by before printing (e.g. 50 is 50%). - * If this value is less than or equal to zero the default value of 100 - * will be used. - */ - public int scale_factor; - - /** - * Margins in millimeters. Only used if |margin_type| is set to - * PDF_PRINT_MARGIN_CUSTOM. - */ - public double margin_top; - public double margin_right; - public double margin_bottom; - public double margin_left; - - /** - * Margin type. - */ - public MarginType margin_type; - - public CefPdfPrintSettings() {} - - @Override - public CefPdfPrintSettings clone() { - CefPdfPrintSettings tmp = new CefPdfPrintSettings(); - tmp.header_footer_enabled = this.header_footer_enabled; - tmp.header_footer_title = this.header_footer_title; - tmp.header_footer_url = this.header_footer_url; - tmp.landscape = this.landscape; - tmp.backgrounds_enabled = this.backgrounds_enabled; - tmp.page_width = this.page_width; - tmp.page_height = this.page_height; - tmp.selection_only = this.selection_only; - tmp.scale_factor = this.scale_factor; - tmp.margin_top = this.margin_top; - tmp.margin_right = this.margin_right; - tmp.margin_bottom = this.margin_bottom; - tmp.margin_left = this.margin_left; - tmp.margin_type = this.margin_type; - return tmp; - } -} diff --git a/wizard-browser/src/main/java/org/cef/misc/CefPrintSettings.java b/wizard-browser/src/main/java/org/cef/misc/CefPrintSettings.java deleted file mode 100644 index 0ffa03f..0000000 --- a/wizard-browser/src/main/java/org/cef/misc/CefPrintSettings.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.misc; - -import java.awt.Dimension; -import java.awt.Rectangle; -import java.util.Vector; - -/** - * Class representing print settings. - */ -public abstract class CefPrintSettings { - /** - * Print job color mode values. - */ - public enum ColorModel { - COLOR_MODEL_UNKNOWN, - COLOR_MODEL_GRAY, - COLOR_MODEL_COLOR, - COLOR_MODEL_CMYK, - COLOR_MODEL_CMY, - COLOR_MODEL_KCMY, - COLOR_MODEL_CMY_K, //!< CMY_K represents CMY+K. - COLOR_MODEL_BLACK, - COLOR_MODEL_GRAYSCALE, - COLOR_MODEL_RGB, - COLOR_MODEL_RGB16, - COLOR_MODEL_RGBA, - COLOR_MODEL_COLORMODE_COLOR, //!< Used in samsung printer ppds. - COLOR_MODEL_COLORMODE_MONOCHROME, //!< Used in samsung printer ppds. - COLOR_MODEL_HP_COLOR_COLOR, //!< Used in HP color printer ppds. - COLOR_MODEL_HP_COLOR_BLACK, //!< Used in HP color printer ppds. - COLOR_MODEL_PRINTOUTMODE_NORMAL, //!< Used in foomatic ppds. - COLOR_MODEL_PRINTOUTMODE_NORMAL_GRAY, //!< Used in foomatic ppds. - COLOR_MODEL_PROCESSCOLORMODEL_CMYK, //!< Used in canon printer ppds. - COLOR_MODEL_PROCESSCOLORMODEL_GREYSCALE, //!< Used in canon printer ppds. - COLOR_MODEL_PROCESSCOLORMODEL_RGB, //!< Used in canon printer ppds - } - - /** - * Print job duplex mode values. - */ - public enum DuplexMode { - DUPLEX_MODE_UNKNOWN, - DUPLEX_MODE_SIMPLEX, - DUPLEX_MODE_LONG_EDGE, - DUPLEX_MODE_SHORT_EDGE, - } - - // This CTOR can't be called directly. Call method create() instead. - CefPrintSettings() {} - - /** - * Create a new CefPrintSettings object. - */ - public static final CefPrintSettings create() { - return CefPrintSettings_N.createNative(); - } - - /** - * Returns true if this object is valid. Do not call any other methods if this - * function returns false. - */ - public abstract boolean isValid(); - - /** - * Returns true if the values of this object are read-only. Some APIs may - * expose read-only objects. - */ - public abstract boolean isReadOnly(); - - /** - * Returns a writable copy of this object. - */ - public abstract CefPrintSettings copy(); - - /** - * Set the page orientation. - */ - public abstract void setOrientation(boolean landscape); - - /** - * Returns true if the orientation is landscape. - * - */ - public abstract boolean isLandscape(); - - /** - * Set the printer printable area in device units. - * Some platforms already provide flipped area. Set |landscape_needs_flip| - * to false on those platforms to avoid double flipping. - */ - public abstract void setPrinterPrintableArea(Dimension physical_size_device_units, - Rectangle printable_area_device_units, boolean landscape_needs_flip); - - /** - * Set the device name. - */ - public abstract void setDeviceName(String name); - - /** - * Get the device name. - */ - public abstract String getDeviceName(); - - /** - * Set the DPI (dots per inch). - */ - public abstract void setDPI(int dpi); - - /** - * Get the DPI (dots per inch). - */ - public abstract int getDPI(); - - /** - * Set the page ranges. - */ - public abstract void setPageRanges(Vector ranges); - - /** - * Returns the number of page ranges that currently exist. - */ - public abstract int getPageRangesCount(); - - /** - * Retrieve the page ranges. - */ - public abstract void getPageRanges(Vector ranges); - - /** - * Set whether only the selection will be printed. - */ - public abstract void setSelectionOnly(boolean selection_only); - - /** - * Returns true if only the selection will be printed. - */ - public abstract boolean isSelectionOnly(); - - /** - * Set whether pages will be collated. - */ - public abstract void setCollate(boolean collate); - - /** - * Returns true if pages will be collated. - */ - public abstract boolean willCollate(); - - /** - * Set the color model. - */ - public abstract void setColorModel(ColorModel model); - - /** - * Get the color model. - */ - public abstract ColorModel getColorModel(); - - /** - * Set the number of copies. - */ - public abstract void setCopies(int copies); - - /** - * Get the number of copies. - */ - public abstract int getCopies(); - - /** - * Set the duplex mode. - */ - public abstract void setDuplexMode(DuplexMode mode); - - /** - * Get the duplex mode. - */ - public abstract DuplexMode getDuplexMode(); -} diff --git a/wizard-browser/src/main/java/org/cef/misc/CefPrintSettings_N.java b/wizard-browser/src/main/java/org/cef/misc/CefPrintSettings_N.java deleted file mode 100644 index 47a653c..0000000 --- a/wizard-browser/src/main/java/org/cef/misc/CefPrintSettings_N.java +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.misc; - -import java.awt.Dimension; -import java.awt.Rectangle; -import java.util.Vector; - -import org.cef.callback.CefNative; - -class CefPrintSettings_N extends CefPrintSettings implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefPrintSettings_N() { - super(); - } - - public static final CefPrintSettings createNative() { - CefPrintSettings_N result = new CefPrintSettings_N(); - try { - result.N_CefPrintSettings_CTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - if (result.N_CefHandle == 0) return null; - return result; - } - - @Override - protected void finalize() throws Throwable { - try { - N_CefPrintSettings_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } finally { - super.finalize(); - } - } - - @Override - public boolean isValid() { - try { - return N_IsValid(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean isReadOnly() { - try { - return N_IsReadOnly(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public CefPrintSettings copy() { - try { - return N_Copy(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setOrientation(boolean landscape) { - try { - N_SetOrientation(landscape); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean isLandscape() { - try { - return N_IsLandscape(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public void setPrinterPrintableArea(Dimension physical_size_device_units, - Rectangle printable_area_device_units, boolean landscape_needs_flip) { - try { - N_SetPrinterPrintableArea( - physical_size_device_units, printable_area_device_units, landscape_needs_flip); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setDeviceName(String name) { - try { - N_SetDeviceName(name); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public String getDeviceName() { - try { - return N_GetDeviceName(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setDPI(int dpi) { - try { - N_SetDPI(dpi); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public int getDPI() { - try { - return N_GetDPI(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public void setPageRanges(Vector ranges) { - try { - N_SetPageRanges(ranges); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public int getPageRangesCount() { - try { - return N_GetPageRangesCount(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public void getPageRanges(Vector ranges) { - try { - N_GetPageRanges(ranges); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setSelectionOnly(boolean selection_only) { - try { - N_SetSelectionOnly(selection_only); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean isSelectionOnly() { - try { - return N_IsSelectionOnly(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public void setCollate(boolean collate) { - try { - N_SetCollate(collate); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean willCollate() { - try { - return N_WillCollate(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public void setColorModel(ColorModel model) { - try { - N_SetColorModel(model); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public ColorModel getColorModel() { - try { - return N_GetColorModel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setCopies(int copies) { - try { - N_SetCopies(copies); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public int getCopies() { - try { - return N_GetCopies(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public void setDuplexMode(DuplexMode mode) { - try { - N_SetDuplexMode(mode); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public DuplexMode getDuplexMode() { - try { - return N_GetDuplexMode(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - private final native void N_CefPrintSettings_CTOR(); - private final native boolean N_IsValid(); - private final native boolean N_IsReadOnly(); - private final native CefPrintSettings N_Copy(); - private final native void N_SetOrientation(boolean landscape); - private final native boolean N_IsLandscape(); - private final native void N_SetPrinterPrintableArea(Dimension physical_size_device_units, - Rectangle printable_area_device_units, boolean landscape_needs_flip); - private final native void N_SetDeviceName(String name); - private final native String N_GetDeviceName(); - private final native void N_SetDPI(int dpi); - private final native int N_GetDPI(); - private final native void N_SetPageRanges(Vector ranges); - private final native int N_GetPageRangesCount(); - private final native void N_GetPageRanges(Vector ranges); - private final native void N_SetSelectionOnly(boolean selection_only); - private final native boolean N_IsSelectionOnly(); - private final native void N_SetCollate(boolean collate); - private final native boolean N_WillCollate(); - private final native void N_SetColorModel(ColorModel model); - private final native ColorModel N_GetColorModel(); - private final native void N_SetCopies(int copies); - private final native int N_GetCopies(); - private final native void N_SetDuplexMode(DuplexMode mode); - private final native DuplexMode N_GetDuplexMode(); - private final native void N_CefPrintSettings_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/misc/IntRef.java b/wizard-browser/src/main/java/org/cef/misc/IntRef.java deleted file mode 100644 index 30be742..0000000 --- a/wizard-browser/src/main/java/org/cef/misc/IntRef.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.misc; - -/** - * Helper class for passing int values by reference. - */ -public class IntRef { - private int value_; - - public IntRef() {} - - public IntRef(int value) { - value_ = value; - } - - public void set(int value) { - value_ = value; - } - - public int get() { - return value_; - } -} diff --git a/wizard-browser/src/main/java/org/cef/misc/StringRef.java b/wizard-browser/src/main/java/org/cef/misc/StringRef.java deleted file mode 100644 index d84ac10..0000000 --- a/wizard-browser/src/main/java/org/cef/misc/StringRef.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.misc; - -/** - * Helper class for passing String values by reference. - */ -public class StringRef { - private String value_; - - public StringRef() {} - - public StringRef(String value) { - value_ = value; - } - - public void set(String value) { - value_ = value; - } - - public String get() { - return value_; - } -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefCookie.java b/wizard-browser/src/main/java/org/cef/network/CefCookie.java deleted file mode 100644 index 5020ba1..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefCookie.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.Date; - -/** - * Cookie information. - */ -public final class CefCookie { - public CefCookie(String name, String value, String domain, String path, boolean secure, - boolean httponly, Date creation, Date lastAccess, boolean hasExpires, Date expires) { - this.name = name; - this.value = value; - this.domain = domain; - this.path = path; - this.secure = secure; - this.httponly = httponly; - this.creation = creation; - this.lastAccess = lastAccess; - this.hasExpires = hasExpires; - this.expires = expires; - } - - /** - * The cookie name. - */ - public final String name; - - /** - * The cookie value. - */ - public final String value; - - /** - * If domain is empty a host cookie will be created instead of a domain - * cookie. Domain cookies are stored with a leading "." and are visible to - * sub-domains whereas host cookies are not. - */ - public final String domain; - - /** - * If path is non-empty only URLs at or below the path will get the cookie - * value. - */ - public final String path; - - /** - * If secure is true the cookie will only be sent for HTTPS requests. - */ - public final boolean secure; - - /** - * If httponly is true the cookie will only be sent for HTTP requests. - */ - public final boolean httponly; - - /** - * The cookie creation date. This is automatically populated by the system on - * cookie creation. - */ - public final Date creation; - - /** - * The cookie last access date. This is automatically populated by the system - * on access. - */ - public final Date lastAccess; - - /** - * The cookie expiration date is only valid if |has_expires| is true. - */ - public final boolean hasExpires; - public final Date expires; -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefCookieManager.java b/wizard-browser/src/main/java/org/cef/network/CefCookieManager.java deleted file mode 100644 index e752be4..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefCookieManager.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.Vector; - -import org.cef.callback.CefCompletionCallback; -import org.cef.callback.CefCookieVisitor; - -/** - * Class used for managing cookies. The methods of this class may be called on - * any thread unless otherwise indicated. - */ -public abstract class CefCookieManager { - // This CTOR can't be called directly. Call method create() instead. - CefCookieManager() {} - - /** - * Returns the global cookie manager. By default data will be stored at - * CefSettings.cache_path if specified or in memory otherwise. - */ - public static final CefCookieManager getGlobalManager() { - return CefCookieManager_N.getGlobalManagerNative(); - } - - /** - * Creates a new cookie manager. If |path| is empty data will be stored in - * memory only. Otherwise, data will be stored at the specified |path|. To - * persist session cookies (cookies without an expiry date or validity - * interval) set |persistSessionCookies| to true. Session cookies are - * generally intended to be transient and most Web browsers do not persist - * them. - * - * @return null if creation fails. - */ - public static final CefCookieManager createManager(String path, boolean persistSessionCookies) { - return CefCookieManager_N.createNative(path, persistSessionCookies); - } - - /** - * Set the schemes supported by this manager. By default only "http" and - * "https" schemes are supported. Must be called before any cookies are - * accessed. - */ - public abstract void setSupportedSchemes(Vector schemes); - - /** - * Visit all cookies. The returned cookies are ordered by longest path, then - * by earliest creation date. Returns false if cookies cannot be accessed. - */ - public abstract boolean visitAllCookies(CefCookieVisitor visitor); - - /** - * Visit a subset of cookies. The results are filtered by the given url - * scheme, host, domain and path. If |includeHttpOnly| is true HTTP-only - * cookies will also be included in the results. The returned cookies are - * ordered by longest path, then by earliest creation date. Returns false if - * cookies cannot be accessed. - */ - public abstract boolean visitUrlCookies( - String url, boolean includeHttpOnly, CefCookieVisitor visitor); - - /** - * Sets a cookie given a valid URL and explicit user-provided cookie - * attributes. This function expects each attribute to be well-formed. It will - * check for disallowed characters (e.g. the ';' character is disallowed - * within the cookie value attribute). This method will be called on the - * IO thread. If posting the task was successful the method returns true. - */ - public abstract boolean setCookie(String url, CefCookie cookie); - - /** - * Delete all cookies that match the specified parameters. If both |url| and - * values |cookieName| are specified all host and domain cookies matching - * both will be deleted. If only |url| is specified all host cookies (but not - * domain cookies) irrespective of path will be deleted. If |url| is empty all - * cookies for all hosts and domains will be deleted. This method will be - * called on the IO thread. If posting the task was successful the method - * returns true. - */ - public abstract boolean deleteCookies(String url, String cookieName); - - /** - * Sets the directory path that will be used for storing cookie data. If - * |path| is empty data will be stored in memory only. Otherwise, data will be - * stored at the specified |path|. To persist session cookies (cookies without - * an expiry date or validity interval) set |persistSessionCookies| to true. - * Session cookies are generally intended to be transient and most Web browsers - * do not persist them. Returns false if cookies cannot be accessed. - */ - public abstract boolean setStoragePath(String path, boolean persistSessionCookies); - - /** - * Flush the backing store (if any) to disk and execute the specified - * |handler| on the IO thread when done. Returns false if cookies cannot be - * accessed. - */ - public abstract boolean flushStore(CefCompletionCallback handler); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefCookieManager_N.java b/wizard-browser/src/main/java/org/cef/network/CefCookieManager_N.java deleted file mode 100644 index 4075552..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefCookieManager_N.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.Vector; - -import org.cef.callback.CefCompletionCallback; -import org.cef.callback.CefCookieVisitor; -import org.cef.callback.CefNative; - -class CefCookieManager_N extends CefCookieManager implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - private static CefCookieManager_N globalInstance = null; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefCookieManager_N() { - super(); - } - - static synchronized final CefCookieManager_N getGlobalManagerNative() { - CefCookieManager_N result = null; - try { - result = CefCookieManager_N.N_GetGlobalManager(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - - if (globalInstance == null) { - globalInstance = result; - } else if (globalInstance.N_CefHandle == result.N_CefHandle) { - result.N_CefCookieManager_DTOR(); - } - return globalInstance; - } - - static final CefCookieManager_N createNative(String path, boolean persistSessionCookies) { - CefCookieManager_N result = null; - try { - result = CefCookieManager_N.N_CreateManager(path, persistSessionCookies); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return result; - } - - @Override - protected void finalize() throws Throwable { - try { - N_CefCookieManager_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } finally { - super.finalize(); - } - } - - @Override - public void setSupportedSchemes(Vector schemes) { - try { - N_SetSupportedSchemes(schemes); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean visitAllCookies(CefCookieVisitor visitor) { - try { - return N_VisitAllCookies(visitor); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean visitUrlCookies(String url, boolean includeHttpOnly, CefCookieVisitor visitor) { - try { - return N_VisitUrlCookies(url, includeHttpOnly, visitor); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setCookie(String url, CefCookie cookie) { - try { - return N_SetCookie(url, cookie); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean deleteCookies(String url, String cookieName) { - try { - return N_DeleteCookies(url, cookieName); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean setStoragePath(String path, boolean persistSessionCookies) { - try { - return N_SetStoragePath(path, persistSessionCookies); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean flushStore(CefCompletionCallback handler) { - try { - return N_FlushStore(handler); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - private final static native CefCookieManager_N N_GetGlobalManager(); - private final static native CefCookieManager_N N_CreateManager( - String path, boolean persistSessionCookies); - private final native void N_SetSupportedSchemes(Vector schemes); - private final native boolean N_VisitAllCookies(CefCookieVisitor visitor); - private final native boolean N_VisitUrlCookies( - String url, boolean includeHttpOnly, CefCookieVisitor visitor); - private final native boolean N_SetCookie(String url, CefCookie cookie); - private final native boolean N_DeleteCookies(String url, String cookieName); - private final native boolean N_SetStoragePath(String path, boolean persistSessionCookies); - private final native boolean N_FlushStore(CefCompletionCallback handler); - private final native void N_CefCookieManager_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefPostData.java b/wizard-browser/src/main/java/org/cef/network/CefPostData.java deleted file mode 100644 index 00d9750..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefPostData.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.Vector; - -/** - * Class used to represent post data for a web request. The methods of this - * class may be called on any thread. - */ -public abstract class CefPostData { - // This CTOR can't be called directly. Call method create() instead. - CefPostData() {} - - /** - * Create a new CefPostData object. - */ - public static final CefPostData create() { - return CefPostData_N.createNative(); - } - - /** - * Returns true if this object is read-only. - */ - public abstract boolean isReadOnly(); - - /** - * Returns the number of existing post data elements. - */ - public abstract int getElementCount(); - - /** - * Retrieve the post data elements. - */ - public abstract void getElements(Vector elements); - - /** - * Remove the specified post data element. Returns true if the removal - * succeeds. - */ - public abstract boolean removeElement(CefPostDataElement element); - - /** - * Add the specified post data element. Returns true if the add succeeds. - */ - public abstract boolean addElement(CefPostDataElement element); - - /** - * Remove all existing post data elements. - */ - public abstract void removeElements(); - - @Override - public String toString() { - return toString(null); - } - - public String toString(String mimeType) { - Vector elements = new Vector(); - getElements(elements); - - String returnValue = ""; - for (CefPostDataElement el : elements) { - returnValue += el.toString(mimeType) + "\n"; - } - return returnValue; - } -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefPostDataElement.java b/wizard-browser/src/main/java/org/cef/network/CefPostDataElement.java deleted file mode 100644 index 8f9c2eb..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefPostDataElement.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -/** - * Class used to represent a single element in the request post data. The - * methods of this class may be called on any thread. - */ -public abstract class CefPostDataElement { - /** - * Post data elements may represent either bytes or files. - */ - public static enum Type { - PDE_TYPE_EMPTY, - PDE_TYPE_BYTES, - PDE_TYPE_FILE, - } - - // This CTOR can't be called directly. Call method create() instead. - CefPostDataElement() {} - - /** - * Create a new CefPostDataElement object. - */ - public static final CefPostDataElement create() { - return CefPostDataElement_N.createNative(); - } - - /** - * Returns true if this object is read-only. - */ - public abstract boolean isReadOnly(); - - /** - * Remove all contents from the post data element. - */ - public abstract void setToEmpty(); - - /** - * The post data element will represent a file. - */ - public abstract void setToFile(String fileName); - - /** - * The post data element will represent bytes. The bytes passed - * in will be copied. - */ - public abstract void setToBytes(int size, byte[] bytes); - - /** - * Return the type of this post data element. - */ - public abstract Type getType(); - - /** - * Return the file name. - */ - public abstract String getFile(); - - /** - * Return the number of bytes. - */ - public abstract int getBytesCount(); - - /** - * Read up to size bytes into bytes and return the number of bytes - * actually read. - */ - public abstract int getBytes(int size, byte[] bytes); - - @Override - public String toString() { - return toString(null); - } - - public String toString(String mimeType) { - int bytesCnt = getBytesCount(); - byte[] bytes = null; - if (bytesCnt > 0) { - bytes = new byte[bytesCnt]; - } - - boolean asText = false; - if (mimeType != null) { - if (mimeType.startsWith("text/")) - asText = true; - else if (mimeType.startsWith("application/xml")) - asText = true; - else if (mimeType.startsWith("application/xhtml")) - asText = true; - else if (mimeType.startsWith("application/x-www-form-urlencoded")) - asText = true; - } - - String returnValue = ""; - - if (getType() == Type.PDE_TYPE_BYTES) { - int setBytes = getBytes(bytes.length, bytes); - returnValue += " Content-Length: " + bytesCnt + "\n"; - if (asText) { - returnValue += "\n " + new String(bytes); - } else { - for (int i = 0; i < setBytes; i++) { - if (i % 40 == 0) returnValue += "\n "; - returnValue += String.format("%02X", bytes[i]) + " "; - } - } - returnValue += "\n"; - } else if (getType() == Type.PDE_TYPE_FILE) { - returnValue += "\n Bytes of file: " + getFile() + "\n"; - } - return returnValue; - } -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefPostDataElement_N.java b/wizard-browser/src/main/java/org/cef/network/CefPostDataElement_N.java deleted file mode 100644 index 595cf50..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefPostDataElement_N.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import org.cef.callback.CefNative; - -class CefPostDataElement_N extends CefPostDataElement implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefPostDataElement_N() { - super(); - } - - public static final CefPostDataElement createNative() { - CefPostDataElement_N result = new CefPostDataElement_N(); - try { - result.N_CefPostDataElement_CTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - if (result.N_CefHandle == 0) return null; - return result; - } - - @Override - protected void finalize() throws Throwable { - try { - N_CefPostDataElement_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } finally { - super.finalize(); - } - } - - @Override - public boolean isReadOnly() { - try { - return N_IsReadOnly(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public void setToEmpty() { - try { - N_SetToEmpty(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setToFile(String fileName) { - try { - N_SetToFile(fileName); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setToBytes(int size, byte[] bytes) { - try { - N_SetToBytes(size, bytes); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public Type getType() { - try { - return N_GetType(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getFile() { - try { - return N_GetFile(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public int getBytesCount() { - try { - return N_GetBytesCount(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public int getBytes(int size, byte[] bytes) { - try { - return N_GetBytes(size, bytes); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - private final native void N_CefPostDataElement_CTOR(); - private final native boolean N_IsReadOnly(); - private final native void N_SetToEmpty(); - private final native void N_SetToFile(String fileName); - private final native void N_SetToBytes(int size, byte[] bytes); - private final native Type N_GetType(); - private final native String N_GetFile(); - private final native int N_GetBytesCount(); - private final native int N_GetBytes(int size, byte[] bytes); - private final native void N_CefPostDataElement_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefPostData_N.java b/wizard-browser/src/main/java/org/cef/network/CefPostData_N.java deleted file mode 100644 index c847098..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefPostData_N.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.Vector; -import org.cef.callback.CefNative; - -/** - * - */ -class CefPostData_N extends CefPostData implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefPostData_N() { - super(); - } - - public static final CefPostData createNative() { - CefPostData_N result = new CefPostData_N(); - try { - result.N_CefPostData_CTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - if (result.N_CefHandle == 0) return null; - return result; - } - - @Override - protected void finalize() throws Throwable { - try { - N_CefPostData_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } finally { - super.finalize(); - } - } - - @Override - public boolean isReadOnly() { - try { - return N_IsReadOnly(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public int getElementCount() { - try { - return N_GetElementCount(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public void getElements(Vector elements) { - try { - N_GetElements(elements); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public boolean removeElement(CefPostDataElement element) { - try { - return N_RemoveElement(element); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public boolean addElement(CefPostDataElement element) { - try { - return N_AddElement(element); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public void removeElements() { - try { - N_RemoveElements(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_CefPostData_CTOR(); - private final native boolean N_IsReadOnly(); - private final native int N_GetElementCount(); - private final native void N_GetElements(Vector elements); - private final native boolean N_RemoveElement(CefPostDataElement element); - private final native boolean N_AddElement(CefPostDataElement element); - private final native void N_RemoveElements(); - private final native void N_CefPostData_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefRequest.java b/wizard-browser/src/main/java/org/cef/network/CefRequest.java deleted file mode 100644 index eb5d4c8..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefRequest.java +++ /dev/null @@ -1,471 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -/** - * Class used to represent a web request. The methods of this class may be - * called on any thread. - */ -public abstract class CefRequest { - /** - * Resource type for a request. - */ - public enum ResourceType { - RT_MAIN_FRAME, //!< Top level page. - RT_SUB_FRAME, //!< Frame or iframe. - RT_STYLESHEET, //!< CSS stylesheet. - RT_SCRIPT, //!< External script. - RT_IMAGE, //!< Image (jpg/gif/png/etc). - RT_FONT_RESOURCE, //!< Font. - RT_SUB_RESOURCE, //!< Some other subresource. This is the default type if - // the actual type is unknown. - RT_OBJECT, //!< Object (or embed) tag for a plugin, or a resource - // that a plugin requested. - RT_MEDIA, //!< Media resource. - RT_WORKER, //!< Main resource of a dedicated worker. - RT_SHARED_WORKER, //!< Main resource of a shared worker. - RT_PREFETCH, //!< Explicitly requested prefetch. - RT_FAVICON, //!< Favicon. - RT_XHR, //!< XMLHttpRequest. - RT_PING, //!< A request for a - RT_SERVICE_WORKER //!< Main resource of a service worker. - } - - /** - * Transition type for a request. Made up of one source value and 0 or more - * qualifiers. - */ - public enum TransitionType { - /** - * Source is a link click or the JavaScript window.open function. This is - * also the default value for requests like sub-resource loads that are not - * navigations. - */ - TT_LINK(0), - - /** - * Source is some other "explicit" navigation action such as creating a new - * browser or using the LoadURL function. This is also the default value - * for navigations where the actual type is unknown. - */ - TT_EXPLICIT(1), - - /** - * Source is a subframe navigation. This is any content that is automatically - * loaded in a non-toplevel frame. For example, if a page consists of several - * frames containing ads, those ad URLs will have this transition type. - * The user may not even realize the content in these pages is a separate - * frame, so may not care about the URL. - */ - TT_AUTO_SUBFRAME(3), - - /** - * Source is a subframe navigation explicitly requested by the user that will - * generate new navigation entries in the back/forward list. These are - * probably more important than frames that were automatically loaded in - * the background because the user probably cares about the fact that this - * link was loaded. - */ - TT_MANUAL_SUBFRAME(4), - - /** - * Source is a form submission by the user. NOTE: In some situations - * submitting a form does not result in this transition type. This can happen - * if the form uses a script to submit the contents. - */ - TT_FORM_SUBMIT(7), - - /** - * Source is a "reload" of the page via the Reload function or by re-visiting - * the same URL. NOTE: This is distinct from the concept of whether a - * particular load uses "reload semantics" (i.e. bypasses cached data). - */ - TT_RELOAD(8); - - private int value; - private TransitionType(int source) { - value = source; - } - - /** - * Returns the integer representation of this enum, containing the source - * and the qualifier as one value. - * @return The integer value of the enum with all its qualifiers. - */ - public int getValue() { - return value; - } - - /** - * Returns the source part of the enum as integer. - * @return Integer representation of the set source. - */ - public int getSource() { - return (value & 0xFF); - } - - /** - * Any of the core values above can be augmented by one or more qualifiers - * defined as TransitionFlags. - * These qualifiers further define the transition. - */ - public void addQualifier(TransitionFlags flag) { - value |= flag.getValue(); - } - - /** - * Add qualifiers as integer value - */ - public void addQualifiers(int flags) { - value |= (flags & 0xFFFFFF00); - } - - /** - * Returns the qualifier part of the enum as integer. - * @return Integer representation of the set qualifiers. - */ - public int getQualifiers() { - return (value & 0xFFFFFF00); - } - - /** - * Removes a qualifier from the enum. - * @param The qualifier to be removed. - */ - public void removeQualifier(TransitionFlags flag) { - value &= ~flag.getValue(); - } - - /** - * Tests if a qualifier is set. - */ - public boolean isSet(TransitionFlags flag) { - return (value & flag.getValue()) != 0; - } - - /** - * Tests if one of the redirect qualifiers is set. - */ - public boolean isRedirect() { - return (value & 0xC0000000) != 0; - } - } - - public static final class CefUrlRequestFlags { - /** - * Default behavior. - */ - public static final int UR_FLAG_NONE = 0; - - /** - * If set the cache will be skipped when handling the request. - */ - public static final int UR_FLAG_SKIP_CACHE = 1 << 0; - - /** - * If set user name, password, and cookies may be sent with the request, and - * cookies may be saved from the response. - */ - public static final int UR_FLAG_ALLOW_CACHED_CREDENTIALS = 1 << 1; - - /** - * If set upload progress events will be generated when a request has a body. - */ - public static final int UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3; - - /** - * If set the headers sent and received for the request will be recorded. - */ - public static final int UR_FLAG_REPORT_RAW_HEADERS = 1 << 5; - - /** - * If set the CefURLRequestClient.onDownloadData method will not be called. - */ - public static final int UR_FLAG_NO_DOWNLOAD_DATA = 1 << 6; - - /** - * If set 5XX redirect errors will be propagated to the observer instead of - * automatically re-tried. This currently only applies for requests - * originated in the browser process. - */ - public static final int UR_FLAG_NO_RETRY_ON_5XX = 1 << 7; - } - - /** - * Transition qualifiers. - * Any of the core values above can be augmented by one or more qualifiers. - * These qualifiers further define the transition. - */ - public enum TransitionFlags { - /** - * Attempted to visit a URL but was blocked. - */ - TT_BLOCKED_FLAG(0x00800000), - - /** - * Used the Forward or Back function to navigate among browsing history. - */ - TT_FORWARD_BACK_FLAG(0x01000000), - - /** - * The beginning of a navigation chain. - */ - TT_CHAIN_START_FLAG(0x10000000), - - /** - * The last transition in a redirect chain. - */ - TT_CHAIN_END_FLAG(0x20000000), - - /** - * Redirects caused by JavaScript or a meta refresh tag on the page. - */ - TT_CLIENT_REDIRECT_FLAG(0x40000000), - - /** - * Redirects sent from the server by HTTP headers. - */ - TT_SERVER_REDIRECT_FLAG(0x80000000); - - private final int flag; - private TransitionFlags(int flag) { - this.flag = flag; - } - - /** - * Returns the integer representation of the enum. - * @return Integer representation of the enum. - */ - public int getValue() { - return flag; - } - } - - /** - * Policy for how the Referrer HTTP header value will be sent during navigation. - * If the `--no-referrers` command-line flag is specified then the policy value - * will be ignored and the Referrer value will never be sent. - */ - public enum ReferrerPolicy { - - /** - * This is the same as REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE - * but here to match CEF native. - */ - REFERRER_POLICY_DEFAULT, - - /** - * Clear the referrer header if the header value is HTTPS but the request - * destination is HTTP. This is the default behavior. - */ - REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, - - /** - * A slight variant on CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE: - * If the request destination is HTTP, an HTTPS referrer will be cleared. If - * the request's destination is cross-origin with the referrer (but does not - * downgrade), the referrer's granularity will be stripped down to an origin - * rather than a full URL. Same-origin requests will send the full referrer. - */ - REFERRER_POLICY_REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN, - - /** - * Strip the referrer down to an origin when the origin of the referrer is - * different from the destination's origin. - */ - REFERRER_POLICY_ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN, - - /** - * Never change the referrer. - */ - REFERRER_POLICY_NEVER_CLEAR_REFERRER, - - /** - * Strip the referrer down to the origin regardless of the redirect location. - */ - REFERRER_POLICY_ORIGIN, - - /** - * Clear the referrer when the request's referrer is cross-origin with the - * request destination. - */ - REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_CROSS_ORIGIN, - - /** - * Strip the referrer down to the origin, but clear it entirely if the - * referrer value is HTTPS and the destination is HTTP. - */ - REFERRER_POLICY_ORIGIN_CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE, - - /** - * Always clear the referrer regardless of the request destination. - */ - REFERRER_POLICY_NO_REFERRER, - - /** - * Always the last value in this enumeration. - */ - REFERRER_POLICY_LAST_VALUE - } - - // This CTOR can't be called directly. Call method create() instead. - CefRequest() {} - - /** - * Create a new CefRequest object. - */ - public static final CefRequest create() { - return CefRequest_N.createNative(); - } - - /** - * Returns the globally unique identifier for this request or 0 if not - * specified. Can be used by CefRequestHandler implementations in the browser - * process to track a single request across multiple callbacks. - */ - public abstract long getIdentifier(); - - /** - * Returns true if this object is read-only. - */ - public abstract boolean isReadOnly(); - - /** - * Get the fully qualified URL. - */ - public abstract String getURL(); - - /** - * Set the fully qualified URL. - */ - public abstract void setURL(String url); - - /** - * Get the request method type. The value will default to POST if post data - * is provided and GET otherwise. - */ - public abstract String getMethod(); - - /** - * Set the request method type. - */ - public abstract void setMethod(String method); - - /** - * Set the referrer URL and policy. If non-empty the referrer URL must be - * fully qualified with an HTTP or HTTPS scheme component. Any username, - * password or ref component will be removed. - */ - public abstract void setReferrer(String url, ReferrerPolicy policy); - - /** - * Get the referrer URL. - */ - public abstract String getReferrerURL(); - - /** - * Get the referrer policy. - */ - public abstract ReferrerPolicy getReferrerPolicy(); - - /** - * Get the post data. - */ - public abstract CefPostData getPostData(); - - /** - * Set the post data. - */ - public abstract void setPostData(CefPostData postData); - - /** - * Get the header values. - */ - public abstract void getHeaderMap(Map headerMap); - - /** - * Set the header values. - */ - public abstract void setHeaderMap(Map headerMap); - - /** - * Set all values at one time. - */ - public abstract void set( - String url, String method, CefPostData postData, Map headerMap); - - /** - * Get the flags used in combination with CefURLRequest. See - * CefUrlRequestFlags for supported values. - */ - public abstract int getFlags(); - - /** - * Set the flags used in combination with CefURLRequest. See - * CefUrlRequestFlags for supported values. - */ - public abstract void setFlags(int flags); - - /** - * Get the URL to the first party for cookies used in combination with - * CefURLRequest. - */ - public abstract String getFirstPartyForCookies(); - - /** - * Set the URL to the first party for cookies used in combination with - * CefURLRequest. - */ - public abstract void setFirstPartyForCookies(String url); - - /** - * Get the resource type for this request. Accurate resource type information - * may only be available in the browser process. - */ - public abstract ResourceType getResourceType(); - - /** - * Get the transition type for this request. Only available in the browser - * process and only applies to requests that represent a main frame or - * sub-frame navigation. - */ - public abstract TransitionType getTransitionType(); - - @Override - public String toString() { - String returnValue = "\nHTTP-Request"; - returnValue += "\n flags: " + getFlags(); - returnValue += "\n resourceType: " + getResourceType(); - returnValue += "\n transitionType: " + getTransitionType(); - returnValue += "\n firstPartyForCookies: " + getFirstPartyForCookies(); - returnValue += "\n referrerURL: " + getReferrerURL(); - returnValue += "\n referrerPolicy: " + getReferrerPolicy(); - returnValue += "\n " + getMethod() + " " + getURL() + " HTTP/1.1\n"; - - Map headerMap = new HashMap<>(); - getHeaderMap(headerMap); - Set> entrySet = headerMap.entrySet(); - String mimeType = null; - for (Entry entry : entrySet) { - String key = entry.getKey(); - returnValue += " " + key + "=" + entry.getValue() + "\n"; - if (key.equals("Content-Type")) { - mimeType = entry.getValue(); - } - } - - CefPostData pd = getPostData(); - if (pd != null) { - returnValue += pd.toString(mimeType); - } - - return returnValue; - } -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefRequest_N.java b/wizard-browser/src/main/java/org/cef/network/CefRequest_N.java deleted file mode 100644 index ab1c735..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefRequest_N.java +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.Map; -import org.cef.callback.CefNative; - -class CefRequest_N extends CefRequest implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefRequest_N() { - super(); - } - - public static final CefRequest createNative() { - CefRequest_N result = new CefRequest_N(); - try { - result.N_CefRequest_CTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - if (result.N_CefHandle == 0) return null; - return result; - } - - @Override - protected void finalize() throws Throwable { - try { - N_CefRequest_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } finally { - super.finalize(); - } - } - - @Override - public long getIdentifier() { - try { - return N_GetIdentifier(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public boolean isReadOnly() { - try { - return N_IsReadOnly(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public String getURL() { - try { - return N_GetURL(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setURL(String url) { - try { - N_SetURL(url); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public String getMethod() { - try { - return N_GetMethod(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setMethod(String string) { - try { - N_SetMethod(string); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setReferrer(String url, ReferrerPolicy policy) { - try { - N_SetReferrer(url, policy); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public String getReferrerURL() { - try { - return N_GetReferrerURL(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public ReferrerPolicy getReferrerPolicy() { - try { - return N_GetReferrerPolicy(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public CefPostData getPostData() { - try { - return N_GetPostData(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setPostData(CefPostData postData) { - try { - N_SetPostData(postData); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void getHeaderMap(Map headerMap) { - try { - N_GetHeaderMap(headerMap); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setHeaderMap(Map headerMap) { - try { - N_SetHeaderMap(headerMap); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void set( - String url, String method, CefPostData postData, Map headerMap) { - try { - N_Set(url, method, postData, headerMap); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public int getFlags() { - try { - return N_GetFlags(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public void setFlags(int flags) { - try { - N_SetFlags(flags); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public String getFirstPartyForCookies() { - try { - return N_GetFirstPartyForCookies(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setFirstPartyForCookies(String url) { - try { - N_SetFirstPartyForCookies(url); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public ResourceType getResourceType() { - try { - return N_GetResourceType(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return ResourceType.RT_MAIN_FRAME; - } - - @Override - public TransitionType getTransitionType() { - try { - return N_GetTransitionType(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return TransitionType.TT_AUTO_SUBFRAME; - } - - private final native void N_CefRequest_CTOR(); - private final native long N_GetIdentifier(); - private final native boolean N_IsReadOnly(); - private final native String N_GetURL(); - private final native void N_SetURL(String url); - private final native String N_GetMethod(); - private final native void N_SetMethod(String method); - private final native void N_SetReferrer(String url, ReferrerPolicy policy); - private final native String N_GetReferrerURL(); - private final native ReferrerPolicy N_GetReferrerPolicy(); - private final native CefPostData N_GetPostData(); - private final native void N_SetPostData(CefPostData postData); - private final native void N_GetHeaderMap(Map headerMap); - private final native void N_SetHeaderMap(Map headerMap); - private final native void N_Set( - String url, String method, CefPostData postData, Map headerMap); - private final native int N_GetFlags(); - private final native void N_SetFlags(int flags); - private final native String N_GetFirstPartyForCookies(); - private final native void N_SetFirstPartyForCookies(String url); - private final native ResourceType N_GetResourceType(); - private final native TransitionType N_GetTransitionType(); - private final native void N_CefRequest_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefResponse.java b/wizard-browser/src/main/java/org/cef/network/CefResponse.java deleted file mode 100644 index fa06383..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefResponse.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.Map.Entry; -import org.cef.handler.CefLoadHandler.ErrorCode; - -/** - * Class used to represent a web response. The methods of this class may be - * called on any thread. - */ -public abstract class CefResponse { - // This CTOR can't be called directly. Call method create() instead. - CefResponse() {} - - /** - * Create a new CefRequest object. - */ - public static final CefResponse create() { - return CefResponse_N.createNative(); - } - - /** - * Returns true if this object is read-only. - */ - public abstract boolean isReadOnly(); - - /** - * Get the response error code. Returns ERR_NONE if there was no error. - */ - public abstract ErrorCode getError(); - - /** - * Get the response error code. Returns ERR_NONE if there was no error. - */ - public abstract void setError(ErrorCode errorCode); - - /** - * Get the response status code. - */ - public abstract int getStatus(); - - /** - * Set the response status code. - */ - public abstract void setStatus(int status); - - /** - * Get the response status text. - */ - public abstract String getStatusText(); - - /** - * Set the response status text. - */ - public abstract void setStatusText(String statusText); - - /** - * Get the response mime type. - */ - public abstract String getMimeType(); - - /** - * Set the response mime type. - */ - public abstract void setMimeType(String mimeType); - - /** - * Get the value for the specified response header field. - */ - public abstract String getHeader(String name); - - /** - * Get all response header fields. - */ - public abstract void getHeaderMap(Map headerMap); - - /** - * Set all response header fields. - */ - public abstract void setHeaderMap(Map headerMap); - - @Override - public String toString() { - String returnValue = "\nHTTP-Response:"; - - returnValue += "\n error: " + getError(); - returnValue += "\n readOnly: " + isReadOnly(); - returnValue += "\n HTTP/1.1 " + getStatus() + " " + getStatusText(); - returnValue += "\n Content-Type: " + getMimeType(); - - Map headerMap = new HashMap<>(); - getHeaderMap(headerMap); - Set> entrySet = headerMap.entrySet(); - for (Entry entry : entrySet) { - returnValue += " " + entry.getKey() + "=" + entry.getValue() + "\n"; - } - - return returnValue; - } -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefResponse_N.java b/wizard-browser/src/main/java/org/cef/network/CefResponse_N.java deleted file mode 100644 index a68472d..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefResponse_N.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import java.util.Map; -import org.cef.callback.CefNative; -import org.cef.handler.CefLoadHandler.ErrorCode; - -class CefResponse_N extends CefResponse implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefResponse_N() { - super(); - } - - public static final CefResponse createNative() { - CefResponse_N result = new CefResponse_N(); - try { - result.N_CefResponse_CTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - if (result.N_CefHandle == 0) return null; - return result; - } - - @Override - protected void finalize() throws Throwable { - try { - N_CefResponse_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } finally { - super.finalize(); - } - } - - @Override - public boolean isReadOnly() { - try { - return N_IsReadOnly(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return false; - } - - @Override - public ErrorCode getError() { - try { - return N_GetError(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setError(ErrorCode errorCode) { - try { - N_SetError(errorCode); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public int getStatus() { - try { - return N_GetStatus(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return 0; - } - - @Override - public void setStatus(int status) { - try { - N_SetStatus(status); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public String getStatusText() { - try { - return N_GetStatusText(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setStatusText(String statusText) { - try { - N_SetStatusText(statusText); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public String getMimeType() { - try { - return N_GetMimeType(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void setMimeType(String mimeType) { - try { - N_SetMimeType(mimeType); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public String getHeader(String name) { - try { - return N_GetHeader(name); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void getHeaderMap(Map headerMap) { - try { - N_GetHeaderMap(headerMap); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void setHeaderMap(Map headerMap) { - try { - N_SetHeaderMap(headerMap); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_CefResponse_CTOR(); - private final native boolean N_IsReadOnly(); - private final native ErrorCode N_GetError(); - private final native void N_SetError(ErrorCode errorCode); - private final native int N_GetStatus(); - private final native void N_SetStatus(int status); - private final native String N_GetStatusText(); - private final native void N_SetStatusText(String statusText); - private final native String N_GetMimeType(); - private final native void N_SetMimeType(String mimeType); - private final native String N_GetHeader(String name); - private final native void N_GetHeaderMap(Map headerMap); - private final native void N_SetHeaderMap(Map headerMap); - private final native void N_CefResponse_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefURLRequest.java b/wizard-browser/src/main/java/org/cef/network/CefURLRequest.java deleted file mode 100644 index 53802a7..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefURLRequest.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import org.cef.callback.CefURLRequestClient; -import org.cef.handler.CefLoadHandler.ErrorCode; - -/** - * Class used to make a URL request. URL requests are not associated with a - * browser instance so no CefClient callbacks will be executed. URL requests - * can be created on any valid CEF thread in either the browser or render - * process. Once created the methods of the URL request object must be accessed - * on the same thread that created it. - */ -public abstract class CefURLRequest { - public static enum Status { - UR_UNKNOWN, - UR_SUCCESS, - UR_IO_PENDING, - UR_CANCELED, - UR_FAILED, - } - - // This CTOR can't be called directly. Call method create() instead. - CefURLRequest() {} - - /** - * Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request - * methods are supported. Multiple post data elements are not supported and - * elements of type PDE_TYPE_FILE are only supported for requests originating - * from the browser process. Requests originating from the render process will - * receive the same handling as requests originating from Web content -- if - * the response contains Content-Disposition or Mime-Type header values that - * would not normally be rendered then the response may receive special - * handling inside the browser (for example, via the file download code path - * instead of the URL request code path). The |request| object will be marked - * as read-only after calling this method. - */ - public static final CefURLRequest create(CefRequest request, CefURLRequestClient client) { - return CefURLRequest_N.createNative(request, client); - } - - public abstract void finalize(); - - /** - * Returns the request object used to create this URL request. The returned - * object is read-only and should not be modified. - */ - public abstract CefRequest getRequest(); - - /** - * Returns the client. - */ - public abstract CefURLRequestClient getClient(); - - /** - * Returns the request status. - */ - public abstract Status getRequestStatus(); - - /** - * Returns the request error if status is UR_CANCELED or UR_FAILED, or 0 - * otherwise. - */ - public abstract ErrorCode getRequestError(); - - /** - * Returns the response, or NULL if no response information is available. - * Response information will only be available after the upload has completed. - * The returned object is read-only and should not be modified. - */ - public abstract CefResponse getResponse(); - - /** - * Cancel the request. - */ - public abstract void cancel(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefURLRequest_N.java b/wizard-browser/src/main/java/org/cef/network/CefURLRequest_N.java deleted file mode 100644 index d75bc68..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefURLRequest_N.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import org.cef.callback.CefURLRequestClient; -import org.cef.callback.CefNative; -import org.cef.handler.CefLoadHandler.ErrorCode; - -class CefURLRequest_N extends CefURLRequest implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - private final CefRequest request_; - private final CefURLRequestClient client_; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefURLRequest_N(CefRequest request, CefURLRequestClient client) { - super(); - request_ = request; - client_ = client; - } - - public static final CefURLRequest createNative(CefRequest request, CefURLRequestClient client) { - // keep a reference to the request and client objects. - CefURLRequest_N result = new CefURLRequest_N(request, client); - try { - result.N_CefURLRequest_CTOR(request, client); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - if (result.N_CefHandle == 0) return null; - return result; - } - - @Override - public void finalize() { - try { - N_CefURLRequest_DTOR(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public CefRequest getRequest() { - return request_; - } - - @Override - public CefURLRequestClient getClient() { - return client_; - } - - @Override - public Status getRequestStatus() { - try { - return N_GetRequestStatus(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public ErrorCode getRequestError() { - try { - return N_GetRequestError(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public CefResponse getResponse() { - try { - return N_GetResponse(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public void cancel() { - try { - N_Cancel(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_CefURLRequest_CTOR(CefRequest request, CefURLRequestClient client); - private final native Status N_GetRequestStatus(); - private final native ErrorCode N_GetRequestError(); - private final native CefResponse N_GetResponse(); - private final native void N_Cancel(); - private final native void N_CefURLRequest_DTOR(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefWebPluginInfo.java b/wizard-browser/src/main/java/org/cef/network/CefWebPluginInfo.java deleted file mode 100644 index 11bcd23..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefWebPluginInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -/** - * Information about a specific web plugin. - */ -public interface CefWebPluginInfo { - /** - * Returns the plugin name (i.e. Flash). - */ - public String getName(); - - /** - * Returns the plugin file path (DLL/bundle/library). - */ - public String getPath(); - - /** - * Returns the version of the plugin (may be OS-specific). - */ - public String getVersion(); - - /** - * Returns a description of the plugin from the version information. - */ - public String getDescription(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefWebPluginInfo_N.java b/wizard-browser/src/main/java/org/cef/network/CefWebPluginInfo_N.java deleted file mode 100644 index fe4f3ce..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefWebPluginInfo_N.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import org.cef.callback.CefNativeAdapter; - -class CefWebPluginInfo_N extends CefNativeAdapter implements CefWebPluginInfo { - @Override - public String getName() { - try { - return N_GetName(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getPath() { - try { - return N_GetPath(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getVersion() { - try { - return N_GetVersion(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - @Override - public String getDescription() { - try { - return N_GetDescription(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - return null; - } - - private final native String N_GetName(); - private final native String N_GetPath(); - private final native String N_GetVersion(); - private final native String N_GetDescription(); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefWebPluginManager.java b/wizard-browser/src/main/java/org/cef/network/CefWebPluginManager.java deleted file mode 100644 index 9a4c749..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefWebPluginManager.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import org.cef.callback.CefWebPluginInfoVisitor; -import org.cef.callback.CefWebPluginUnstableCallback; - -/** - * Class used to manage web plugins. - */ -public abstract class CefWebPluginManager { - // This CTOR can't be called directly. Call method create() instead. - CefWebPluginManager() {} - - /** - * Returns the global plugin manager. - */ - public static final CefWebPluginManager getGlobalManager() { - return CefWebPluginManager_N.getInstance(); - } - - /** - * Visit web plugin information. Can be called on any thread in the browser - * process. - * @param visitor Called with plugin information when available. - */ - public abstract void visitPlugins(CefWebPluginInfoVisitor visitor); - - /** - * Cause the plugin list to refresh the next time it is accessed regardless - * of whether it has already been loaded. Can be called on any thread in the - * browser process. - */ - public abstract void refreshPlugins(); - - /** - * Unregister an internal plugin. This may be undone the next time - * CefRefreshWebPlugins() is called. Can be called on any thread in the browser - * process. - */ - public abstract void unregisterInternalPlugin(String path); - - /** - * Register a plugin crash. Can be called on any thread in the browser process - * but will be executed on the IO thread. - */ - public abstract void registerPluginCrash(String path); - - /** - * Query if a plugin is unstable. Can be called on any thread in the browser - * process. - */ - public abstract void isWebPluginUnstable(String path, CefWebPluginUnstableCallback callback); -} diff --git a/wizard-browser/src/main/java/org/cef/network/CefWebPluginManager_N.java b/wizard-browser/src/main/java/org/cef/network/CefWebPluginManager_N.java deleted file mode 100644 index 592e020..0000000 --- a/wizard-browser/src/main/java/org/cef/network/CefWebPluginManager_N.java +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -package org.cef.network; - -import org.cef.callback.CefNative; -import org.cef.callback.CefWebPluginInfoVisitor; -import org.cef.callback.CefWebPluginUnstableCallback; - -class CefWebPluginManager_N extends CefWebPluginManager implements CefNative { - // Used internally to store a pointer to the CEF object. - private long N_CefHandle = 0; - private static CefWebPluginManager_N instance = null; - - @Override - public void setNativeRef(String identifer, long nativeRef) { - N_CefHandle = nativeRef; - } - - @Override - public long getNativeRef(String identifer) { - return N_CefHandle; - } - - CefWebPluginManager_N() { - super(); - } - - public static synchronized CefWebPluginManager_N getInstance() { - if (instance == null) instance = new CefWebPluginManager_N(); - return instance; - } - - @Override - public void visitPlugins(CefWebPluginInfoVisitor visitor) { - try { - N_VisitPlugins(visitor); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void refreshPlugins() { - try { - N_RefreshPlugins(); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void unregisterInternalPlugin(String path) { - try { - N_UnregisterInternalPlugin(path); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void registerPluginCrash(String path) { - try { - N_RegisterPluginCrash(path); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - @Override - public void isWebPluginUnstable(String path, CefWebPluginUnstableCallback callback) { - try { - N_IsWebPluginUnstable(path, callback); - } catch (UnsatisfiedLinkError ule) { - ule.printStackTrace(); - } - } - - private final native void N_VisitPlugins(CefWebPluginInfoVisitor visitor); - private final native void N_RefreshPlugins(); - private final native void N_UnregisterInternalPlugin(String path); - private final native void N_RegisterPluginCrash(String path); - private final native void N_IsWebPluginUnstable( - String path, CefWebPluginUnstableCallback callback); -} diff --git a/wizard-browser/src/main/java/org/develnext/framework/wizard/desktop/WizardBrowser.java b/wizard-browser/src/main/java/org/develnext/framework/wizard/desktop/WizardBrowser.java deleted file mode 100644 index 92724f2..0000000 --- a/wizard-browser/src/main/java/org/develnext/framework/wizard/desktop/WizardBrowser.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.develnext.framework.wizard.desktop; - -import org.cef.CefApp; -import org.cef.CefClient; -import org.cef.CefSettings; -import org.cef.OS; -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.browser.CefMessageRouter; -import org.cef.callback.CefQueryCallback; -import org.cef.handler.CefAppHandlerAdapter; -import org.cef.handler.CefLifeSpanHandlerAdapter; -import org.cef.handler.CefMessageRouterHandlerAdapter; - -import javax.swing.*; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -public class WizardBrowser extends JFrame { - private final CefApp cefApp; - private final CefClient cefClient; - private final CefBrowser cefBrowser; - - public static void initialize() { - CefSettings cefSettings = new CefSettings(); - cefSettings.windowless_rendering_enabled = OS.isLinux(); - - CefApp.getInstance(cefSettings); - } - - public WizardBrowser() { - CefApp.addAppHandler(new CefAppHandlerAdapter(null) { - @Override - public void stateHasChanged(CefApp.CefAppState state) { - // Shutdown the app if the native CEF part is terminated - if (state == CefApp.CefAppState.TERMINATED) System.exit(0); - } - }); - - CefSettings cefSettings = new CefSettings(); - cefSettings.windowless_rendering_enabled = OS.isLinux(); - - cefApp = CefApp.getInstance(cefSettings); - cefClient = cefApp.createClient(); - CefMessageRouter messageRouter = CefMessageRouter.create(); - messageRouter.addHandler(new CefMessageRouterHandlerAdapter() { - @Override - public boolean onQuery(CefBrowser browser, CefFrame frame, long query_id, String request, boolean persistent, CefQueryCallback callback) { - return super.onQuery(browser, frame, query_id, request, persistent, callback); - } - }, false); - - cefClient.addMessageRouter(messageRouter); - - cefClient.addLifeSpanHandler(new CefLifeSpanHandlerAdapter() { - @Override - public void onAfterCreated(CefBrowser browser) { - super.onAfterCreated(browser); - } - }); - cefBrowser = cefClient.createBrowser(null, OS.isLinux(), false); - getContentPane().add(cefBrowser.getUIComponent()); - - pack(); - setSize(800, 600); - setLocationRelativeTo(null); - setVisible(true); - - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - dispose(); - cefClient.onBeforeClose(cefBrowser); - cefClient.doClose(cefBrowser); - - cefClient.dispose(); - cefApp.dispose(); - } - }); - } - - public void loadURL(String url) { - cefBrowser.stopLoad(); - cefBrowser.loadURL(url); - } - - public void loadString(String html, String baseUrl) { - cefBrowser.loadString(html, baseUrl); - } -} diff --git a/wizard-browser/src/main/java/org/develnext/framework/wizard/desktop/WizardBrowserSandbox.java b/wizard-browser/src/main/java/org/develnext/framework/wizard/desktop/WizardBrowserSandbox.java deleted file mode 100644 index ea647e3..0000000 --- a/wizard-browser/src/main/java/org/develnext/framework/wizard/desktop/WizardBrowserSandbox.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.develnext.framework.wizard.desktop; - -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -public class WizardBrowserSandbox { - public static void main(String[] args) { - WizardBrowser browser = new WizardBrowser(); - browser.addWindowListener(new WindowAdapter() { - @Override - public void windowOpened(WindowEvent e) { - browser.loadURL("http://bash.im"); - } - }); - } -} diff --git a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/JCefExtension.java b/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/JCefExtension.java deleted file mode 100644 index 13dce30..0000000 --- a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/JCefExtension.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.develnext.jphp.ext.jcef; - -import org.cef.CefApp; -import org.cef.CefClient; -import org.cef.CefSettings; -import org.cef.OS; -import org.cef.browser.CefBrowser; -import org.cef.callback.CefCallback; -import org.cef.handler.CefAppHandlerAdapter; -import org.cef.network.CefResponse; -import org.develnext.framework.wizard.desktop.WizardBrowser; -import org.develnext.jphp.ext.jcef.classes.*; -import php.runtime.env.CompileScope; -import php.runtime.ext.support.Extension; - -public class JCefExtension extends Extension { - public static final String NS = "cef"; - - @Override - public Status getStatus() { - return Status.EXPERIMENTAL; - } - - @Override - public void onRegister(CompileScope compileScope) { - WizardBrowser.initialize(); - - //CefApp instance = CefApp.getInstance(cefSettings); - - registerWrapperClass(compileScope, CefApp.class, PCefApp.class); - registerWrapperClass(compileScope, CefClient.class, PCefClient.class); - registerWrapperClass(compileScope, CefBrowser.class, PCefBrowser.class); - registerClass(compileScope, PCefBrowserWindow.class); - - registerWrapperClass(compileScope, CefCallback.class, PCefCallback.class); - registerWrapperClass(compileScope, CefResponse.class, PCefResponse.class); - registerClass(compileScope, PCefResourceHandler.class); - } -} diff --git a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefApp.java b/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefApp.java deleted file mode 100644 index b0098b9..0000000 --- a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefApp.java +++ /dev/null @@ -1,288 +0,0 @@ -package org.develnext.jphp.ext.jcef.classes; - -import org.cef.CefApp; -import org.cef.CefSettings; -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.callback.CefCallback; -import org.cef.callback.CefCommandLine; -import org.cef.callback.CefSchemeHandlerFactory; -import org.cef.callback.CefSchemeRegistrar; -import org.cef.handler.*; -import org.cef.misc.IntRef; -import org.cef.misc.StringRef; -import org.cef.network.CefCookie; -import org.cef.network.CefRequest; -import org.cef.network.CefResponse; -import org.develnext.jphp.ext.jcef.JCefExtension; -import php.runtime.Memory; -import php.runtime.annotation.Reflection.Name; -import php.runtime.annotation.Reflection.Namespace; -import php.runtime.annotation.Reflection.Signature; -import php.runtime.env.Environment; -import php.runtime.exceptions.CriticalException; -import php.runtime.ext.core.classes.stream.MemoryStream; -import php.runtime.ext.core.classes.stream.MiscStream; -import php.runtime.ext.core.classes.stream.Stream; -import php.runtime.invoke.DynamicMethodInvoker; -import php.runtime.invoke.Invoker; -import php.runtime.lang.BaseWrapper; -import php.runtime.lang.IObject; -import php.runtime.memory.ArrayMemory; -import php.runtime.memory.BinaryMemory; -import php.runtime.memory.ObjectMemory; -import php.runtime.memory.StringMemory; -import php.runtime.reflection.ClassEntity; -import php.runtime.reflection.support.ReflectionUtils; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -@Name("CefApp") -@Namespace(JCefExtension.NS) -public class PCefApp extends BaseWrapper { - public PCefApp(Environment env, CefApp wrappedObject) { - super(env, wrappedObject); - } - - public PCefApp(Environment env, ClassEntity clazz) { - super(env, clazz); - } - - private static List appHandlerAdapters = null; - - @Signature - private void __construct() { - getWrappedObject().getVersion(); - } - - @Signature - public Memory getVersion(Environment env) { - return ArrayMemory.ofNullableBean(env, getWrappedObject().getVersion()); - } - - @Signature - public void dispose() { - getWrappedObject().dispose(); - } - - @Signature - public PCefClient createClient(Environment env) { - return new PCefClient(env, getWrappedObject().createClient()); - } - - @Signature - public void setSettings(Environment env, ArrayMemory settings) { - getWrappedObject().setSettings(settings.toBean(env, CefSettings.class)); - } - - @Signature - public static CefApp.CefAppState getState() { - return CefApp.getState(); - } - - @Signature - public static CefApp getInstance(Environment env) { - return CefApp.getInstance(); - } - - @Signature - public static CefApp getInstance(Environment env, String[] args) { - return getInstance(env, args, new ArrayMemory()); - } - - @Signature - public static CefApp getInstance(Environment env, String[] args, ArrayMemory settings) { - CefSettings cefSettings = settings.toBean(env, CefSettings.class); - return CefApp.getInstance(args, cefSettings); - } - - private static List getAppHandlerAdapters() { - if (appHandlerAdapters == null) { - appHandlerAdapters = new ArrayList<>(); - CefApp.addAppHandler( - new CefAppHandlerAdapter(null) { - @Override - public void onBeforeCommandLineProcessing(String process_type, CefCommandLine command_line) { - appHandlerAdapters.forEach(el -> el.onBeforeCommandLineProcessing(process_type, command_line)); - } - - @Override - public boolean onBeforeTerminate() { - return appHandlerAdapters.stream().map(el -> el.onBeforeTerminate()).anyMatch(aBoolean -> aBoolean); - } - - @Override - public void stateHasChanged(CefApp.CefAppState state) { - appHandlerAdapters.forEach(el -> el.stateHasChanged(state)); - } - - @Override - public void onRegisterCustomSchemes(CefSchemeRegistrar registrar) { - appHandlerAdapters.forEach(el -> el.onRegisterCustomSchemes(registrar)); - } - - @Override - public void onContextInitialized() { - appHandlerAdapters.forEach(el -> el.onContextInitialized()); - } - - @Override - public CefPrintHandler getPrintHandler() { - return super.getPrintHandler(); - } - - @Override - public void onScheduleMessagePumpWork(long delay_ms) { - super.onScheduleMessagePumpWork(delay_ms); - } - } - ); - } - - return appHandlerAdapters; - } - - @Signature - public static void onBeforeTerminate(Invoker invoker) { - getAppHandlerAdapters().add(new CefAppHandlerAdapter(new String[0]) { - @Override - public boolean onBeforeTerminate() { - return invoker.callAny().toBoolean(); - } - }); - } - - @Signature - public static void onContextInitialized(Invoker invoker) { - getAppHandlerAdapters().add(new CefAppHandlerAdapter(new String[0]) { - @Override - public void onContextInitialized() { - invoker.callAny(); - } - }); - } - - @Signature - public static void onStateChanged(Invoker invoker) { - getAppHandlerAdapters().add(new CefAppHandlerAdapter(new String[0]) { - @Override - public void stateHasChanged(CefApp.CefAppState state) { - invoker.callAny(state); - } - }); - } - - @Signature - public static void registerCustomScheme(Environment env, String schemeName, Invoker factory) { - registerCustomScheme(env, schemeName, factory, true); - } - - @Signature - public static void registerCustomScheme(Environment env, String schemeName, Invoker factory, boolean isStandard) { - getAppHandlerAdapters().add(new CefAppHandlerAdapter(new String[0]) { - @Override - public void onRegisterCustomSchemes(CefSchemeRegistrar registrar) { - registrar.addCustomScheme( - schemeName, - true, false, false, - false, false, false - ); - } - - @Override - public void onContextInitialized() { - CefApp cefApp = CefApp.getInstance(); - cefApp.registerSchemeHandlerFactory(schemeName, "", (browser, frame, schemeName1, request) -> { - Memory handler = factory.callAny( - new PCefBrowser(env, browser), schemeName, ArrayMemory.ofNullableBean(env, request) - ); - - if (handler.isNull()) return null; - - if (!handler.instanceOf(PCefResourceHandler.class)) { - env.exception("Invoker must return an instance of " + ReflectionUtils.getClassName(PCefResourceHandler.class) + ", " + ReflectionUtils.getGivenName(handler) + " given"); - } - - Invoker processRequest = Invoker.create(env, ArrayMemory.of(handler, StringMemory.valueOf("processRequest"))); - Invoker getResponseHeaders = Invoker.create(env, ArrayMemory.of(handler, StringMemory.valueOf("getResponseHeaders"))); - Invoker readResponse = Invoker.create(env, ArrayMemory.of(handler, StringMemory.valueOf("readResponse"))); - Invoker canGetCookie = Invoker.create(env, ArrayMemory.of(handler, StringMemory.valueOf("canGetCookie"))); - Invoker canSetCookie = Invoker.create(env, ArrayMemory.of(handler, StringMemory.valueOf("canSetCookie"))); - Invoker cancel = Invoker.create(env, ArrayMemory.of(handler, StringMemory.valueOf("cancel"))); - - return new CefResourceHandler() { - @Override - public boolean processRequest(CefRequest request, CefCallback callback) { - return processRequest.callAny(ArrayMemory.ofNullableBean(env, request), new PCefCallback(env, callback)).toBoolean(); - } - - @Override - public void getResponseHeaders(CefResponse response, IntRef response_length, StringRef redirectUrl) { - ArrayMemory array = ArrayMemory.ofPair("length", response_length.get()); - array.put("redirectUrl", StringMemory.valueOf(redirectUrl.get())); - - Memory result = getResponseHeaders.callAny(new PCefResponse(env, response), array); - - if (result.isArray()) { - ArrayMemory arrayMemory = result.toValue(ArrayMemory.class); - if (arrayMemory.containsKey("length")) { - response_length.set(arrayMemory.valueOfIndex("length").toInteger()); - } - - if (arrayMemory.containsKey("redirectUrl")) { - redirectUrl.set(arrayMemory.valueOfIndex("redirectUrl").toString()); - } - } - } - - @Override - public boolean readResponse(byte[] data_out, int bytes_to_read, IntRef bytes_read, CefCallback callback) { - MemoryStream memoryStream = new MemoryStream(); - MiscStream out = new MiscStream(env, memoryStream); - readResponse.callAny(out, bytes_to_read, new PCefCallback(env, callback)).toBoolean(); - memoryStream.seek(0); - - byte[] srcBinaryBytes = memoryStream.readFully(); - - if (srcBinaryBytes == null || srcBinaryBytes.length == 0) { - bytes_read.set(0); - return false; - } else { - bytes_read.set(srcBinaryBytes.length); - System.arraycopy(srcBinaryBytes, 0, data_out, 0, srcBinaryBytes.length); - return true; - } - } - - @Override - public boolean canGetCookie(CefCookie cookie) { - return canGetCookie.callAny(ArrayMemory.ofNullableBean(env, cookie)).toBoolean(); - } - - @Override - public boolean canSetCookie(CefCookie cookie) { - return canSetCookie.callAny(ArrayMemory.ofNullableBean(env, cookie)).toBoolean(); - } - - @Override - public void cancel() { - cancel.callAny(); - } - - @Override - public void setNativeRef(String identifer, long nativeRef) { - } - - @Override - public long getNativeRef(String identifer) { - return 0; - } - }; - }); - } - }); - } -} diff --git a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefBrowser.java b/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefBrowser.java deleted file mode 100644 index 2be037c..0000000 --- a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefBrowser.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.develnext.jphp.ext.jcef.classes; - -import org.cef.browser.CefBrowser; -import org.develnext.jphp.ext.jcef.JCefExtension; -import php.runtime.annotation.Reflection; -import php.runtime.annotation.Reflection.Name; -import php.runtime.annotation.Reflection.Namespace; -import php.runtime.annotation.Reflection.Nullable; -import php.runtime.annotation.Reflection.Signature; -import php.runtime.env.Environment; -import php.runtime.lang.BaseWrapper; -import php.runtime.reflection.ClassEntity; - - -@Name("CefBrowser") -@Namespace(JCefExtension.NS) -public class PCefBrowser extends BaseWrapper { - public PCefBrowser(Environment env, CefBrowser wrappedObject) { - super(env, wrappedObject); - } - - public PCefBrowser(Environment env, ClassEntity clazz) { - super(env, clazz); - } - - @Signature - private void __construct() { - } - - @Signature - public void executeJavaScript(String script) { - executeJavaScript(script, null); - } - - @Signature - public void executeJavaScript(String script, @Nullable String url) { - executeJavaScript(script, url, 0); - } - - @Signature - public void executeJavaScript(String script, @Nullable String url, int line) { - getWrappedObject().executeJavaScript(script, url, line); - } - - @Signature - public PCefBrowser getDevTools(Environment env) { - CefBrowser cefBrowser = getWrappedObject().getDevTools(); - return new PCefBrowser(env, cefBrowser); - } -} diff --git a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefBrowserWindow.java b/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefBrowserWindow.java deleted file mode 100644 index a148079..0000000 --- a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefBrowserWindow.java +++ /dev/null @@ -1,370 +0,0 @@ -package org.develnext.jphp.ext.jcef.classes; - -import org.cef.browser.CefBrowser; -import org.develnext.jphp.ext.jcef.JCefExtension; -import php.runtime.annotation.Reflection; -import php.runtime.annotation.Reflection.Getter; -import php.runtime.annotation.Reflection.Setter; -import php.runtime.annotation.Reflection.Signature; -import php.runtime.env.Environment; -import php.runtime.invoke.Invoker; -import php.runtime.lang.BaseObject; -import php.runtime.reflection.ClassEntity; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -@Reflection.Name("CefBrowserWindow") -@Reflection.Namespace(JCefExtension.NS) -public class PCefBrowserWindow extends BaseObject { - private Window frame; - private boolean alwaysOnTop = false; - - public PCefBrowserWindow(Environment env, Window wrappedObject) { - super(env); - frame = wrappedObject; - } - - public PCefBrowserWindow(Environment env, ClassEntity clazz) { - super(env, clazz); - } - - @Signature - public void __construct(CefBrowser browser) { - __construct(browser, false, false); - } - - @Signature - public void __construct(CefBrowser browser, boolean asDialog) { - __construct(browser, asDialog, false); - } - - @Signature - public void __construct(CefBrowser browser, boolean asDialog, boolean undecorated) { - if (asDialog) { - JDialog jDialog = new JDialog(); - jDialog.setUndecorated(undecorated); - jDialog.getContentPane().add(browser.getUIComponent()); - jDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - jDialog.setResizable(false); - - this.frame = jDialog; - } else { - JFrame jframe = new JFrame(); - jframe.setUndecorated(undecorated); - jframe.getContentPane().add(browser.getUIComponent()); - jframe.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - jframe.setResizable(false); - - frame = jframe; - } - } - - @Getter - public boolean getEnabled() { - return frame.isEnabled(); - } - - @Setter - public void setEnabled(boolean value) { - frame.setEnabled(value); - } - - @Getter - public boolean getActive() { - return frame.isActive(); - } - - @Getter - public int[] getInnerSize() { - Container contentPane = null; - - if (frame instanceof JFrame) { - contentPane = ((JFrame) frame).getContentPane(); - } else if (frame instanceof JDialog) { - contentPane = ((JDialog) frame).getContentPane(); - } - - if (contentPane == null) { - return new int[] { -1, -1 }; - } - - return new int[] { contentPane.getWidth(), contentPane.getHeight() }; - } - - @Setter - public void setInnerSize(int[] size) { - Container contentPane = null; - - if (frame instanceof JFrame) { - contentPane = ((JFrame) frame).getContentPane(); - } else if (frame instanceof JDialog) { - contentPane = ((JDialog) frame).getContentPane(); - } - - if (contentPane == null) { - return; - } - - contentPane.setPreferredSize(new Dimension(size[0], size[1])); - contentPane.setSize(size[0], size[1]); - frame.pack(); - } - - @Setter - public void setSize(int[] size) { - if (size.length >= 2) { - frame.setSize(size[0], size[1]); - } - } - - @Getter - public int[] getSize() { - return new int[]{frame.getSize().width, frame.getSize().height}; - } - - @Setter - public void setPosition(int[] pos) { - if (pos.length >= 2) { - frame.setLocation(pos[0], pos[1]); - } - } - - @Getter - public float getOpacity() { - return frame.getOpacity(); - } - - @Setter - public void setOpacity(float opacity) { - frame.setOpacity(opacity); - } - - @Getter - public int[] getPosition() { - Point location = frame.getLocation(); - return new int[]{location.x, location.y}; - } - - @Getter - public String getTitle() { - if (frame instanceof JDialog) { - return ((JDialog) frame).getTitle(); - } else if (frame instanceof JFrame) { - return ((JFrame) frame).getTitle(); - } - - return null; - } - - @Setter - public void setTitle(String title) { - if (frame instanceof JDialog) { - ((JDialog) frame).setTitle(title); - } else if (frame instanceof JFrame) { - ((JFrame) frame).setTitle(title); - } - } - - @Getter - public boolean getAlwaysOnTop() { - return alwaysOnTop; - } - - @Setter - public void setAlwaysOnTop(boolean value) { - frame.setAlwaysOnTop(value); - this.alwaysOnTop = value; - } - - @Getter - public Window.Type getType() { - return frame.getType(); - } - - @Setter - public void setType(Window.Type type) { - frame.setType(type); - } - - @Setter - public void setResizable(boolean value) { - if (frame instanceof Frame) { - ((Frame) frame).setResizable(value); - } else if (frame instanceof Dialog) { - ((Dialog) frame).setResizable(value); - } - } - - @Getter - public boolean getResizable() { - if (frame instanceof Frame) { - return ((Frame) frame).isResizable(); - } else if (frame instanceof Dialog) { - return ((Dialog) frame).isResizable(); - } - - return false; - } - - @Setter - public void setUndecorated(boolean value) { - if (frame instanceof Frame) { - ((Frame) frame).setUndecorated(value); - } else if (frame instanceof Dialog) { - ((Dialog) frame).setUndecorated(value); - } - } - - @Getter - public boolean getUndecorated() { - if (frame instanceof Frame) { - return ((Frame) frame).isUndecorated(); - } else if (frame instanceof Dialog) { - return ((Dialog) frame).isUndecorated(); - } - - return false; - } - - @Setter - public void setModal(boolean value) { - if (frame instanceof Frame) { - throw new IllegalStateException("Only dialogs can be modal"); - } else if (frame instanceof Dialog) { - ((Dialog) frame).setModal(value); - } - } - - @Getter - public boolean getModal() { - if (frame instanceof Frame) { - throw new IllegalStateException("Only dialogs can be modal"); - } else if (frame instanceof Dialog) { - return ((Dialog) frame).isModal(); - } - - return false; - } - - @Signature - public void show() { - frame.setVisible(true); - } - - @Signature - public void hide() { - frame.setVisible(false); - } - - @Signature - public void free() { - frame.dispose(); - } - - @Signature - public void centerOnScreen() { - frame.setLocationRelativeTo(null); - } - - @Signature - public void toFront() { - frame.toFront(); - } - - @Signature - public void toBack() { - frame.toBack(); - } - - @Signature - public void onClosed(Invoker invoker) { - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowClosed(WindowEvent e) { - invoker.callAny(PCefBrowserWindow.this); - } - }); - } - - @Signature - public void onActivated(Invoker invoker) { - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowActivated(WindowEvent e) { - invoker.callAny(PCefBrowserWindow.this); - } - }); - } - - @Signature - public void onDeactivated(Invoker invoker) { - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowDeactivated(WindowEvent e) { - invoker.callAny(PCefBrowserWindow.this); - } - }); - } - - @Signature - public void onClosing(Invoker invoker) { - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - invoker.callAny(PCefBrowserWindow.this); - } - }); - } - - @Signature - public void onOpened(Invoker invoker) { - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowOpened(WindowEvent e) { - invoker.callAny(PCefBrowserWindow.this); - } - }); - } - - @Signature - public void onIconified(Invoker invoker) { - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowIconified(WindowEvent e) { - invoker.callAny(PCefBrowserWindow.this); - } - }); - } - - @Signature - public void onDeiconified(Invoker invoker) { - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowDeiconified(WindowEvent e) { - invoker.callAny(PCefBrowserWindow.this); - } - }); - } - - @Signature - public void maximize() { - if (frame instanceof JFrame) { - ((JFrame) frame).setExtendedState(((JFrame) frame).getExtendedState() | JFrame.MAXIMIZED_BOTH); - } - } - - @Signature - public static PCefBrowserWindow find(Environment env, CefBrowser browser) { - Component uiComponent = browser.getUIComponent(); - Window window = SwingUtilities.getWindowAncestor(uiComponent); - - if (window != null) { - return new PCefBrowserWindow(env, window); - } - - return null; - } -} diff --git a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefCallback.java b/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefCallback.java deleted file mode 100644 index cf5372f..0000000 --- a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefCallback.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.develnext.jphp.ext.jcef.classes; - -import org.cef.callback.CefCallback; -import org.develnext.jphp.ext.jcef.JCefExtension; -import php.runtime.Memory; -import php.runtime.annotation.Reflection; -import php.runtime.annotation.Reflection.Name; -import php.runtime.annotation.Reflection.Namespace; -import php.runtime.annotation.Reflection.Signature; -import php.runtime.env.Environment; -import php.runtime.lang.BaseWrapper; -import php.runtime.reflection.ClassEntity; - - -@Name("CefCallback") -@Namespace(JCefExtension.NS) -public class PCefCallback extends BaseWrapper { - public PCefCallback(Environment env, CefCallback wrappedObject) { - super(env, wrappedObject); - } - - public PCefCallback(Environment env, ClassEntity clazz) { - super(env, clazz); - } - - @Signature - private void __construct() { - } - - @Signature - public Memory Continue(Environment env, Memory... args) { - this.getWrappedObject().Continue(); - return Memory.NULL; - } - - @Signature - public void cancel() { - getWrappedObject().cancel(); - } -} diff --git a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefClient.java b/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefClient.java deleted file mode 100644 index 266d9a6..0000000 --- a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefClient.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.develnext.jphp.ext.jcef.classes; - -import org.cef.CefClient; -import org.cef.browser.CefBrowser; -import org.cef.browser.CefFrame; -import org.cef.browser.CefMessageRouter; -import org.cef.callback.CefJSDialogCallback; -import org.cef.callback.CefQueryCallback; -import org.cef.handler.*; -import org.cef.misc.BoolRef; -import org.cef.network.CefRequest; -import org.develnext.jphp.ext.jcef.JCefExtension; -import php.runtime.Memory; -import php.runtime.annotation.Reflection; -import php.runtime.annotation.Reflection.Name; -import php.runtime.annotation.Reflection.Namespace; -import php.runtime.annotation.Reflection.Nullable; -import php.runtime.annotation.Reflection.Signature; -import php.runtime.env.Environment; -import php.runtime.invoke.Invoker; -import php.runtime.lang.BaseWrapper; -import php.runtime.memory.ArrayMemory; -import php.runtime.reflection.ClassEntity; - -import javax.swing.*; - -@Name("CefClient") -@Namespace(JCefExtension.NS) -public class PCefClient extends BaseWrapper { - public PCefClient(Environment env, CefClient wrappedObject) { - super(env, wrappedObject); - } - - public PCefClient(Environment env, ClassEntity clazz) { - super(env, clazz); - } - - @Signature - private void __construct() { - } - - @Signature - public PCefBrowser createBrowser(Environment env, @Nullable String url, boolean isOffscreenRendered) { - return createBrowser(env, url, isOffscreenRendered, false); - } - - @Signature - public PCefBrowser createBrowser(Environment env, @Nullable String url, boolean isOffscreenRendered, boolean isTransparent) { - CefBrowser cefBrowser = getWrappedObject().createBrowser(url, isOffscreenRendered, isTransparent); - return new PCefBrowser(env, cefBrowser); - } - - @Signature - public void addMessageRouter(Environment env, Invoker invoker) { - CefMessageRouter messageRouter = CefMessageRouter.create(); - messageRouter.addHandler(new CefMessageRouterHandlerAdapter() { - @Override - public boolean onQuery(CefBrowser browser, CefFrame frame, long query_id, String _request, boolean persistent, CefQueryCallback callback) { - return invoker.callAny(new PCefBrowser(env, browser), _request, persistent).toBoolean(); - } - }, false); - - getWrappedObject().addMessageRouter(messageRouter); - - } - - @Signature - public void onAfterCreated(Environment env, Invoker invoker) { - getWrappedObject().addLifeSpanHandler(new CefLifeSpanHandlerAdapter() { - @Override - public void onAfterCreated(CefBrowser browser) { - invoker.callAny(new PCefBrowser(env, browser)); - } - }); - } - - @Signature - public void onBeforeClose(Environment env, Invoker invoker) { - getWrappedObject().addLifeSpanHandler(new CefLifeSpanHandlerAdapter() { - @Override - public void onBeforeClose(CefBrowser browser) { - invoker.callAny(new PCefBrowser(env, browser)); - } - }); - } - - @Signature - public void onTitleChange(Environment env, Invoker invoker) { - getWrappedObject().addDisplayHandler(new CefDisplayHandlerAdapter() { - @Override - public void onTitleChange(CefBrowser browser, String title) { - invoker.callAny(new PCefBrowser(env, browser), title); - } - }); - } - - @Signature - public void onConsoleMessage(Environment env, Invoker invoker) { - getWrappedObject().addDisplayHandler(new CefDisplayHandlerAdapter() { - @Override - public boolean onConsoleMessage(CefBrowser browser, String message, String source, int line) { - return invoker.callAny(new PCefBrowser(env, browser), message, source, line).toBoolean(); - } - }); - } - - @Signature - public void onAddressChange(Environment env, Invoker invoker) { - getWrappedObject().addDisplayHandler(new CefDisplayHandlerAdapter() { - @Override - public void onAddressChange(CefBrowser browser, CefFrame frame, String url) { - invoker.callAny(new PCefBrowser(env, browser), url); - } - }); - } - - @Signature - public void onStatusMessage(Environment env, Invoker invoker) { - getWrappedObject().addDisplayHandler(new CefDisplayHandlerAdapter() { - @Override - public void onStatusMessage(CefBrowser browser, String value) { - invoker.callAny(browser, value); - } - }); - } - - @Signature - public void onBeforeBrowse(Environment env, Invoker invoker) { - getWrappedObject().addRequestHandler(new CefRequestHandlerAdapter() { - @Override - public boolean onBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, boolean is_redirect) { - return invoker.callAny(new PCefBrowser(env, browser), ArrayMemory.ofNullableBean(env, request), is_redirect).toBoolean(); - } - }); - } - - @Signature - public void onBeforeResourceLoad(Environment env, Invoker invoker) { - getWrappedObject().addRequestHandler(new CefRequestHandlerAdapter() { - @Override - public boolean onBeforeResourceLoad(CefBrowser browser, CefFrame frame, CefRequest request) { - return invoker.callAny(new PCefBrowser(env, browser), ArrayMemory.ofNullableBean(env, request)).toBoolean(); - } - }); - } -} diff --git a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefResourceHandler.java b/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefResourceHandler.java deleted file mode 100644 index 2c9fdf7..0000000 --- a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefResourceHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.develnext.jphp.ext.jcef.classes; - -import org.develnext.jphp.ext.jcef.JCefExtension; -import php.runtime.Memory; -import php.runtime.annotation.Reflection; -import php.runtime.annotation.Reflection.*; -import php.runtime.common.HintType; -import php.runtime.env.Environment; -import php.runtime.ext.core.classes.stream.Stream; -import php.runtime.lang.BaseObject; -import php.runtime.reflection.ClassEntity; - -@Name("CefResourceHandler") -@Namespace(JCefExtension.NS) -abstract public class PCefResourceHandler extends BaseObject { - public PCefResourceHandler(Environment env, ClassEntity clazz) { - super(env, clazz); - } - - @Signature({ - @Arg(value = "request", type = HintType.ARRAY), - @Arg(value = "callback", nativeType = PCefCallback.class) - }) - abstract public Memory processRequest(Environment env, Memory... args); - - @Signature({ - @Arg(value = "response", nativeType = PCefResponse.class), - @Arg(value = "args", type = HintType.ARRAY) - }) - abstract public Memory getResponseHeaders(Environment env, Memory... args); - - @Signature({ - @Arg(value = "out", nativeType = Stream.class), - @Arg(value = "bytesToRead", type = HintType.INT), - @Arg(value = "callback", nativeType = PCefCallback.class) - }) - abstract public Memory readResponse(Environment env, Memory... args); - - @Signature({ - @Arg(value = "cookie", type = HintType.ARRAY) - }) - abstract public Memory canGetCookie(Environment env, Memory... args); - - @Signature({ - @Arg(value = "cookie", type = HintType.ARRAY) - }) - abstract public Memory canSetCookie(Environment env, Memory... args); - - @Signature() - abstract public Memory cancel(Environment env, Memory... args); -} diff --git a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefResponse.java b/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefResponse.java deleted file mode 100644 index 81a8e7b..0000000 --- a/wizard-browser/src/main/java/org/develnext/jphp/ext/jcef/classes/PCefResponse.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.develnext.jphp.ext.jcef.classes; - -import org.cef.handler.CefLoadHandler; -import org.cef.network.CefResponse; -import org.develnext.jphp.ext.jcef.JCefExtension; -import php.runtime.annotation.Reflection.*; -import php.runtime.env.Environment; -import php.runtime.lang.BaseWrapper; -import php.runtime.reflection.ClassEntity; - -import java.util.LinkedHashMap; -import java.util.Map; - -@Name("CefResponse") -@Namespace(JCefExtension.NS) -public class PCefResponse extends BaseWrapper { - interface WrappedInterface { - @Property boolean readOnly(); - @Property int status(); - @Property String statusText(); - @Property String mimeType(); - @Property CefLoadHandler.ErrorCode error(); - - } - - public PCefResponse(Environment env, CefResponse wrappedObject) { - super(env, wrappedObject); - } - - public PCefResponse(Environment env, ClassEntity clazz) { - super(env, clazz); - } - - @Signature - public void __construct() { - __wrappedObject = CefResponse.create(); - } - - @Getter - protected Map getHeaderMap() { - LinkedHashMap headerMap = new LinkedHashMap<>(); - getWrappedObject().getHeaderMap(headerMap); - return headerMap; - } - - @Setter - protected void setHeaderMap(Map headerMap) { - getWrappedObject().setHeaderMap(headerMap); - } -} diff --git a/wizard-core/package.build.php b/wizard-core/package.build.php new file mode 100644 index 0000000..a9ce17f --- /dev/null +++ b/wizard-core/package.build.php @@ -0,0 +1,10 @@ +=1.0.0' + jphp-runtime: '*' + jphp-yaml-ext: '*' devDeps: - tester: '~1.0.0' + tester: '*' sources: - src-php diff --git a/wizard-core/src-php/framework/core/Component.php b/wizard-core/src-php/framework/core/Component.php index 8e2ce44..31fb749 100644 --- a/wizard-core/src-php/framework/core/Component.php +++ b/wizard-core/src-php/framework/core/Component.php @@ -3,11 +3,6 @@ namespace framework\core; use Closure; -use php\format\JsonProcessor; -use php\format\Processor; -use php\io\IOException; -use php\io\Stream; -use php\lib\fs; use php\lib\reflect; use php\lib\str; @@ -18,7 +13,7 @@ * @property string $id * @property array $properties * @property Component $owner - * @property Components $components + * @property Component[] $components */ abstract class Component { @@ -30,7 +25,7 @@ abstract class Component /** * @var Component[] */ - private $components = []; + public $components = []; /** * @var array @@ -91,19 +86,16 @@ public function __setOwner(?Component $component) } /** - * @return Components + * @return array */ - protected function getComponents(): Components + protected function getComponents(): array { - if (!$this->components) { - return $this->components = new Components($this); - } - return $this->components; } /** * @return array + * @throws \ReflectionException */ protected function getProperties(): array { @@ -255,9 +247,9 @@ protected function loadBinds() */ public function free() { - if ($this->owner) { - $this->owner->components->remove($this); - } + if ($this->owner) + if (($key = array_search($this, $this->owner->components)) !== false) + unset($this->owner->components[$key]); } /** @@ -337,6 +329,7 @@ public function __set(string $name, $value) /** * @return array + * @throws \ReflectionException */ public function __debugInfo() { diff --git a/wizard-web-ui/.gitignore b/wizard-web-ui/.gitignore new file mode 100644 index 0000000..c195924 --- /dev/null +++ b/wizard-web-ui/.gitignore @@ -0,0 +1,3 @@ +gradlew +gradlew.bat +package-lock.php.yml \ No newline at end of file diff --git a/wizard-web-ui/build.gradle b/wizard-web-ui/build.gradle index ed02d0b..819be55 100644 --- a/wizard-web-ui/build.gradle +++ b/wizard-web-ui/build.gradle @@ -16,10 +16,6 @@ gulp { colors = true } -dependencies { - compile project(":wizard-core") -} - task buildCss(dependsOn: 'gulp_compile-css') { doLast { copy { @@ -46,7 +42,3 @@ task buildJs(dependsOn: ['gulp_compile']) { task buildWebLib(dependsOn: ['buildCss', 'buildJs']) { } - - - -processResources.dependsOn buildWebLib \ No newline at end of file diff --git a/wizard-web-ui/components/ace-editor/build.gradle b/wizard-web-ui/components/ace-editor/build.gradle deleted file mode 100644 index 171acec..0000000 --- a/wizard-web-ui/components/ace-editor/build.gradle +++ /dev/null @@ -1,3 +0,0 @@ -dependencies { - provided project(":wizard-web-ui") -} diff --git a/wizard-web-ui/components/ace-editor/package.build.php b/wizard-web-ui/components/ace-editor/package.build.php new file mode 100644 index 0000000..a9ce17f --- /dev/null +++ b/wizard-web-ui/components/ace-editor/package.build.php @@ -0,0 +1,10 @@ + "text/javascript", + "content" => "res://js/aceeditor/mode-$mode.js" + ]; } - foreach ($themes as $theme) { - $libs[] = "res://js/aceeditor/theme-$theme.js"; + foreach (AceEditorModule::$themes as $theme) { + $libs["js/aceeditor/theme-$theme.js"] = [ + "type" => "text/javascript", + "content" => "res://js/aceeditor/theme-$theme.js" + ]; } return $libs; @@ -66,8 +65,14 @@ public function getResources(): array public function getRequiredResources(): array { return [ - 'res://js/aceeditor/ace.js', - 'res://js/AceEditor.js' + "aceeditor/ace.js" => [ + "type" => "text/javascript", + "content" => "res://js/aceeditor/ace.js" + ], + "js/AceEditor.js" => [ + "type" => "text/javascript", + "content" => "res://js/AceEditor.js" + ] ]; } } \ No newline at end of file diff --git a/wizard-web-ui/components/ace-editor/src-php/bundle/aceeditor/ui/UIAceEditor.php b/wizard-web-ui/components/ace-editor/src-php/bundle/aceeditor/ui/UIAceEditor.php index 2e73cbc..44eeda3 100644 --- a/wizard-web-ui/components/ace-editor/src-php/bundle/aceeditor/ui/UIAceEditor.php +++ b/wizard-web-ui/components/ace-editor/src-php/bundle/aceeditor/ui/UIAceEditor.php @@ -33,7 +33,7 @@ class UIAceEditor extends UITextInputControl * @param string $mode * @param string $theme */ - public function __construct(string $mode = '', string $theme = '') + public function __construct(string $mode = "", string $theme = "") { parent::__construct(); diff --git a/wizard-web-ui/components/craft-game-engine/build.gradle b/wizard-web-ui/components/craft-game-engine/build.gradle deleted file mode 100644 index 171acec..0000000 --- a/wizard-web-ui/components/craft-game-engine/build.gradle +++ /dev/null @@ -1,3 +0,0 @@ -dependencies { - provided project(":wizard-web-ui") -} diff --git a/wizard-web-ui/components/slider/build.gradle b/wizard-web-ui/components/slider/build.gradle deleted file mode 100644 index 171acec..0000000 --- a/wizard-web-ui/components/slider/build.gradle +++ /dev/null @@ -1,3 +0,0 @@ -dependencies { - provided project(":wizard-web-ui") -} diff --git a/wizard-web-ui/components/slider/package.build.php b/wizard-web-ui/components/slider/package.build.php new file mode 100644 index 0000000..a9ce17f --- /dev/null +++ b/wizard-web-ui/components/slider/package.build.php @@ -0,0 +1,10 @@ + [ + "type" => "text/javascript", + "content" => "res://js/slider/bootstrap-slider.min.js" + ], + "js/Slider.js" => [ + "type" => "text/javascript", + "content" => "res://js/Slider.js" + ], + "css/slider/bootstrap-slider.min.css" => [ + "type" => "text/css", + "content" => "res://css/slider/bootstrap-slider.min.css" + ] ]; } } \ No newline at end of file diff --git a/wizard-web-ui/gradle/wrapper/gradle-wrapper.jar b/wizard-web-ui/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..c44b679 Binary files /dev/null and b/wizard-web-ui/gradle/wrapper/gradle-wrapper.jar differ diff --git a/wizard-web-ui/gradle/wrapper/gradle-wrapper.properties b/wizard-web-ui/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..eaf455e --- /dev/null +++ b/wizard-web-ui/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip diff --git a/wizard-web-ui/package.build.php b/wizard-web-ui/package.build.php new file mode 100644 index 0000000..ebb3cea --- /dev/null +++ b/wizard-web-ui/package.build.php @@ -0,0 +1,33 @@ +setExecutable(true); + + fs::copy('res://gradle/wrapper/gradle-wrapper.jar', './gradle/wrapper/gradle-wrapper.jar'); + fs::copy('res://gradle/wrapper/gradle-wrapper.properties', './gradle/wrapper/gradle-wrapper.properties'); + + // Run Gradle + (new GradlePlugin($event))->gradleProcess(["npmInstall", "installGulp", "buildWebLib"]) + ->inheritIO() + ->startAndWait(); + + // Publish package + Tasks::run('publish', [], "yes"); + + foreach ($event->package()->getAny('components', []) as $i => $module) { + Tasks::runExternal("./components/$module", 'install', [], ...$event->flags()); + Tasks::runExternal("./components/$module", 'wizard:build', [], ...$event->flags()); + } +} \ No newline at end of file diff --git a/wizard-web-ui/package.php.yml b/wizard-web-ui/package.php.yml index b37b47a..a0eb27c 100644 --- a/wizard-web-ui/package.php.yml +++ b/wizard-web-ui/package.php.yml @@ -1,12 +1,12 @@ name: wizard-web-ui -version: 0.1.0 +version: 0.1.1 description: Web UI framework for Wizard. plugins: [Doc, Hub] deps: - wizard-core: '~0.1.0' + wizard-core: '*' jphp-json-ext: '*' sources: @@ -22,4 +22,8 @@ config: - /out/** - /components/** - /.gradle/** - - /src-js/** \ No newline at end of file + - /src-js/** + +components: + - ace-editor + - slider \ No newline at end of file diff --git a/wizard-web-ui/resources/dnext-engine.js b/wizard-web-ui/resources/dnext-engine.js deleted file mode 100644 index afc3ca6..0000000 --- a/wizard-web-ui/resources/dnext-engine.js +++ /dev/null @@ -1,4722 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 2 && arguments[2] !== undefined ? arguments[2] : null; - - if (!this.dispatcher) { - return; - } - - if (!document.hidden) { - setTimeout(function () { - var newData = data; - - if (typeof data === "function") { - newData = data(); - } - - _this3.sendIfCan('ui-user-input', { - 'uuid': node.uuid, - 'data': _this3.prepareValue(newData) - }, callback); - }, 0); - } else { - console.warn('Ignore User input'); - } - } - - /** - * @param type - * @param message - * @param callback - * @returns {boolean} - */ - - }, { - key: "sendIfCan", - value: function sendIfCan(type, message, callback) { - if (this.dispatcher !== undefined) { - this.send(type, message, callback); - return true; - } else { - return false; - } - } - - /** - * @param type - * @param message - * @param callback - */ - - }, { - key: "send", - value: function send(type, message, callback) { - if (this.dispatcher === undefined) { - throw "Mediator is not in watching state."; - } - - message.type = type; - message.id = Math.random().toString(36).substring(7); - message.sessionId = this.sessionId; - message.sessionIdUuid = this.uuid; - - if (callback) { - this._callbacks[message.id] = callback; - message.needCallback = true; - } - - console.debug("AppMediator.send", message); - - this.dispatcher.send(JSON.stringify(message)); - } - }, { - key: "findNodeByUuidGlobally", - value: function findNodeByUuidGlobally(uuid) { - var found = this.findNodeByUuid(uuid, this.node); - - if (found === null) { - if (this._nodes.hasOwnProperty(uuid)) { - found = this._nodes[uuid]; - } - } - - if (found === null) { - for (var key in this._nodes) { - if (this._nodes.hasOwnProperty(key)) { - var _found = this.findNodeByUuid(uuid, this._nodes[key]); - - if (_found !== null) { - return _found; - } - } - } - } - - return found; - } - }, { - key: "findNodeByUuid", - value: function findNodeByUuid(uuid, node) { - if (uuid === node.uuid) { - return node; - } - - var children = node.innerNodes(); - - for (var i = 0; i < children.length; i++) { - if (children[i].uuid === uuid) { - return children[i]; - } - - var found = this.findNodeByUuid(uuid, children[i]); - - if (found !== null) { - return found; - } - } - - return null; - } - }, { - key: "triggerEvent", - value: function triggerEvent(node, event, e) { - var data = { - type: e.type, - which: e.which, - result: e.result, - namespace: e.namespace, - position: [e.pageX, e.pageY] - }; - - this.sendIfCan('ui-trigger', { - uuid: node.uuid, - event: event, - data: this.prepareValue(data) - }); - } - - /** - * Render new view. - * @param message - */ - - }, { - key: "triggerRenderView", - value: function triggerRenderView(message) { - var _this4 = this; - - var uiLoader = new _UILoader2.default(); - this.node = uiLoader.load(message['schema']); - - this.rootDom.empty(); - this.rootDom.append(this.node.dom); - - this.sendIfCan('ui-render-done', { - size: [this.node.dom.width(), this.node.dom.height()] - }, function () { - var triggerRender = function triggerRender(node) { - node.trigger('render'); - - var innerNodes = node.innerNodes(); - - for (var key in innerNodes) { - if (innerNodes.hasOwnProperty(key)) { - triggerRender(innerNodes[key]); - } - } - }; - - triggerRender(_this4.node); - - for (var key in _this4._nodes) { - if (_this4._nodes.hasOwnProperty(key)) { - triggerRender(_this4._nodes[key]); - } - } - }); - } - }, { - key: "triggerAlert", - value: function triggerAlert(message) { - var text = message['text']; - alert(text); - } - }, { - key: "triggerCallMethod", - value: function triggerCallMethod(message) { - var uuid = message['uuid']; - var method = message['method']; - var args = this.parseValue(message['args'] || []); - - var node = this.findNodeByUuidGlobally(uuid); - - if (node !== null) { - node[method].apply(node, args); - } else { - console.warn("Failed to call method ." + method + "(), node with uuid = " + uuid + " is not found"); - } - } - }, { - key: "triggerSetProperty", - value: function triggerSetProperty(message) { - var uuid = message['uuid']; - var property = message['property']; - var value = this.parseValue(message['value']); - - var node = this.findNodeByUuidGlobally(uuid); - - if (node !== null) { - node[property] = value; - } else { - console.warn("Failed to set property ." + property + ", node with uuid = " + uuid + " is not found"); - } - } - }, { - key: "triggerOnEventLink", - value: function triggerOnEventLink(message) { - var _this5 = this; - - var uuid = message['uuid']; - var event = message['event']; - - var node = this.findNodeByUuidGlobally(uuid); - - if (node !== null) { - node.off(event + ".AppMediator"); - - node.on(event + ".AppMediator", function (e) { - _this5.triggerEvent(node, event, e); - }); - } else { - console.warn("Failed to link event " + event + ", node with uuid = " + uuid + " is not found"); - } - } - }, { - key: "triggerCreateNode", - value: function triggerCreateNode(message) { - var schema = message['schema']; - - var uiLoader = new _UILoader2.default(); - var node = uiLoader.load(schema); - - this._nodes[node.uuid] = node; - - node.trigger('render'); - } - }, { - key: "triggerCreateCssStyle", - value: function triggerCreateCssStyle(message) { - this.triggerDestroyCssStyle(message); - - var id = message.id, - style = message.style; - - - var tag = document.createElement('style'); - - tag.type = 'text/css'; - tag.innerHTML = style; - tag.id = id; - tag.className = 'dynamic-css'; - - jQuery('head').append(jQuery(tag)); - } - }, { - key: "triggerDestroyCssStyle", - value: function triggerDestroyCssStyle(message) { - var id = message.id; - - jQuery(".dynamic-css#" + id).remove(); - } - }, { - key: "triggerReload", - value: function triggerReload(message) { - sessionStorage.setItem('AppMediator.reloading', true); - setTimeout(function () { - return window.location.reload(true); - }, 50); - } - }]); - - return AppMediator; -}(); - -exports.default = new AppMediator(); - -},{"../UX/Node":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js","./UILoader":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\UILoader.js","./WebSocketAppDispatcher":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\WebSocketAppDispatcher.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\ChromiumEmbeddedAppDispatcher.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _AppDispatcher2 = require('./AppDispatcher'); - -var _AppDispatcher3 = _interopRequireDefault(_AppDispatcher2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ChromiumEmbeddedAppDispatcher = function (_AppDispatcher) { - _inherits(ChromiumEmbeddedAppDispatcher, _AppDispatcher); - - function ChromiumEmbeddedAppDispatcher(wsUrl) { - _classCallCheck(this, ChromiumEmbeddedAppDispatcher); - - var _this = _possibleConstructorReturn(this, (ChromiumEmbeddedAppDispatcher.__proto__ || Object.getPrototypeOf(ChromiumEmbeddedAppDispatcher)).call(this)); - - _this.wsUrl = wsUrl; - - _this.onMessage(function () {}); - _this.onError(function () {}); - _this.onClose(function () {}); - return _this; - } - - _createClass(ChromiumEmbeddedAppDispatcher, [{ - key: 'onOpen', - value: function onOpen(callback) { - window.cefOpenHandler = function () { - callback(); - }; - - setTimeout(function () { - return window.cefOpenHandler(); - }, 1); - } - }, { - key: 'onMessage', - value: function onMessage(callback) { - window.cefMessageHandler = function (data) { - return callback(data); - }; - } - }, { - key: 'onError', - value: function onError(callback) { - window.cefErrorHandler = function () { - return callback(); - }; - } - }, { - key: 'onClose', - value: function onClose(callback) { - window.cefCloseHandler = function () { - return callback(); - }; - } - }, { - key: 'send', - value: function send(data) { - window.cefQuery({ - request: 'ws:' + this.wsUrl + ':' + data, - persistent: false, - onSuccess: function onSuccess(res) {}, - onFailure: function onFailure(error_code, error_message) { - if (window.cefErrorHandler && error_code !== -1) { - window.cefErrorHandler.call(); - } - } - }); - } - }]); - - return ChromiumEmbeddedAppDispatcher; -}(_AppDispatcher3.default); - -exports.default = ChromiumEmbeddedAppDispatcher; - -},{"./AppDispatcher":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\AppDispatcher.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\NX.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _App = require('./App'); - -var _App2 = _interopRequireDefault(_App); - -var _UILoader = require('./UILoader'); - -var _UILoader2 = _interopRequireDefault(_UILoader); - -var _AppMediator = require('./AppMediator'); - -var _AppMediator2 = _interopRequireDefault(_AppMediator); - -var _WebSocketAppDispatcher = require('./WebSocketAppDispatcher'); - -var _WebSocketAppDispatcher2 = _interopRequireDefault(_WebSocketAppDispatcher); - -var _ChromiumEmbeddedAppDispatcher = require('./ChromiumEmbeddedAppDispatcher'); - -var _ChromiumEmbeddedAppDispatcher2 = _interopRequireDefault(_ChromiumEmbeddedAppDispatcher); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = { - App: _App2.default, UILoader: _UILoader2.default, AppMediator: _AppMediator2.default, - WebSocketAppDispatcher: _WebSocketAppDispatcher2.default, ChromiumEmbeddedAppDispatcher: _ChromiumEmbeddedAppDispatcher2.default -}; - -},{"./App":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\App.js","./AppMediator":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\AppMediator.js","./ChromiumEmbeddedAppDispatcher":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\ChromiumEmbeddedAppDispatcher.js","./UILoader":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\UILoader.js","./WebSocketAppDispatcher":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\WebSocketAppDispatcher.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\UILoader.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Node = require('./../UX/Node'); - -var _Node2 = _interopRequireDefault(_Node); - -var _Container = require('./../UX/Container'); - -var _Container2 = _interopRequireDefault(_Container); - -var _UX = require('./../UX/UX'); - -var _UX2 = _interopRequireDefault(_UX); - -var _AppMediator = require('./AppMediator'); - -var _AppMediator2 = _interopRequireDefault(_AppMediator); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var UILoader = function () { - function UILoader() { - _classCallCheck(this, UILoader); - } - - _createClass(UILoader, [{ - key: 'linkToMediator', - value: function linkToMediator(node, data) { - var watchedEvents = data['_watchedEvents']; - if (watchedEvents !== undefined) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - var _loop = function _loop() { - var watchedEvent = _step.value; - - node.on(watchedEvent + '.AppMediator', function (e) { - _AppMediator2.default.triggerEvent(node, watchedEvent, e); - }); - }; - - for (var _iterator = watchedEvents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - _loop(); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - } - } - - /** - * @param object - * @returns {Node} - */ - - }, { - key: 'load', - value: function load(object) { - if (object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === "object") { - var type = object['_']; - - if (!type) { - throw new Error("Type is not defined in '_' property!"); - } - - var cls = _UX2.default[type]; - - if (!cls) { - cls = window[type]; - } - - if (!cls) { - throw new Error('Type \'' + type + '\' is not defined'); - } - - var node = new cls(); - - if (node instanceof _Node2.default) { - if (node instanceof _Container2.default && jQuery.isArray(object['_content'])) { - var children = object['_content']; - - for (var i = 0; i < children.length; i++) { - var child = this.load(children[i]); - node.add(child); - } - } - - node.loadSchema(object); - this.linkToMediator(node, object); - return node; - } else { - throw new Error('Type \'' + type + '\' is not UI component class'); - } - } - } - - /** - * @param {string} jsonString - * @returns {Node} - */ - - }, { - key: 'loadFromJson', - value: function loadFromJson(jsonString) { - return this.load(JSON.parse(jsonString)); - } - - /** - * - * @param {string} urlToJson - * @param {function} callback - */ - - }, { - key: 'loadFromUrl', - value: function loadFromUrl(urlToJson, callback) { - var _this = this; - - jQuery.getJSON(urlToJson, function (data) { - callback(_this.load(data)); - }); - } - }]); - - return UILoader; -}(); - -exports.default = UILoader; - -},{"./../UX/Container":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Container.js","./../UX/Node":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js","./../UX/UX":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\UX.js","./AppMediator":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\AppMediator.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\WebSocketAppDispatcher.js":[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _AppDispatcher2 = require("./AppDispatcher"); - -var _AppDispatcher3 = _interopRequireDefault(_AppDispatcher2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -/** - * WebSocket App Dispatcher - */ -var WebSocketAppDispatcher = function (_AppDispatcher) { - _inherits(WebSocketAppDispatcher, _AppDispatcher); - - function WebSocketAppDispatcher(wsUrl) { - _classCallCheck(this, WebSocketAppDispatcher); - - var _this = _possibleConstructorReturn(this, (WebSocketAppDispatcher.__proto__ || Object.getPrototypeOf(WebSocketAppDispatcher)).call(this)); - - var loc = window.location; - - _this.wsUrl = wsUrl; - var newUri = ''; - - if (loc.protocol === "https:") { - newUri = "wss:"; - } else { - newUri = "ws:"; - } - - newUri += "//" + loc.host; - newUri += wsUrl; - - _this.ws = new WebSocket(newUri); - return _this; - } - - _createClass(WebSocketAppDispatcher, [{ - key: "onOpen", - value: function onOpen(callback) { - this.ws.onopen = function () { - return callback(); - }; - } - }, { - key: "onMessage", - value: function onMessage(callback) { - this.ws.onmessage = function (e) { - return callback(e.data); - }; - } - }, { - key: "onError", - value: function onError(callback) { - this.ws.onerror = function () { - return callback(); - }; - } - }, { - key: "onClose", - value: function onClose(callback) { - this.ws.onclose = function () { - return callback(); - }; - } - }, { - key: "send", - value: function send(data) { - return this.ws.send(data); - } - }]); - - return WebSocketAppDispatcher; -}(_AppDispatcher3.default); - -exports.default = WebSocketAppDispatcher; - -},{"./AppDispatcher":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\AppDispatcher.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\AnchorPane.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _Container2 = require('./Container'); - -var _Container3 = _interopRequireDefault(_Container2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var AnchorPane = function (_Container) { - _inherits(AnchorPane, _Container); - - function AnchorPane() { - _classCallCheck(this, AnchorPane); - - return _possibleConstructorReturn(this, (AnchorPane.__proto__ || Object.getPrototypeOf(AnchorPane)).apply(this, arguments)); - } - - _createClass(AnchorPane, [{ - key: 'createDom', - value: function createDom() { - var dom = _get(AnchorPane.prototype.__proto__ || Object.getPrototypeOf(AnchorPane.prototype), 'createDom', this).call(this); - dom.addClass('ux-anchor-pane'); - return dom; - } - }, { - key: 'createSlotDom', - value: function createSlotDom(object) { - object.dom.css('position', 'absolute'); - return object.dom; - } - }, { - key: 'childToBack', - value: function childToBack(object) { - var dom = object.dom; - dom.detach(); - - this.dom.prepend(dom); - } - }, { - key: 'childToFront', - value: function childToFront(object) { - var dom = object.dom; - dom.detach(); - this.dom.append(dom); - } - }]); - - return AnchorPane; -}(_Container3.default); - -exports.default = AnchorPane; - -},{"./Container":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Container.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Button.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Labeled2 = require('./Labeled'); - -var _Labeled3 = _interopRequireDefault(_Labeled2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var kinds = ['success', 'primary', 'secondary', 'info', 'warning', 'danger', 'link', 'dark', 'light']; - -var Button = function (_Labeled) { - _inherits(Button, _Labeled); - - function Button(text, graphic) { - _classCallCheck(this, Button); - - var _this = _possibleConstructorReturn(this, (Button.__proto__ || Object.getPrototypeOf(Button)).call(this, text, graphic)); - - _this.on('click.Button', function () { - this.trigger('action'); - }); - return _this; - } - - _createClass(Button, [{ - key: 'createDom', - value: function createDom() { - var dom = jQuery(''); - dom.addClass('ux-labeled'); - dom.addClass('ux-button'); - - dom.addClass('btn'); - dom.addClass('btn-default'); - - return dom; - } - }, { - key: 'outline', - get: function get() { - return !!this.dom.data('--outline'); - }, - set: function set(value) { - var kind = this.kind; - this.dom.data('--outline', !!value); - this.kind = kind; - } - }, { - key: 'kind', - get: function get() { - var dom = this.dom; - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = kinds[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var kind = _step.value; - - if (dom.hasClass('btn-' + kind) || dom.hasClass('btn-outline-' + kind)) { - return kind; - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - return 'default'; - }, - set: function set(value) { - this.dom.removeClass('btn-' + this.kind); - this.dom.removeClass('btn-outline-' + this.kind); - - if (this.outline) { - this.dom.addClass('btn-outline-' + value); - } else { - this.dom.addClass('btn-' + value); - } - } - }]); - - return Button; -}(_Labeled3.default); - -exports.default = Button; - -},{"./Labeled":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Labeled.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Checkbox.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Labeled2 = require('./Labeled'); - -var _Labeled3 = _interopRequireDefault(_Labeled2); - -var _AppMediator = require('../NX/AppMediator'); - -var _AppMediator2 = _interopRequireDefault(_AppMediator); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Checkbox = function (_Labeled) { - _inherits(Checkbox, _Labeled); - - function Checkbox(text, graphic) { - _classCallCheck(this, Checkbox); - - var _this = _possibleConstructorReturn(this, (Checkbox.__proto__ || Object.getPrototypeOf(Checkbox)).call(this, text, graphic)); - - _this.dom.on('click.Checkbox', function (e) { - if (e.target.tagName === 'INPUT') { - _AppMediator2.default.sendUserInput(_this, { selected: _this.selected }, function () { - _this.trigger('action', e); - }); - } - }); - return _this; - } - - _createClass(Checkbox, [{ - key: 'createDom', - value: function createDom() { - var dom = jQuery(''); - dom.addClass('ux-labeled'); - dom.addClass('ux-checkbox'); - return dom; - } - }, { - key: 'checked', - get: function get() { - return this.dom.find('input[type=checkbox]').prop('checked'); - }, - set: function set(value) { - this.dom.find('input[type=checkbox]').prop('checked', value); - } - }, { - key: 'selected', - get: function get() { - return this.checked; - }, - set: function set(value) { - this.checked = value; - } - }, { - key: 'enabled', - get: function get() { - return !this.dom.find('input[type=checkbox]').prop("disabled"); - }, - set: function set(value) { - this.dom.find('input[type=checkbox]').prop('disabled', !value); - } - }]); - - return Checkbox; -}(_Labeled3.default); - -exports.default = Checkbox; - -},{"../NX/AppMediator":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\AppMediator.js","./Labeled":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Labeled.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Combobox.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _SelectControl2 = require('./SelectControl'); - -var _SelectControl3 = _interopRequireDefault(_SelectControl2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Combobox = function (_SelectControl) { - _inherits(Combobox, _SelectControl); - - function Combobox() { - _classCallCheck(this, Combobox); - - return _possibleConstructorReturn(this, (Combobox.__proto__ || Object.getPrototypeOf(Combobox)).apply(this, arguments)); - } - - _createClass(Combobox, [{ - key: 'createDom', - value: function createDom() { - var dom = _get(Combobox.prototype.__proto__ || Object.getPrototypeOf(Combobox.prototype), 'createDom', this).call(this); - dom.addClass('ux-combobox'); - return dom; - } - }]); - - return Combobox; -}(_SelectControl3.default); - -exports.default = Combobox; - -},{"./SelectControl":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\SelectControl.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Container.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Node2 = require('./Node'); - -var _Node3 = _interopRequireDefault(_Node2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Container = function (_Node) { - _inherits(Container, _Node); - - function Container(nodes) { - _classCallCheck(this, Container); - - var _this = _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).call(this)); - - _this.add.apply(_this, arguments); - _this.contentDom = _this.dom; - return _this; - } - - _createClass(Container, [{ - key: 'createSlotDom', - value: function createSlotDom(object) { - if (!(object instanceof _Node3.default)) { - throw new TypeError('createSlotDom(): 1 argument must be instance of Node'); - } - - var dom = jQuery('
').append(object.dom); - dom.addClass('ux-slot'); - - dom.data('--wrapper', object); - object.dom.data('--wrapper-dom', dom); - - var width = object.data('--width-percent'); - var height = object.data('--height-percent'); - var visible = object.css('display') !== 'none'; - - if (typeof width === 'string') { - dom.width(width); - object.dom.width('100%'); - } - - if (typeof height === 'string') { - dom.height(height); - object.dom.height('100%'); - } - - if (!visible) { - dom.hide(); - } - - return dom; - } - }, { - key: 'createDom', - value: function createDom() { - var dom = jQuery('
'); - dom.addClass('ux-container'); - - return dom; - } - }, { - key: 'child', - value: function child(id) { - var dom = this.contentDom.find('#' + id); - - if (dom && dom.length) { - return _Node3.default.getFromDom(dom); - } - - return null; - } - }, { - key: 'count', - value: function count() { - return this.contentDom.children().length; - } - }, { - key: 'children', - value: function children() { - var children = []; - - this.contentDom.children().each(function () { - children.push(_Node3.default.getFromDom(jQuery(this))); - }); - - return children; - } - }, { - key: 'innerNodes', - value: function innerNodes() { - return this.children(); - } - }, { - key: 'removeByIndex', - value: function removeByIndex(index) { - var child = this.children()[index]; - - if (child) { - child.free(); - } - } - }, { - key: 'add', - value: function add(nodes) { - for (var i = 0; i < arguments.length; i++) { - this.contentDom.append(this.createSlotDom(arguments[i])); - } - - return this; - } - }, { - key: 'insert', - value: function insert(index, nodes) { - index = index | 0; - - var children = this.contentDom.children(); - - if (!children.length || index >= children.length) { - return this.add.apply(this, _toConsumableArray(Array.prototype.slice.call(arguments, 1))); - } - - nodes = Array.prototype.slice.call(arguments, 1); - - var i = 0; - var self = this; - - this.dom.children().each(function () { - if (index === i) { - for (var k = 0; k < nodes.length; k++) { - var slot = self.createSlotDom(nodes[k]); - slot.insertBefore(this); - } - - return false; - } - - i++; - }); - - return this; - } - }, { - key: 'clear', - value: function clear() { - this.contentDom.empty(); - } - }, { - key: 'show', - value: function show() { - this.dom.css('display', ''); - return this; - } - }, { - key: 'align', - get: function get() { - return [this.verAlign, this.horAlign]; - }, - set: function set(value) { - if (value instanceof Array && value.length >= 2) { - this.horAlign = value[1]; - this.verAlign = value[0]; - } - } - }, { - key: 'horAlign', - get: function get() { - if (this.dom.hasClass('ux-m-halign-right')) { - return 'right'; - } else if (this.hasClass('ux-m-halign-center')) { - return 'center'; - } - - return 'left'; - }, - set: function set(value) { - this.dom.removeClass('ux-m-halign-left'); - this.dom.removeClass('ux-m-halign-right'); - this.dom.removeClass('ux-m-halign-center'); - - this.dom.addClass('ux-m-halign-' + value); - } - }, { - key: 'verAlign', - get: function get() { - if (this.dom.hasClass('ux-m-valign-bottom')) { - return 'bottom'; - } else if (this.hasClass('ux-m-valign-center')) { - return 'center'; - } - - return 'top'; - }, - set: function set(value) { - this.dom.removeClass('ux-m-valign-top'); - this.dom.removeClass('ux-m-valign-bottom'); - this.dom.removeClass('ux-m-valign-center'); - - this.dom.addClass('ux-m-valign-' + value); - } - }]); - - return Container; -}(_Node3.default); - -exports.default = Container; - -},{"./Node":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\HBox.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _Container2 = require('./Container'); - -var _Container3 = _interopRequireDefault(_Container2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var HBox = function (_Container) { - _inherits(HBox, _Container); - - function HBox(nodes) { - _classCallCheck(this, HBox); - - var _this = _possibleConstructorReturn(this, (HBox.__proto__ || Object.getPrototypeOf(HBox)).apply(this, arguments)); - - _this.spacing = 0; - _this.align = ['top', 'left']; - return _this; - } - - _createClass(HBox, [{ - key: 'createDom', - value: function createDom() { - var dom = _get(HBox.prototype.__proto__ || Object.getPrototypeOf(HBox.prototype), 'createDom', this).call(this); - dom.addClass('ux-h-box'); - - return dom; - } - }, { - key: 'createSlotDom', - value: function createSlotDom(object) { - var dom = _get(HBox.prototype.__proto__ || Object.getPrototypeOf(HBox.prototype), 'createSlotDom', this).call(this, object); - return dom; - } - }, { - key: 'add', - value: function add(nodes) { - _get(HBox.prototype.__proto__ || Object.getPrototypeOf(HBox.prototype), 'add', this).apply(this, arguments); - this.spacing = this.spacing; - } - }, { - key: 'insert', - value: function insert(index, nodes) { - _get(HBox.prototype.__proto__ || Object.getPrototypeOf(HBox.prototype), 'insert', this).apply(this, arguments); - this.spacing = this.spacing; - } - }, { - key: 'fitHeight', - get: function get() { - return this.dom.hasClass('ux-m-fit-height'); - }, - set: function set(value) { - if (value) { - this.dom.addClass('ux-m-fit-height'); - } else { - this.dom.removeClass('ux-m-fit-height'); - } - } - }, { - key: 'spacing', - get: function get() { - return this._spacing; - }, - set: function set(value) { - this._spacing = value; - var slots = this.dom.find('> div'); - - slots.css('margin-right', value + 'px'); - slots.last().css('margin-right', 0); - } - }]); - - return HBox; -}(_Container3.default); - -exports.default = HBox; - -},{"./Container":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Container.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Hyperlink.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Labeled2 = require('./Labeled'); - -var _Labeled3 = _interopRequireDefault(_Labeled2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -/** - * - */ -var Hyperlink = function (_Labeled) { - _inherits(Hyperlink, _Labeled); - - function Hyperlink() { - _classCallCheck(this, Hyperlink); - - return _possibleConstructorReturn(this, (Hyperlink.__proto__ || Object.getPrototypeOf(Hyperlink)).apply(this, arguments)); - } - - _createClass(Hyperlink, [{ - key: 'createDom', - value: function createDom() { - var _this2 = this; - - var dom = jQuery(''); - dom.on('click.Hyperlink', function (e) { - if (_this2.href === '#') { - e.preventDefault(); - return false; - } - - return true; - }); - - return dom; - } - }, { - key: 'href', - get: function get() { - return this.dom.attr('href'); - }, - set: function set(value) { - this.dom.attr('href', value); - } - }, { - key: 'target', - get: function get() { - return this.dom.attr('target') || '_self'; - }, - set: function set(value) { - this.dom.attr('target', value); - } - }]); - - return Hyperlink; -}(_Labeled3.default); - -exports.default = Hyperlink; - -},{"./Labeled":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Labeled.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Icon.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Node2 = require('./Node'); - -var _Node3 = _interopRequireDefault(_Node2); - -var _Utils = require('./util/Utils'); - -var _Utils2 = _interopRequireDefault(_Utils); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Icon = function (_Node) { - _inherits(Icon, _Node); - - function Icon() { - _classCallCheck(this, Icon); - - return _possibleConstructorReturn(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).apply(this, arguments)); - } - - _createClass(Icon, [{ - key: 'createDom', - value: function createDom() { - return jQuery(''); - } - }, { - key: 'kind', - get: function get() { - this.dom.text(); - }, - set: function set(value) { - this.dom.text(value); - } - }, { - key: 'color', - get: function get() { - return this.dom.css('color') || 'black'; - }, - set: function set(value) { - this.dom.css('color', value); - } - }, { - key: 'imageSize', - get: function get() { - return _Utils2.default.toPt(this.dom.css('font-size')); - }, - set: function set(value) { - this.dom.css('font-size', value); - } - }]); - - return Icon; -}(_Node3.default); - -exports.default = Icon; - -},{"./Node":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js","./util/Utils":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\util\\Utils.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\ImageView.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Node2 = require('./Node'); - -var _Node3 = _interopRequireDefault(_Node2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ImageView = function (_Node) { - _inherits(ImageView, _Node); - - function ImageView(image) { - _classCallCheck(this, ImageView); - - var _this = _possibleConstructorReturn(this, (ImageView.__proto__ || Object.getPrototypeOf(ImageView)).call(this)); - - _this.proportional = true; - _this.displayType = 'origin'; - - if (image !== undefined) { - _this.source = image; - } - return _this; - } - - _createClass(ImageView, [{ - key: 'createDom', - value: function createDom() { - var dom = jQuery('
'); - dom.addClass('ux-image-view'); - - dom.css({ - display: 'inline-block', - backgroundRepeat: 'no-repeat', - backgroundSize: '100% 100%', - backgroundPosition: '0 0' - }); - return dom; - } - }, { - key: 'source', - get: function get() { - var source = this.dom.css('background-image'); - - if (source) { - source = /^url\((['"]?)(.*)\1\)$/.exec(source); - return source ? source[2] : null; - } - - return null; - }, - set: function set(value) { - this.dom.css({ 'background-image': 'url(\'' + value + '\')' }); - - if (this.displayType === 'origin') { - this.dom.find('img').attr('src', value); - } - } - }, { - key: 'centered', - get: function get() { - return this.dom.css('background-position') === '50% 50%'; - }, - set: function set(value) { - this.dom.css('background-position', value ? '50% 50%' : '0 0'); - } - }, { - key: 'displayType', - get: function get() { - switch (this.dom.css('background-size')) { - case '100% 100%': - return 'filled'; - case 'cover': - return 'cropped'; - case 'resized': - return 'resized'; - - case 'auto': - case 'auto auto': - return 'origin'; - - default: - return ''; - } - }, - set: function set(type) { - this.dom.find('img').remove(); - - switch (type.toString().toLowerCase()) { - case 'filled': - this.dom.css('background-size', '100% 100%'); - break; - case 'cropped': - this.dom.css('background-size', 'cover'); - break; - case 'resized': - this.dom.css('background-size', 'contain'); - break; - case 'origin': - var source = this.source; - this.dom.css('background-size', 'auto auto'); - this.dom.append(jQuery('')); - this.source = source; - break; - } - } - }]); - - return ImageView; -}(_Node3.default); - -exports.default = ImageView; - -},{"./Node":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Label.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Labeled2 = require('./Labeled'); - -var _Labeled3 = _interopRequireDefault(_Labeled2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Label = function (_Labeled) { - _inherits(Label, _Labeled); - - function Label() { - _classCallCheck(this, Label); - - return _possibleConstructorReturn(this, (Label.__proto__ || Object.getPrototypeOf(Label)).apply(this, arguments)); - } - - _createClass(Label, [{ - key: 'createDom', - value: function createDom() { - var dom = jQuery(''); - return dom; - } - }]); - - return Label; -}(_Labeled3.default); - -exports.default = Label; - -},{"./Labeled":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Labeled.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Labeled.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Node2 = require('./Node'); - -var _Node3 = _interopRequireDefault(_Node2); - -var _Font = require('./paint/Font'); - -var _Font2 = _interopRequireDefault(_Font); - -var _ImageView = require('./ImageView'); - -var _ImageView2 = _interopRequireDefault(_ImageView); - -var _Utils = require('./util/Utils'); - -var _Utils2 = _interopRequireDefault(_Utils); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Labeled = function (_Node) { - _inherits(Labeled, _Node); - - function Labeled(text, graphic) { - _classCallCheck(this, Labeled); - - var _this = _possibleConstructorReturn(this, (Labeled.__proto__ || Object.getPrototypeOf(Labeled)).call(this)); - - _this.textPreFormatted = false; - _this.textType = 'text'; - _this.contentDisplay = 'left'; - _this.graphicTextGap = 4; - _this.graphic = graphic; - _this.text = text; - _this.align = ['center', 'center']; - return _this; - } - - _createClass(Labeled, [{ - key: 'innerNodes', - value: function innerNodes() { - var result = []; - - if (this.graphic) { - result.push(this.graphic); - } - - return result; - } - }, { - key: 'font', - get: function get() { - return _Font2.default.getFromDom(this.dom); - }, - set: function set(value) { - _Font2.default.applyToDom(this.dom, value); - } - }, { - key: 'align', - get: function get() { - return [this.verAlign, this.horAlign]; - }, - set: function set(value) { - if (value instanceof Array && value.length >= 2) { - this.horAlign = value[1]; - this.verAlign = value[0]; - } - } - }, { - key: 'horAlign', - get: function get() { - if (this.dom.hasClass('ux-m-halign-right')) { - return 'right'; - } else if (this.hasClass('ux-m-halign-center')) { - return 'center'; - } - - return 'left'; - }, - set: function set(value) { - this.dom.removeClass('ux-m-halign-left'); - this.dom.removeClass('ux-m-halign-right'); - this.dom.removeClass('ux-m-halign-center'); - - this.dom.addClass('ux-m-halign-' + value); - } - }, { - key: 'verAlign', - get: function get() { - if (this.dom.hasClass('ux-m-valign-bottom')) { - return 'bottom'; - } else if (this.hasClass('ux-m-valign-center')) { - return 'center'; - } - - return 'top'; - }, - set: function set(value) { - this.dom.removeClass('ux-m-valign-top'); - this.dom.removeClass('ux-m-valign-bottom'); - this.dom.removeClass('ux-m-valign-center'); - - this.dom.addClass('ux-m-valign-' + value); - } - }, { - key: 'text', - get: function get() { - var dom = this.dom.find('span.ux-labeled-text'); - - if (this.textPreFormatted) { - dom = dom.find('> pre'); - } - - switch (this.textType) { - case 'text': - return dom.text(); - case 'html': - return dom.html(); - } - - return ''; - }, - set: function set(value) { - var dom = this.dom.find('span.ux-labeled-text'); - - if (this.textPreFormatted) { - dom = dom.find('> pre'); - } - - switch (this.textType) { - case 'text': - dom.text(value); - break; - - case 'html': - dom.html(value); - break; - } - } - }, { - key: 'textPreFormatted', - get: function get() { - return this.dom.find('span.ux-labeled-text').has('> pre').length > 0; - }, - set: function set(value) { - if (this.textPreFormatted === value) { - return; - } - - var dom = this.dom.find('span.ux-labeled-text'); - if (value) { - dom.html('
' + dom.html() + '
'); - } else { - dom.html(dom.find('> pre').html()); - } - } - }, { - key: 'textColor', - get: function get() { - return this.dom.css('color'); - }, - set: function set(value) { - this.dom.css('color', value ? value : ''); - } - }, { - key: 'textType', - get: function get() { - return this._textType; - }, - set: function set(value) { - var text = this.text; - var graphic = this.graphic; - - if (value) { - this._textType = value.toString().toLowerCase(); - } else { - this._textType = 'text'; - } - - this.text = text; - this.graphic = graphic; - } - }, { - key: 'contentDisplay', - get: function get() { - if (this.dom.first().hasClass('ux-graphic')) { - if (this.dom.hasClass('ux-labeled-vertical')) { - return 'top'; - } else { - return 'left'; - } - } else if (this.dom.last().hasClass('ux-graphic')) { - if (this.dom.hasClass('ux-labeled-vertical')) { - return 'bottom'; - } else { - return 'right'; - } - } else { - return this._contentDisplay; - } - }, - set: function set(value) { - var graphic = this.graphic; - var graphicGap = this.graphicTextGap; - this._contentDisplay = value; - - switch (value) { - case 'top': - case 'bottom': - this.dom.addClass('ux-labeled-vertical'); - break; - - case 'right': - this.dom.removeClass('ux-labeled-vertical'); - break; - - case 'left': - default: - this.dom.removeClass('ux-labeled-vertical'); - this._contentDisplay = 'left'; - break; - } - - this.graphic = graphic; - this.graphicTextGap = graphicGap; - } - }, { - key: 'graphicTextGap', - get: function get() { - var grDom = this.dom.find('.ux-graphic'); - - if (grDom.length) { - var prop = 'margin-right'; - - switch (this.contentDisplay) { - case 'bottom': - prop = 'margin-top'; - break; - case 'right': - prop = 'margin-left'; - break; - case 'top': - prop = 'margin-bottom'; - break; - } - - return _Utils2.default.toPt(grDom.css(prop)); - } else { - return this._graphicGap; - } - }, - set: function set(value) { - this._graphicGap = value; - - var grDom = this.dom.find('.ux-graphic'); - - if (grDom.length) { - grDom.css('margin', 0); - - var prop = 'margin-right'; - - switch (this.contentDisplay) { - case 'bottom': - prop = 'margin-top'; - break; - case 'right': - prop = 'margin-left'; - break; - case 'top': - prop = 'margin-bottom'; - break; - } - - grDom.css(prop, value + 'px'); - } - } - }, { - key: 'graphic', - get: function get() { - return _Node3.default.getFromDom(this.dom.find('.ux-graphic > *').first()); - }, - set: function set(node) { - var graphicGap = this.graphicTextGap; - this.dom.find('.ux-graphic').remove(); - - if (node) { - if (typeof node === 'string' || node instanceof String) { - node = new _ImageView2.default(node); - } - - var dom = jQuery('').append(node.dom); - - switch (this.contentDisplay) { - case 'top': - case 'left': - this.dom.prepend(dom); - break; - case 'bottom': - case 'right': - this.dom.append(dom); - break; - } - - this.graphicTextGap = graphicGap; - } - } - }]); - - return Labeled; -}(_Node3.default); - -exports.default = Labeled; - -},{"./ImageView":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\ImageView.js","./Node":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js","./paint/Font":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\paint\\Font.js","./util/Utils":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\util\\Utils.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\ListView.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _Container2 = require('./Container'); - -var _Container3 = _interopRequireDefault(_Container2); - -var _Node = require('./Node'); - -var _Node2 = _interopRequireDefault(_Node); - -var _AppMediator = require('../NX/AppMediator'); - -var _AppMediator2 = _interopRequireDefault(_AppMediator); - -var _Font = require('./paint/Font'); - -var _Font2 = _interopRequireDefault(_Font); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ListView = function (_Container) { - _inherits(ListView, _Container); - - function ListView() { - _classCallCheck(this, ListView); - - var _this = _possibleConstructorReturn(this, (ListView.__proto__ || Object.getPrototypeOf(ListView)).call(this)); - - _this.spacing = 0; - _this.align = ['center', 'left']; - - _this.dom.on('change.ListView', function () { - var data = { - selected: _this.selected, - selectedIndex: _this.selectedIndex - }; - - _AppMediator2.default.sendUserInput(_this, data, function () { - _this.trigger('action'); - }); - }); - return _this; - } - - _createClass(ListView, [{ - key: 'createDom', - value: function createDom() { - var dom = _get(ListView.prototype.__proto__ || Object.getPrototypeOf(ListView.prototype), 'createDom', this).call(this); - dom.addClass('list-group'); - dom.addClass('ux-list-view'); - return dom; - } - }, { - key: 'createSlotDom', - value: function createSlotDom(object) { - var _this2 = this; - - if (!(object instanceof _Node2.default)) { - throw new TypeError('createSlotDom(): 1 argument must be instance of Node'); - } - - var dom = jQuery('').append(object.dom); - - dom.on('click.ListView', function (e) { - dom.closest('.ux-list-view').find('> .ux-slot').removeClass('active'); - dom.addClass('active'); - - _this2.trigger('change'); - e.preventDefault(); - return false; - }); - - dom.data('--wrapper', object); - object.dom.data('--wrapper-dom', dom); - return dom; - } - }, { - key: 'font', - get: function get() { - return _Font2.default.getFromDom(this.dom); - }, - set: function set(value) { - _Font2.default.applyToDom(this.dom, value); - } - }, { - key: 'selectedIndex', - get: function get() { - var index = -1; - var result = -1; - - this.dom.find('> .ux-slot').each(function () { - index++; - - if (jQuery(this).hasClass('active')) { - result = index; - return true; - } - }); - - return result; - }, - set: function set(value) { - var children = this.children(); - - if (value >= 0 && value < children.length) { - this.selected = children[value]; - } else { - this.selected = null; - } - } - }, { - key: 'selected', - get: function get() { - var dom = this.dom.find('> .ux-slot.active').first(); - - if (dom) { - return _Node2.default.getFromDom(dom); - } - - return null; - }, - set: function set(object) { - this.dom.find('> .ux-slot.active').removeClass('active'); - - if (object instanceof _Node2.default) { - object.dom.closest('.ux-slot').addClass('active'); - } - } - }]); - - return ListView; -}(_Container3.default); - -exports.default = ListView; - -},{"../NX/AppMediator":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\AppMediator.js","./Container":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Container.js","./Node":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js","./paint/Font":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\paint\\Font.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Listbox.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _SelectControl2 = require('./SelectControl'); - -var _SelectControl3 = _interopRequireDefault(_SelectControl2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Listbox = function (_SelectControl) { - _inherits(Listbox, _SelectControl); - - function Listbox() { - _classCallCheck(this, Listbox); - - return _possibleConstructorReturn(this, (Listbox.__proto__ || Object.getPrototypeOf(Listbox)).apply(this, arguments)); - } - - _createClass(Listbox, [{ - key: 'createDom', - value: function createDom() { - var dom = _get(Listbox.prototype.__proto__ || Object.getPrototypeOf(Listbox.prototype), 'createDom', this).call(this); - dom.prop('multiple', true); - dom.addClass('ux-listbox'); - return dom; - } - }]); - - return Listbox; -}(_SelectControl3.default); - -exports.default = Listbox; - -},{"./SelectControl":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\SelectControl.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js":[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Utils = require("./util/Utils"); - -var _Utils2 = _interopRequireDefault(_Utils); - -var _UILoader = require("../NX/UILoader"); - -var _UILoader2 = _interopRequireDefault(_UILoader); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var KEY_CODES = { - Enter: 13, - Backspace: 8, - Tab: 9, - Cancel: 0x03, - Clear: 0x0C, - Shift: 0x10, - Ctrl: 0x11, - Alt: 0x12, - Pause: 0x13, - CapsLock: 0x14, - Esc: 0x1B, - Escape: 0x1B, - Space: 0x20, - PageUp: 0x21, - PageDown: 0x22, - End: 0x23, - Home: 0x24, - Left: 0x25, - Up: 0x26, - Right: 0x27, - Down: 0x28, - Comma: 0x2C, - Delete: 0x7F, - F1: 0x70, F2: 0x71, F3: 0x72, F4: 0x73, F5: 0x74, F6: 0x75, F7: 0x76, F8: 0x77, F9: 0x78, F10: 0x79, F11: 0x7A, F12: 0x7B, - PrintScreen: 0x9A, - Insert: 0x9B -}; - -/** - * Base HTML Node class. - **/ - -var Node = function () { - function Node(dom) { - var _this = this; - - _classCallCheck(this, Node); - - this.__observers = []; - - if (dom === undefined) { - this.dom = this.createDom(); - - if (!(this.dom instanceof jQuery)) { - throw new Error("Method createDom() must return instance of an jQuery object"); - } - } else { - if (dom instanceof jQuery) { - this.dom = dom; - } else { - throw new Error("Non-jquery object cannot be passed into Node.construct()"); - } - } - - this.dom.data('--wrapper', this); - - this.dom.on('dblclick.Node', function (e) { - _this.trigger('click-2x', e); - }); - - this.dom.on('click.Node', function (e) { - switch (e.which) { - case 1: - _this.trigger('click-left', e);break; - case 2: - _this.trigger('click-middle', e);break; - case 3: - _this.trigger('click-right', e);break; - } - }); - - var keyEventBuilder = function keyEventBuilder(event) { - return function (e) { - var found = false; - - for (var key in KEY_CODES) { - var value = KEY_CODES[key]; - - if (value === e.keyCode) { - _this.trigger(event + '-' + key.toLowerCase(), e); - - if (event.shiftKey) _this.trigger(event + "-shift+" + key.toLowerCase(), e); - if (event.ctrlKey) _this.trigger(event + "-ctrl+" + key.toLowerCase(), e); - if (event.altKey) _this.trigger(event + "-alt+" + key.toLowerCase(), e); - - found = true; - } - } - - switch (event.keyCode) { - case KEY_CODES.Up: - case KEY_CODES.Right: - case KEY_CODES.Down: - case KEY_CODES.Left: - _this.trigger(event + '-anydirection', e); - - if (event.shiftKey) _this.trigger(event + "-shift+anydirection", e); - if (event.ctrlKey) _this.trigger(event + "-ctrl+anydirection", e); - if (event.altKey) _this.trigger(event + "-alt+anydirection", e); - - break; - } - - if (event.hasOwnProperty('char') && !found) { - var char = event.char.toString().toLowerCase(); - _this.trigger(event + '-' + char, e); - - if (event.shiftKey) _this.trigger(event + "-shift+" + char, e); - if (event.ctrlKey) _this.trigger(event + "-ctrl+" + char, e); - if (event.altKey) _this.trigger(event + "-alt+" + char, e); - - if ('0123456789'.indexOf(char) > -1) { - _this.trigger(event + '-anydigit', e); - - if (event.shiftKey) _this.trigger(event + "-shift+anydigit", e); - if (event.ctrlKey) _this.trigger(event + "-ctrl+anydigit", e); - if (event.altKey) _this.trigger(event + "-alt+anydigit", e); - } - - if ('qwertyuiopasdfghjklzxcvbnm'.indexOf(char) > -1) { - _this.trigger(event + '-anyletter', e); - - if (event.shiftKey) _this.trigger(event + "-shift+anyletter", e); - if (event.ctrlKey) _this.trigger(event + "-ctrl+anyletter", e); - if (event.altKey) _this.trigger(event + "-alt+anyletter", e); - } - } - }; - }; - - this.dom.on('keydown.Node', keyEventBuilder('keydown')); - this.dom.on('keyup.Node', keyEventBuilder('keyup')); - } - - /** - * @param {function} handler - */ - - - _createClass(Node, [{ - key: "__forEachObservers", - value: function __forEachObservers(handler) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.__observers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var observer = _step.value; - - handler(observer); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - } - }, { - key: "__triggerPropertyChange", - value: function __triggerPropertyChange(name, newValue) { - var _this2 = this; - - this.__forEachObservers(function (observer) { - var oldValue = _this2[name]; - observer.triggerPropertyChange(name, oldValue, newValue); - }); - } - - /** - * @returns {string} - */ - - }, { - key: "__setTooltip", - value: function __setTooltip(tooltip) { - this.dom.data('--tooltip', tooltip); - - /*if (this.dom.data('bs.tooltip')) { - this.dom.tooltip('dispose'); - }*/ - - if (tooltip) { - var options = jQuery.extend({}, { title: tooltip instanceof Node ? tooltip.dom : tooltip }, this.tooltipOptions); - - this.dom.tooltip(options); - } - } - }, { - key: "createDom", - value: function createDom() { - throw new Error("Cannot call abstract method createDom()"); - } - }, { - key: "requestFocus", - value: function requestFocus() { - this.focus(); - } - }, { - key: "relocate", - value: function relocate(x, y) { - this.position = [x, y]; - } - }, { - key: "resize", - value: function resize(width, height) { - this.size = [width, height]; - } - }, { - key: "focus", - value: function focus() { - this.dom.focus(); - } - }, { - key: "css", - value: function css(value) { - var _dom; - - return (_dom = this.dom).css.apply(_dom, arguments); - } - }, { - key: "data", - value: function data(params) { - if (arguments.length === 1) { - var _dom2; - - return (_dom2 = this.dom).data.apply(_dom2, arguments); - } else { - var _dom3; - - (_dom3 = this.dom).data.apply(_dom3, arguments); - return this; - } - } - }, { - key: "lookup", - value: function lookup(selector) { - var dom = this.dom.find(selector).first(); - - if (dom) { - return Node.getFromDom(dom); - } - - return null; - } - }, { - key: "lookupAll", - value: function lookupAll(selector) { - var _this3 = this; - - var nodes = []; - - this.dom.find(selector).each(function () { - nodes.push(Node.getFromDom(_this3)); - }); - - return nodes; - } - }, { - key: "toFront", - value: function toFront() { - var parent = this.parent; - - if (parent) { - if (parent['childToFront']) { - parent.childToFront(this); - } - } - } - }, { - key: "toBack", - value: function toBack() { - var parent = this.parent; - - if (parent) { - if (parent['childToBack']) { - parent.childToBack(this); - } - } - } - }, { - key: "free", - value: function free() { - var wrapperDom = this.dom.data('--wrapper-dom'); - - if (wrapperDom) { - wrapperDom.remove(); - } else { - this.dom.detach(); - } - - return this; - } - }, { - key: "show", - value: function show() { - var dom = this.dom; - dom.css('display', ''); - - if (this.dom.data('--wrapper-dom')) { - dom = this.dom.data('--wrapper-dom'); - dom.css('display', ''); - } - - return this; - } - }, { - key: "hide", - value: function hide() { - var dom = this.dom; - dom.hide(); - - if (this.dom.data('--wrapper-dom')) { - dom = this.dom.data('--wrapper-dom'); - dom.hide(); - } - - return this; - } - }, { - key: "toggle", - value: function toggle() { - if (this.visible) { - this.show(); - } else { - this.hide(); - } - - return this; - } - - /** - * @param {object} properties - * @param {object} options - */ - - }, { - key: "animate", - value: function animate(properties, options) { - this.dom.animate(properties, options); - } - - /** - * Stop animation. - */ - - }, { - key: "stopAllAnimate", - value: function stopAllAnimate(clearQueue, jumpToEnd, callback) { - this.dom.stop(clearQueue, jumpToEnd); - - if (callback) { - callback(); - } - } - - /** - * Stop animation by queue. - * @param queue - * @param clearQueue - * @param jumpToEnd - */ - - }, { - key: "stopAnimate", - value: function stopAnimate(queue, clearQueue, jumpToEnd, callback) { - this.dom.stop(queue, clearQueue, jumpToEnd); - - if (callback) { - callback(); - } - } - }, { - key: "on", - value: function on(event, callback) { - var _this4 = this; - - this.dom.on(event, function (event) { - event.sender = _this4; - callback.call(_this4, event); - }); - - return this; - } - - /** - * @param {string} event - * @returns {Node} - */ - - }, { - key: "off", - value: function off(event) { - this.dom.off(event); - return this; - } - - /** - * @param {string} event - * @param params - * @returns {*} - */ - - }, { - key: "trigger", - value: function trigger(event, params) { - return this.dom.trigger(event, params); - } - - /** - * @param {string} id - * @returns {Node} - */ - - }, { - key: "child", - value: function child(id) { - return null; - } - - /** - * Returns inner Nodes as array. - * @returns {Array} - */ - - }, { - key: "innerNodes", - value: function innerNodes() { - return []; - } - - /** - * @param object - */ - - }, { - key: "loadSchema", - value: function loadSchema(object) { - for (var prop in object) { - if (object.hasOwnProperty(prop)) { - if (prop[0] === '_') { - continue; - } - - var value = object[prop]; - - if (value.hasOwnProperty('_')) { - var uiLoader = new _UILoader2.default(); - value = uiLoader.load(value); - } - - switch (prop) { - default: - this[prop] = value; - break; - } - } - } - - if (object.classes) { - this.classes = object.classes; - } - } - }, { - key: "uuid", - get: function get() { - return this.dom.attr('uuid'); - } - - /** - * @param {string} value - */ - , - set: function set(value) { - this.dom.removeClass(this.uuid); - this.dom.attr('uuid', value); - this.dom.addClass(value); - } - }, { - key: "id", - get: function get() { - return this.dom.attr('id'); - }, - set: function set(value) { - this.dom.attr('id', value); - } - - /** - * @returns {Array} - */ - - }, { - key: "classes", - get: function get() { - return this.dom.data('custom-classes') || []; - } - - /** - * @param {Array} value - */ - , - set: function set(value) { - var oldClasses = this.classes; - var classes = []; - - if (value instanceof Array) { - classes = value; - } else { - classes = value.toString().split(' '); - } - - this.dom.data('custom-classes', classes); - - if (oldClasses.length > 0) { - this.dom.removeClass(oldClasses.join(' ')); - } - - this.dom.addClass(classes.join(' ')); - } - }, { - key: "style", - get: function get() { - return this.dom.attr('style'); - }, - set: function set(value) { - this.dom.attr('style', value); - } - }, { - key: "visible", - get: function get() { - var dom = this.dom; - - if (this.dom.data('--wrapper-dom')) { - dom = this.dom.data('--wrapper-dom'); - } - - return dom.is(':visible'); - }, - set: function set(value) { - if (value) { - this.show(); - } else { - this.hide(); - } - } - }, { - key: "opacity", - get: function get() { - return this.dom.css('opacity'); - }, - set: function set(value) { - this.dom.css('opacity', value); - } - }, { - key: "enabled", - get: function get() { - return !this.dom.prop("disabled"); - }, - set: function set(value) { - this.dom.prop('disabled', !value); - } - }, { - key: "selectionEnabled", - get: function get() { - return this.dom.css('user-select') !== 'none'; - }, - set: function set(value) { - this.dom.css('user-select', value ? '' : 'none'); - } - }, { - key: "focused", - get: function get() { - return this.dom.is(':focus'); - } - }, { - key: "x", - get: function get() { - return this.dom.position().left; - }, - set: function set(value) { - this.dom.css({ left: value }); - } - }, { - key: "y", - get: function get() { - return this.dom.position().top; - }, - set: function set(value) { - this.dom.css({ top: value }); - } - }, { - key: "position", - get: function get() { - return [this.x, this.y]; - }, - set: function set(value) { - if (value instanceof Array && value.length >= 2) { - this.x = value[0]; - this.y = value[1]; - } - } - }, { - key: "width", - get: function get() { - if (this.data('--width-percent')) { - return this.data('--width-percent'); - } - - return this.dom.width(); - }, - set: function set(value) { - this.dom.width(value); - - if (typeof value === 'string' && value.indexOf('%') > -1) { - this.data('--width-percent', value); - - var wrapperDom = this.dom.data('--wrapper-dom'); - if (wrapperDom) { - this.dom.width('100%'); - } - } else { - this.data('--width-percent', null); - } - } - }, { - key: "height", - get: function get() { - if (this.data('--height-percent')) { - return this.data('--height-percent'); - } - - return this.dom.height(); - }, - set: function set(value) { - this.dom.height(value); - - if (typeof value === 'string' && value.indexOf('%') > -1) { - this.data('--height-percent', value); - - var wrapperDom = this.dom.data('--wrapper-dom'); - if (wrapperDom) { - this.dom.height('100%'); - } - } else { - this.data('--height-percent', null); - } - } - }, { - key: "size", - get: function get() { - return [this.width, this.height]; - }, - set: function set(value) { - if (value instanceof Array && value.length >= 2) { - this.width = value[0]; - this.height = value[1]; - } - } - }, { - key: "tooltip", - get: function get() { - return this.dom.data('tooltip'); - }, - set: function set(tooltip) { - if (this.tooltip === tooltip) return; - - this.__setTooltip(tooltip); - } - }, { - key: "tooltipOptions", - get: function get() { - return this.dom.data('--tooltipOptions') || {}; - }, - set: function set(options) { - this.dom.data('--tooltipOptions', options || {}); - this.__setTooltip(this.tooltip); - } - }, { - key: "padding", - get: function get() { - return [_Utils2.default.toPt(this.dom.css('padding-top')), _Utils2.default.toPt(this.dom.css('padding-right')), _Utils2.default.toPt(this.dom.css('padding-bottom')), _Utils2.default.toPt(this.dom.css('padding-left'))]; - }, - set: function set(value) { - if (value instanceof Array) { - if (value.length >= 4) { - this.dom.css({ - 'padding-top': value[0], 'padding-right': value[1], - 'padding-bottom': value[2], 'padding-left': value[3] - }); - } else if (value.length >= 2) { - this.dom.css({ - 'padding-top': value[0], 'padding-right': value[1], - 'padding-bottom': value[0], 'padding-left': value[1] - }); - } else if (value.length >= 1) { - this.dom.css('padding', value[0]); - } else { - this.dom.css('padding', 0); - } - } else { - this.dom.css('padding', value); - } - } - }, { - key: "cursor", - get: function get() { - return this.dom.css('cursor'); - }, - set: function set(value) { - this.dom.css('cursor', value); - } - }, { - key: "parent", - get: function get() { - var parent = null; - - if (this.dom.data('--wrapper-dom')) { - parent = this.dom.data('--wrapper-dom').parent(); - } else { - parent = this.dom.parent(); - } - - if (!parent) { - return null; - } - - return Node.getFromDom(parent); - } - }, { - key: "userData", - get: function get() { - return this.dom.data('--user-data'); - }, - set: function set(value) { - this.dom.data('--user-data', value); - } - }], [{ - key: "getFromDom", - value: function getFromDom(jqueryObject) { - if (jqueryObject === null || jqueryObject.length === 0) { - return null; - } - - if (jqueryObject instanceof jQuery) { - var wrapper = jqueryObject.data('--wrapper'); - return wrapper ? wrapper : new Node(jqueryObject); - } - - throw new Error("Node.getFromDom(): 1 argument must be an jQuery object"); - } - }]); - - return Node; -}(); - -exports.default = Node; - -},{"../NX/UILoader":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\UILoader.js","./util/Utils":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\util\\Utils.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\PasswordField.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _TextInputControl2 = require('./TextInputControl'); - -var _TextInputControl3 = _interopRequireDefault(_TextInputControl2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var PasswordField = function (_TextInputControl) { - _inherits(PasswordField, _TextInputControl); - - function PasswordField() { - _classCallCheck(this, PasswordField); - - return _possibleConstructorReturn(this, (PasswordField.__proto__ || Object.getPrototypeOf(PasswordField)).apply(this, arguments)); - } - - _createClass(PasswordField, [{ - key: 'createDom', - value: function createDom() { - var dom = jQuery(''); - return dom; - } - }]); - - return PasswordField; -}(_TextInputControl3.default); - -exports.default = PasswordField; - -},{"./TextInputControl":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\TextInputControl.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\ProgressBar.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _Node2 = require('./Node'); - -var _Node3 = _interopRequireDefault(_Node2); - -var _Utils = require('./util/Utils'); - -var _Utils2 = _interopRequireDefault(_Utils); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ProgressBar = function (_Node) { - _inherits(ProgressBar, _Node); - - function ProgressBar() { - _classCallCheck(this, ProgressBar); - - return _possibleConstructorReturn(this, (ProgressBar.__proto__ || Object.getPrototypeOf(ProgressBar)).apply(this, arguments)); - } - - _createClass(ProgressBar, [{ - key: 'createDom', - value: function createDom() { - var dom = jQuery('
'); - - return dom; - } - }, { - key: 'progress', - get: function get() { - return _Utils2.default.toPt(this.dom.find('> .progress-bar').css('width')); - }, - set: function set(value) { - this.dom.find('> .progress-bar').css('width', value + '%'); - } - }, { - key: 'kind', - get: function get() { - var dom = this.dom.find('> .progress-bar'); - - if (dom.hasClass('progress-bar-success')) { - return 'success'; - } else if (dom.hasClass('progress-bar-info')) { - return 'info'; - } else if (dom.hasClass('progress-bar-warning')) { - return 'warning'; - } else if (dom.hasClass('progress-bar-danger')) { - return 'danger'; - } - - return 'default'; - }, - set: function set(value) { - var dom = this.dom.find('> .progress-bar'); - - dom.removeClass('progress-bar-' + this.kind); - dom.addClass('progress-bar-' + value); - } - }, { - key: 'animated', - get: function get() { - var dom = this.dom.find('> .progress-bar'); - return dom.hasClass('active'); - }, - set: function set(value) { - var dom = this.dom.find('> .progress-bar'); - - if (value) { - dom.addClass('active'); - } else { - dom.removeClass('active'); - } - } - }, { - key: 'striped', - get: function get() { - var dom = this.dom.find('> .progress-bar'); - return dom.hasClass('progress-bar-striped'); - }, - set: function set(value) { - var dom = this.dom.find('> .progress-bar'); - - if (value) { - dom.addClass('progress-bar-striped'); - } else { - dom.removeClass('progress-bar-striped'); - } - } - }, { - key: 'value', - get: function get() { - var width = this.dom.find('> .progress-bar').css('width'); - - if (!width) { - return 0; - } - - return parseInt(width); - }, - set: function set(v) { - this.dom.find('> .progress-bar').css('width', v + "%"); - } - }]); - - return ProgressBar; -}(_Node3.default); - -exports.default = ProgressBar; - -},{"./Node":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Node.js","./util/Utils":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\util\\Utils.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\SelectControl.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _Node2 = require('./Node'); - -var _Node3 = _interopRequireDefault(_Node2); - -var _AppMediator = require('../NX/AppMediator'); - -var _AppMediator2 = _interopRequireDefault(_AppMediator); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var SelectControl = function (_Node) { - _inherits(SelectControl, _Node); - - function SelectControl(items) { - _classCallCheck(this, SelectControl); - - var _this = _possibleConstructorReturn(this, (SelectControl.__proto__ || Object.getPrototypeOf(SelectControl)).call(this)); - - if (items) { - _this.items = items; - } - - _this.dom.on('change.SelectControl', function (e) { - _AppMediator2.default.sendUserInput(_this, { selected: _this.selected, selectedText: _this.selectedText }, function () { - _this.trigger('action', e); - }); - }); - return _this; - } - - _createClass(SelectControl, [{ - key: 'loadSchema', - value: function loadSchema(object) { - _get(SelectControl.prototype.__proto__ || Object.getPrototypeOf(SelectControl.prototype), 'loadSchema', this).call(this, object); - - if (object.hasOwnProperty('selected')) { - this.selected = object.selected; - } - - if (object.hasOwnProperty('selectedText')) { - this.selectedText = object.selectedText; - } - } - }, { - key: 'createDom', - value: function createDom() { - var dom = jQuery('
'); - dom.addClass('ux-labeled'); - dom.addClass('ux-switch'); - - dom.on('click.Switch', function (e) { - var checkbox = dom.find('input[type=checkbox]'); - - if (!checkbox.prop('disabled')) { - checkbox.prop('checked', !checkbox.prop('checked')); - - _AppMediator2.default.sendUserInput(_this2, { selected: _this2.selected }, function () { - _this2.trigger('action', e); - }); - } - }); - - return dom; - } - }, { - key: "iconSize", - get: function get() { - return _Utils2.default.toPt(this.dom.find('label').css('font-size')); - }, - set: function set(value) { - var dom = this.dom.find('label'); - dom.css('font-size', value); - - var labeled = this.dom.find('.ux-labeled-text'); - - if (this.iconDisplay === 'left') { - labeled.css('padding-left', value * 2.5); - } else { - labeled.css('padding-left', ''); - } - } - }, { - key: "kind", - set: function set(value) { - if (!value) { - value = 'default'; - } - - var dom = this.dom.find('label'); - - dom.removeClass("badge-" + this.kind); - - if (value) { - dom.addClass("badge-" + value); - } - }, - get: function get() { - var dom = this.dom.find('label'); - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = KINDS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var kind = _step.value; - - if (dom.hasClass("badge-" + kind)) { - return kind; - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - return 'default'; - } - }, { - key: "iconGap", - get: function get() { - var labeled = this.dom.find('.ux-labeled-text'); - switch (this.iconDisplay) { - case 'left': - return _Utils2.default.toPt(labeled.css('margin-left')); - case 'right': - return _Utils2.default.toPt(labeled.css('margin-right')); - } - - return 0; - }, - set: function set(value) { - var labeled = this.dom.find('.ux-labeled-text'); - labeled.css('margin-right', ''); - labeled.css('margin-left', ''); - labeled.css('padding-left', ''); - - switch (this.iconDisplay) { - case 'left': - labeled.css('margin-left', value); - labeled.css('padding-left', this.iconSize * 2.5); - break; - - case 'right': - labeled.css('margin-right', value);break; - } - } - }, { - key: "iconDisplay", - get: function get() { - if (this.dom.find('> *:first').hasClass('ux-labeled-text')) { - return 'right'; - } else { - return 'left'; - } - }, - set: function set(value) { - if (this.iconDisplay === value) return; - - var gap = this.iconGap; - - var checkbox = this.dom.find('input[type=checkbox]'); - var label = this.dom.find('label'); - label.remove(); - checkbox.remove(); - - var labeled = this.dom.find('.ux-labeled-text'); - - switch (value) { - case "right": - label.insertAfter(labeled); - checkbox.insertAfter(labeled); - break; - case "left": - checkbox.insertBefore(labeled); - label.insertBefore(labeled); - break; - } - - this.iconGap = gap; - } - }]); - - return Switch; -}(_Checkbox3.default); - -exports.default = Switch; - -},{"../NX/AppMediator":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\NX\\AppMediator.js","./Checkbox":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\Checkbox.js","./util/Utils":"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\util\\Utils.js"}],"D:\\dev\\personal\\framework\\wizard-web-ui\\src-js\\src\\UX\\TextArea.js":[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _TextInputControl2 = require('./TextInputControl'); - -var _TextInputControl3 = _interopRequireDefault(_TextInputControl2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var TextArea = function (_TextInputControl) { - _inherits(TextArea, _TextInputControl); - - function TextArea() { - _classCallCheck(this, TextArea); - - return _possibleConstructorReturn(this, (TextArea.__proto__ || Object.getPrototypeOf(TextArea)).apply(this, arguments)); - } - - _createClass(TextArea, [{ - key: 'createDom', - value: function createDom() { - var dom = jQuery('",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b), -null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(" - - - - + + + {{head}} diff --git a/wizard-web-ui/src-php/framework/web/UI.php b/wizard-web-ui/src-php/framework/web/UI.php index 7a3b3a0..92c863f 100644 --- a/wizard-web-ui/src-php/framework/web/UI.php +++ b/wizard-web-ui/src-php/framework/web/UI.php @@ -422,7 +422,7 @@ protected function onMessage(UIMessageEvent $e) } } - public function makeHtmlView(string $path, string $jsAppDispatcher, array $resources = [], array $args = []): string + public function makeHtmlView(string $path, string $jsAppDispatcher, array $resources, array $args = []): string { $moduleFile = reflect::typeModule(__CLASS__)->getName(); $ext = fs::ext($moduleFile); @@ -434,38 +434,20 @@ public function makeHtmlView(string $path, string $jsAppDispatcher, array $resou $body = str::replace($body, "{\{$name\}}", $value); } - $prefix = $args['prefix'] ?? '/'; - - $body = str::replace($body, '{{dnextBootstrapCSSUrl}}', $prefix . 'dnext/bootstrap4/bootstrap.min.css'); - $body = str::replace($body, '{{dnextBootstrapJSUrl}}', $prefix. 'dnext/bootstrap4/bootstrap.min.js'); - $body = str::replace($body, '{{dnextBootstrapPopperJSUrl}}', $prefix . 'dnext/bootstrap4/popper.min.js'); - - $body = str::replace($body, '{{dnextJqueryJSUrl}}', $prefix . 'dnext/jquery/jquery-3.2.1.min.js'); - - $body = str::replace($body, '{{dnextCSSUrl}}', $prefix . 'dnext/engine-' . Application::current()->stamp . '.min.css'); - $body = str::replace($body, '{{dnextFontCSSUrl}}', $prefix . 'dnext/material-icons/material-icons.css'); - $body = str::replace($body, '{{dnextJSUrl}}', $prefix . 'dnext/engine-' . Application::current()->stamp . '.js'); - $body = str::replace($body, '{{uiSchemaUrl}}', "$path/@ui-schema"); $body = str::replace($body, '{{uiSocketUrl}}', "$path/@ws/"); $body = str::replace($body, '{{jsAppDispatcher}}', $jsAppDispatcher); - $head = []; - foreach ($resources as $resource) { - $ext = fs::ext($resource); - switch ($ext) { - case "js": - $head[] = ""; - break; - case "css": - $head[] = ""; - break; - } + foreach ($resources as $file => $data) { + if ($data["type"] == "text/css") + $head[] = ""; + else if ($data["type"] == "text/javascript") + $head[] = ""; } - $body = str::replace($body, '{{head}}', str::join($head, "\n")); + $body = str::replace($body, "{{head}}", str::join($head, "\n")); return $body; } diff --git a/wizard-web-ui/src-php/framework/web/UILoader.php b/wizard-web-ui/src-php/framework/web/UILoader.php index f88f770..aefaf52 100644 --- a/wizard-web-ui/src-php/framework/web/UILoader.php +++ b/wizard-web-ui/src-php/framework/web/UILoader.php @@ -33,7 +33,7 @@ class UILoader extends Component /** * @var array */ - private $components = []; + public $components = []; /** * @var ComponentLoader @@ -185,7 +185,7 @@ protected function _load(array $data): UINode */ if ($ownComponents) { foreach ($ownComponents as $component) { - $node->components->add($this->componentLoader->load($component)); + $node->components[] = $this->componentLoader->load($component); } } @@ -223,7 +223,7 @@ public function load(array $data): void * @param string $format * @return mixed */ - public function loadFromStream(Stream $stream, ?string $schemaKey = null, string $format = 'json') + public function loadFromStream(Stream $stream, ?string $schemaKey = null, string $format = "json") { switch ($format) { case "json": diff --git a/wizard-web-ui/src-php/framework/web/ui/UILabeled.php b/wizard-web-ui/src-php/framework/web/ui/UILabeled.php index e464436..b5711ce 100644 --- a/wizard-web-ui/src-php/framework/web/ui/UILabeled.php +++ b/wizard-web-ui/src-php/framework/web/ui/UILabeled.php @@ -73,7 +73,7 @@ abstract class UILabeled extends UINode * @param string|null $text * @param UINode|null $graphic */ - public function __construct(string $text = '', UINode $graphic = null) + public function __construct(string $text = "", UINode $graphic = null) { parent::__construct(); diff --git a/wizard-web-ui/src-php/framework/web/ui/UINode.php b/wizard-web-ui/src-php/framework/web/ui/UINode.php index 7db3613..55a7b02 100644 --- a/wizard-web-ui/src-php/framework/web/ui/UINode.php +++ b/wizard-web-ui/src-php/framework/web/ui/UINode.php @@ -786,7 +786,7 @@ public function innerNodes(): array return []; } - public function on(string $eventType, callable $handler, string $group = 'general') + public function on(string $eventType, callable $handler, string $group = "general") { parent::on($eventType, $handler, $group); diff --git a/wizard-web/package.build.php b/wizard-web/package.build.php new file mode 100644 index 0000000..a9ce17f --- /dev/null +++ b/wizard-web/package.build.php @@ -0,0 +1,10 @@ +