
<? xml version = "1.0" encoding = "utf-8" standalone = "no"?> <application xmlns = "http://ns.adobe.com/air/application/1.0"> <id> com.adobe.example.testJS </ id> <filename> testJS </ filename> <name> testJS </ name> <version> 1.0 </ version> <description /> <copyright /> <title> Test ExtJs </ title> <initialWindow> <content> html / main.html </ content> <title /> <systemChrome> none </ systemChrome> <transparent> true </ transparent> <visible> false </ visible> <minimizable> true </ minimizable> <maximizable> false </ maximizable> <resizable> false </ resizable> </ initialWindow> <icon> <image16x16> icons / AIRApp_16.png </ image16x16> <image32x32> icons / AIRApp_32.png </ image32x32> <image48x48> icons / AIRApp_48.png </ image48x48> <image128x128> icons / AIRApp_128.png </ image128x128> </ icon> <fileTypes> </ fileTypes> </ application>
<html>
<head>
<title> Testing ExtJS </ title>
<meta http-equiv = "content-Type" content = "text / html; charset = UTF-8" />
<link href = "/ css / main.css" rel = "stylesheet" type = "text / css" />
<link href = "/ lib / ext / resources / css / ext-all.css" rel = "stylesheet" type = "text / css" />
<script type = "text / javascript" src = "/ lib / air / AIRIntrospector.js"> </ script>
<script type = "text / javascript" src = "/ lib / air / AIRAliases.js"> </ script>
<script type = "text / javascript" src = "/ lib / jquery / jquery.js"> </ script>
<script type = "text / javascript" src = "/ lib / ext / ext-jquery-adapter.js"> </ script>
<script type = "text / javascript" src = "/ lib / ext / ext-all.js"> </ script>
<script type = "text / javascript" src = "/ javascript / application.js"> </ script>
<script type = "text / javascript">
$ (document) .ready (app.init);
</ script>
</ head>
<body>
</ body>
</ html> var app = {
// --------------
_mainWindow: null,
// --------------
/ *
* initialization
* /
init: function () {
window.nativeWindow.maximize ();
app.setupListeners ();
app.doCreateMainWindow ();
window.nativeWindow.visible = true;
},
/ *
* set up event handlers
* /
setupListeners: function () {
// here we catch the change in the state of the native window
window.nativeWindow.addEventListener ('displayStateChanging', app.doDisplayStateChanging);
},
/ *
* creating the main window
* /
doCreateMainWindow: function () {
this._mainWindow = new Ext.Window ({
width: 800,
height: 600,
minWidth: 300,
minHeight: 200,
x: 100,
y: 100,
minimizable: true
maximizable: true
title: "Our main window",
});
this._mainWindow.on ('minimize', app.doMinimize);
this._mainWindow.on ('close', app.doClose);
this._mainWindow.show ();
},
/ *
* change the state of the main native window
* @param {Event} event displayStateChange
* /
doDisplayStateChanging: function (e) {
if (e.afterDisplayState == 'normal') {
e.preventDefault ();
window.nativeWindow.visible = false;
window.nativeWindow.maximize ();
window.nativeWindow.visible = true;
}
else
if (e.afterDisplayState == 'minimized') {
e.preventDefault ();
window.nativeWindow.visible = false;
window.nativeWindow.minimize ();
window.nativeWindow.visible = true;
}
},
/ *
* processing the event to close the main window
* @param {Ext.window} closeable window
* /
doClose: function (win) {
air.NativeApplication.nativeApplication.exit ();
},
/ *
* processing the event to minimize the main window
* @param {Ext.window} minimized window
* /
doMinimize: function (win) {
window.nativeWindow.visible = false;
window.nativeWindow.minimize ();
window.nativeWindow.visible = true;
}
} Source: https://habr.com/ru/post/27403/
All Articles