### Basic qx.Server Example
Source: https://archive.qooxdoo.org/5.0.2/toc
Demonstrates a basic setup and usage of qx.Server, a component for server-side JavaScript applications. It covers installation and simple example scenarios for running qooxdoo on the server.
```javascript
var server = require("qooxdoo-server");
server.on("request", function(req, res) {
res.writeHead(200, {"Content-Type": "text/plain"});
res.end("Hello World!");
});
server.listen(8080);
```
--------------------------------
### qooxdoo Hello World Example (SDK)
Source: https://archive.qooxdoo.org/5.0.2/toc
A simple 'Hello World' application demonstrating the basic structure and setup of a qooxdoo application using the SDK. This is often the first example encountered when starting with qooxdoo.
```javascript
qx.Class.define("myapp.Application", {
extend: qx.application.Standalone,
members: {
/**
* This method contains the initial application code.
*/
main: function() {
// Call super class
this.base(arguments);
// Enable logging in debug builds
if (qx.core.Environment.get("qx.debug")) {
// Support native logging capabilities, e.g. Firebug for Firefox
qx.log.appender.Native;
// Support additional cross-browser console.
qx.log.appender.Console;
}
// create a button
var button = new qx.ui.form.Button("Hello World!");
// add button to the root document
this.getRoot().add(button, {left: "50%", top: "50%"});
// add event listener
button.addListener("execute", function(e) {
alert("Hello World!");
});
}
}
});
```
--------------------------------
### Loading qooxdoo Server Module in Node.js
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/server/getting_started
This snippet demonstrates loading the qooxdoo library in a Node.js environment and defining a basic class that extends qx.core.Object with a bark method. It requires Node.js and the qooxdoo package installed via npm. The example creates an instance and calls the method to output 'Ruff!' to the console. No specific inputs or outputs beyond console logging; suitable for initial setup but lacks error handling.
```javascript
var qx = require('%{qooxdoo}');
qx.Class.define("Dog", {
extend : qx.core.Object,
members : {
bark : function() {
console.log("Ruff!");
}
}
});
var dog = new Dog();
dog.bark();
```
--------------------------------
### Initialize qx.Website and Display Div Content
Source: https://archive.qooxdoo.org/5.0.2/pages/website/getting_started
This example demonstrates the fundamental setup for using qx.Website in an HTML page. It includes the library via script tag and uses the q() selector to retrieve a div's HTML content. The code alerts the div's inner HTML when executed, assuming the qx.Website library is properly loaded at the specified URI.
```html
Hello World!
```
--------------------------------
### Qooxdoo SDK Tooling
Source: https://archive.qooxdoo.org/5.0.2/toc
Introduction to the Qooxdoo SDK, its requirements, and a basic 'Hello World' example to get started with the tools.
```APIDOC
## Tooling
### Introduction
Provides an introduction to the Qooxdoo SDK, its requirements, and a 'Hello World' example to help users get started with the development tools.
```
--------------------------------
### Build Qooxdoo Application for Deployment
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/tool/getting_started
Produces an optimized production-ready build version of the application. The process concatenates all required classes into a single minimized JavaScript file, strips debug code, removes whitespace and comments, and performs various code optimizations for faster startup and improved performance.
```shell
generate.py build
```
--------------------------------
### Generate Qooxdoo Source with All Classes
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/tool/getting_started
Executes the qooxdoo generator to rebuild the source version including all available source classes. Required when introducing new classes or changing dependencies during development. The resulting application loads individual unoptimized JavaScript files.
```shell
generate.py source-all
```
--------------------------------
### Setup Qooxdoo Grunt Toolchain (Bash)
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/tool/grunt
Installs required npm packages and configures the qooxdoo Grunt toolchain by running npm install followed by grunt setup. Requires Node.js, npm, and Python (for Generator) installed; qooxdoo project directory. On Windows, run as administrator for symlink creation. Outputs setup completion; no specific return value, but enables Grunt tasks. Limitations: Symlinks may fail on restricted systems.
```bash
$ npm install
$ grunt setup
```
--------------------------------
### Generate Qooxdoo API Documentation
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/tool/getting_started
Parses JSDoc-style comments from application and framework source code to create an interactive API viewer. The generated documentation is fully cross-linked, searchable, and accessible via a web interface in the api folder. Supports JavaScript and qooxdoo-specific documentation features.
```shell
generate.py api
```
--------------------------------
### Basic HTML Structure with qooxdoo Website API
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/website/getting_started
This HTML snippet demonstrates how to include the qooxdoo Website library and use its API to interact with HTML elements. It assumes the library is available at a specified URI and shows a simple example of retrieving HTML content from a div element.
```html
Hello World!
```
--------------------------------
### Basic qooxdoo Server Example in Node.js
Source: https://archive.qooxdoo.org/5.0.2/pages/server/overview
Demonstrates how to use the qooxdoo qx.Server package in a Node.js environment. It defines custom classes and utilizes Node.js's console object. Requires the qooxdoo package to be installed via npm.
```javascript
var qx = require('qooxdoo');
// create animal class
qx.Class.define("my.Animal", {
extend : qx.core.Object,
properties : {
legs : {init: 4}
}
});
// create dog class
qx.Class.define("my.Dog", {
extend : my.Animal,
members : {
bark : function() {
console.log("ARF! I have " + this.getLegs() + " legs!");
}
}
});
var dog = new my.Dog();
dog.bark();
```
--------------------------------
### qx.Server Requirements and Installation
Source: https://archive.qooxdoo.org/5.0.2/toc
Outlines the prerequisites for using qx.Server and provides instructions on how to install it. This includes specifying supported runtimes and the installation command.
```bash
# Install qx.Server using npm
npm install qooxdoo-server --save-dev
# Supported Runtimes:
# - Node.js (version X.Y or higher)
```
--------------------------------
### Loading qx.Server in Node.js with qooxdoo
Source: https://archive.qooxdoo.org/5.0.2/pages/server/getting_started
This snippet shows how to load the qx.Server module in a Node.js environment. It defines a simple 'Dog' class extending qooxdoo's core Object and demonstrates its usage by creating an instance and calling a method.
```javascript
var qx = require('qooxdoo');
qx.Class.define("Dog", {
extend : qx.core.Object,
members : {
bark : function() {
console.log("Ruff!");
}
}
});
var dog = new Dog();
dog.bark();
```
--------------------------------
### qooxdoo Widget Reference Example
Source: https://archive.qooxdoo.org/5.0.2/toc
Illustrates how to use widgets from the qooxdoo widget library. This example shows the creation and basic configuration of a text field and a button.
```javascript
// Create a text field
var nameField = new qx.ui.form.TextField("Enter your name");
nameField.setRequired(true);
// Create a button
var submitButton = new qx.ui.form.Button("Submit");
submitButton.addListener("execute", function() {
alert("Hello, " + nameField.getValue() + "!");
});
// Add widgets to the root
var container = new qx.ui.container.VBox(10);
container.add(nameField);
container.add(submitButton);
this.getRoot().add(container, {left: 20, top: 20});
```
--------------------------------
### Complete Configuration Example (JSON)
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/tool/generator/generator_config_articles
Illustrates a complete configuration example including include, jobs, let, library, and environment keys. This shows how to combine external and local configurations to create a custom build process.
```json
{
"include": [{"as": "apiconf", "path": "../apiviewer/config.json"}],
"jobs": {
"myapi": {
"extend": ["apiconf::build"],
"let": {
"ROOT": "../apiviewer",
"BUILD_PATH": "./api",
"API_INCLUDE": ["qx.*", "myapp.*"],
"API_EXCLUDE": ["myapp.tests.*"]
},
"library": { ... },
"environment": {
"myapp.resourceUri": "./resource"
}
}
}
}
```
--------------------------------
### Example Gruntfile Configuration (JavaScript)
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/tool/grunt
Defines a basic Gruntfile.js for qooxdoo applications, loading utilities and qooxdoo Grunt module, then exporting a configuration object with generator settings. Depends on Node.js, Grunt, and qooxdoo path; run via Grunt CLI. Configures tasks like generator jobs; inputs via config object, outputs build artifacts. Limitations: Incomplete example; requires full qooxdoo setup for execution.
```javascript
// requires
var util = require('util');
var qx = require("${REL_QOOXDOO_PATH}/tool/grunt");
// grunt
module.exports = function(grunt) {
var config = {
generator_config: {
let: {
}
},
common: {
```
--------------------------------
### qx.Server Development
Source: https://archive.qooxdoo.org/5.0.2/toc
Information on using Qooxdoo's qx.Server module for server-side development. Covers included features, supported runtimes, installation, and examples.
```APIDOC
## qx.Server
### Server Overview
Details the features, supported runtimes, installation process, and provides basic and additional usage examples for qx.Server.
### qx.Server Requirements
Specifies the runtime requirements and installation procedures for qx.Server.
### RequireJS Support
Explains the representable interface and configuration file related to RequireJS support in qx.Server.
```
--------------------------------
### Higher-level requests - Basic Setup
Source: https://archive.qooxdoo.org/5.0.2/pages/communication/request_io
Demonstrates the basic setup for making an HTTP request using qooxdoo's Xhr transport, including setting the URL, method, and request data.
```APIDOC
## POST /books
### Description
This endpoint is used to create a new book resource.
### Method
POST
### Endpoint
/books
### Parameters
#### Query Parameters
None
#### Request Body
- **title** (String) - Required - The title of the book.
### Request Example
```json
{
"title": "The title"
}
```
### Response
#### Success Response (200)
- **id** (String) - The unique identifier of the newly created book.
- **title** (String) - The title of the book.
#### Response Example
```json
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"title": "The title"
}
```
```
--------------------------------
### Initial List Controller Setup (JavaScript)
Source: https://archive.qooxdoo.org/5.0.2/pages/desktop/tutorials/tutorial-part-4-2
This is the original configuration for the Qooxdoo List controller before customization. It shows the basic setup for creating a list controller, setting label and icon paths directly, and configuring item appearance. This code block is provided for context, indicating what parts are removed or modified to integrate the custom delegate.
```javascript
// create the controller
var controller = new qx.data.controller.List(null, main.getList());
controller.setLabelPath("text");
controller.setIconPath("user.profile_image_url");
controller.setDelegate({
configureItem : function(item) {
item.getChildControl("icon").setWidth(48);
item.getChildControl("icon").setHeight(48);
item.getChildControl("icon").setScale(true);
item.setRich(true);
}
});
```
--------------------------------
### Example: #asset Compiler Hint (Qooxdoo < 3.0)
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/tool/migration/migration_guide
Demonstrates the syntax for the deprecated `#asset` compiler hint used in older versions of Qooxdoo. This hint is used for including assets in the application, and its functionality is replaced by `@asset` in newer versions.
```javascript
/* **************************************************
#asset(myApp/*)
************************************************* */
/**
* This is ... of your custom application "myApp"
*/
qx.Class.define("myApp.Application",
{
extend : qx.application.Standalone,
...
}
```
--------------------------------
### SCSS and Sass Syntax Examples
Source: https://archive.qooxdoo.org/5.0.2/pages/mobile/theming
These examples demonstrate the SCSS syntax using nested rules and property grouping, which extends CSS for modularity. The Sass example shows the alternative indented syntax. Purpose is to illustrate differences; no dependencies beyond Sass compiler; input is stylesheet content, output is compiled CSS; limitations include requiring compilation for use in browsers.
```scss
#main {
color: blue;
font-size: 0.3em;
a {
font: {
weight: bold;
family: serif;
}
}
}
```
```sass
#main
color: blue
font-size: 0.3em
a
font:
weight: bold
family: serif
```
--------------------------------
### POST /rpc/getString
Source: https://archive.qooxdoo.org/5.0.2/pages/communication/rpc_server_writer_guide
Returns the string "Hello world".
```APIDOC
## POST /rpc/getString
### Description
Returns the constant string `"Hello world"`.
### Method
POST
### Endpoint
/rpc/getString
### Parameters
None.
### Request Example
{}
### Response
#### Success Response (200)
- **value** (string) - The string "Hello world".
### Response Example
{
"value": "Hello world"
}
```
--------------------------------
### Portable Test Runner Example (HTML/JavaScript)
Source: https://archive.qooxdoo.org/5.0.2/_sources/pages/development/frame_apps_testrunner
This HTML and JavaScript example demonstrates how to use the portable Test Runner. It includes the testrunner-portable.js script, the application code (foo.js), and the test definitions in JavaScript.
```html
Test Runner