How to use availableWidth method in Best

Best JavaScript code snippet using best

test-content-recommendation.js

Source:test-content-recommendation.js Github

copy

Full Screen

1/**2 * Copyright 2019 The AMP HTML Authors. All Rights Reserved.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS-IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16import {17 LayoutType,18 getAutoConfig,19 getPubControlConfig,20} from '../content-recommendation.js';21describe('getAutoConfig', function () {22 it('should use image_stacked on wide slots', function () {23 const runTest = (availableWidth, expectedWidth, expectedHeight) => {24 expect(25 getAutoConfig(availableWidth, /* isMobile= */ false)26 ).to.deep.equal({27 layoutType: LayoutType.IMAGE_STACKED,28 numberOfColumns: 4,29 numberOfRows: 2,30 slotWidth: expectedWidth,31 slotHeight: expectedHeight,32 });33 };34 runTest(35 /* availableWidth= */ 1440,36 /* expectedWidth= */ 1200,37 /* expectedHeight= */ 60038 );39 runTest(40 /* availableWidth= */ 1200,41 /* expectedWidth= */ 1200,42 /* expectedHeight= */ 60043 );44 runTest(45 /* availableWidth= */ 800,46 /* expectedWidth= */ 800,47 /* expectedHeight= */ 48048 );49 runTest(50 /* availableWidth= */ 500,51 /* expectedWidth= */ 500,52 /* expectedHeight= */ 35053 );54 runTest(55 /* availableWidth= */ 468,56 /* expectedWidth= */ 468,57 /* expectedHeight= */ 32758 );59 });60 it('should use mobile_banner_image_sidebyside on narrow slots on mobile', function () {61 const runTest = (availableWidth, expectedWidth, expectedHeight) => {62 expect(getAutoConfig(availableWidth, /* isMobile= */ true)).to.deep.equal(63 {64 layoutType: LayoutType.MOBILE_BANNER_IMAGE_SIDEBYSIDE,65 numberOfColumns: 1,66 numberOfRows: 12,67 slotWidth: expectedWidth,68 slotHeight: expectedHeight,69 }70 );71 };72 runTest(73 /* availableWidth= */ 467,74 /* expectedWidth= */ 467,75 /* expectedHeight= */ 170076 );77 runTest(78 /* availableWidth= */ 414,79 /* expectedWidth= */ 414,80 /* expectedHeight= */ 152081 );82 runTest(83 /* availableWidth= */ 360,84 /* expectedWidth= */ 360,85 /* expectedHeight= */ 133686 );87 runTest(88 /* availableWidth= */ 320,89 /* expectedWidth= */ 320,90 /* expectedHeight= */ 120091 );92 runTest(93 /* availableWidth= */ 300,94 /* expectedWidth= */ 300,95 /* expectedHeight= */ 113196 );97 runTest(98 /* availableWidth= */ 200,99 /* expectedWidth= */ 200,100 /* expectedHeight= */ 791101 );102 runTest(103 /* availableWidth= */ 120,104 /* expectedWidth= */ 120,105 /* expectedHeight= */ 519106 );107 });108 it('should use image_sidebyside on narrow slots on desktop', function () {109 const runTest = (availableWidth, expectedWidth, expectedHeight) => {110 expect(111 getAutoConfig(availableWidth, /* isMobile= */ false)112 ).to.deep.equal({113 layoutType: LayoutType.IMAGE_SIDEBYSIDE,114 numberOfColumns: 1,115 numberOfRows: 13,116 slotWidth: expectedWidth,117 slotHeight: expectedHeight,118 });119 };120 runTest(121 /* availableWidth= */ 467,122 /* expectedWidth= */ 467,123 /* expectedHeight= */ 1606124 );125 runTest(126 /* availableWidth= */ 414,127 /* expectedWidth= */ 414,128 /* expectedHeight= */ 1424129 );130 runTest(131 /* availableWidth= */ 360,132 /* expectedWidth= */ 360,133 /* expectedHeight= */ 1238134 );135 runTest(136 /* availableWidth= */ 320,137 /* expectedWidth= */ 320,138 /* expectedHeight= */ 1100139 );140 runTest(141 /* availableWidth= */ 300,142 /* expectedWidth= */ 300,143 /* expectedHeight= */ 1032144 );145 runTest(146 /* availableWidth= */ 250,147 /* expectedWidth= */ 250,148 /* expectedHeight= */ 860149 );150 runTest(151 /* availableWidth= */ 200,152 /* expectedWidth= */ 200,153 /* expectedHeight= */ 688154 );155 runTest(156 /* availableWidth= */ 120,157 /* expectedWidth= */ 120,158 /* expectedHeight= */ 412159 );160 });161});162describe('getPubControlConfig', function () {163 it('should use setting when only one provided', function () {164 const rawPubControlParams = {165 numberOfColumns: '4',166 numberOfRows: '2',167 layoutType: LayoutType.IMAGE_STACKED,168 };169 const runTest = (availableWidth, expectedWidth, expectedHeight) => {170 expect(171 getPubControlConfig(availableWidth, rawPubControlParams)172 ).to.deep.equal({173 layoutType: LayoutType.PUB_CONTROL_IMAGE_STACKED,174 numberOfColumns: 4,175 numberOfRows: 2,176 slotWidth: expectedWidth,177 slotHeight: expectedHeight,178 });179 };180 runTest(181 /* availableWidth= */ 1300,182 /* expectedWidth= */ 1300,183 /* expectedHeight= */ 513184 );185 runTest(186 /* availableWidth= */ 1200,187 /* expectedWidth= */ 1200,188 /* expectedHeight= */ 487189 );190 runTest(191 /* availableWidth= */ 800,192 /* expectedWidth= */ 800,193 /* expectedHeight= */ 382194 );195 runTest(196 /* availableWidth= */ 500,197 /* expectedWidth= */ 500,198 /* expectedHeight= */ 304199 );200 runTest(201 /* availableWidth= */ 400,202 /* expectedWidth= */ 400,203 /* expectedHeight= */ 278204 );205 });206 it('should use different settings for mobile and desktop when two provided', function () {207 const rawPubControlParams = {208 numberOfColumns: '1,4',209 numberOfRows: '3,2',210 layoutType: `${LayoutType.IMAGE_SIDEBYSIDE},${LayoutType.IMAGE_STACKED}`,211 };212 const expectedDesktopConfig = {213 layoutType: LayoutType.PUB_CONTROL_IMAGE_STACKED,214 numberOfColumns: 4,215 numberOfRows: 2,216 };217 const expectedMobileConfig = {218 layoutType: LayoutType.PUB_CONTROL_IMAGE_SIDEBYSIDE,219 numberOfColumns: 1,220 numberOfRows: 3,221 };222 const runTest = (223 availableWidth,224 expectedWidth,225 expectedHeight,226 expectedConfig227 ) => {228 expectedConfig.slotWidth = expectedWidth;229 expectedConfig.slotHeight = expectedHeight;230 expect(231 getPubControlConfig(availableWidth, rawPubControlParams)232 ).to.deep.equal(expectedConfig);233 };234 // Above 468px the logic should use desktop setting.235 runTest(236 /* availableWidth= */ 1300,237 /* expectedWidth= */ 1300,238 /* expectedHeight= */ 513,239 expectedDesktopConfig240 );241 runTest(242 /* availableWidth= */ 1200,243 /* expectedWidth= */ 1200,244 /* expectedHeight= */ 487,245 expectedDesktopConfig246 );247 runTest(248 /* availableWidth= */ 800,249 /* expectedWidth= */ 800,250 /* expectedHeight= */ 382,251 expectedDesktopConfig252 );253 runTest(254 /* availableWidth= */ 500,255 /* expectedWidth= */ 500,256 /* expectedHeight= */ 304,257 expectedDesktopConfig258 );259 // Below 468px the logic should use mobile setting.260 runTest(261 /* availableWidth= */ 400,262 /* expectedWidth= */ 400,263 /* expectedHeight= */ 333,264 expectedMobileConfig265 );266 runTest(267 /* availableWidth= */ 300,268 /* expectedWidth= */ 300,269 /* expectedHeight= */ 255,270 expectedMobileConfig271 );272 });273 it('should return different sizes for different layouts', function () {274 // sanity check that when publisher provides different layouts we use275 // apply different coefficients and get different ad slot sizes.276 const runTest = (layout, expectedHeight) => {277 const width = 800;278 const rawPubParams = {279 numberOfColumns: '4',280 numberOfRows: '2',281 layoutType: layout,282 };283 expect(getPubControlConfig(width, rawPubParams)).to.deep.equal({284 layoutType: 'pub_control_' + layout,285 numberOfColumns: 4,286 numberOfRows: 2,287 slotWidth: width,288 slotHeight: expectedHeight,289 });290 };291 runTest(LayoutType.IMAGE_SIDEBYSIDE, /* expectedHeight= */ 123);292 runTest(LayoutType.IMAGE_STACKED, /* expectedHeight= */ 382);293 runTest('text_card', /* expectedHeight= */ 184);294 });295 it('should reject invalid pub params', function () {296 const runTest = (pubControlParams, expectedErrorRegex) => {297 const coreConfig = getPubControlConfig(100, pubControlParams);298 expect(coreConfig.validationError).to.match(expectedErrorRegex);299 };300 // One of pub control params is missing.301 runTest(302 {numberOfRows: '1', numberOfColumns: '1'},303 /Tags .* should be set together/304 );305 runTest(306 {numberOfColumns: '1', layoutType: 'foo'},307 /Tags .* should be set together/308 );309 runTest(310 {numberOfRows: '1', layoutType: 'foo'},311 /Tags .* should be set together/312 );313 // Length of parameters doesn't match314 runTest(315 {numberOfRows: '1', numberOfColumns: '1', layoutType: 'foo,bar'},316 /Lengths of parameters .* must match/317 );318 runTest(319 {numberOfRows: '1', numberOfColumns: '1,2', layoutType: 'foo'},320 /Lengths of parameters .* must match/321 );322 runTest(323 {numberOfRows: '1,2', numberOfColumns: '1', layoutType: 'foo'},324 /Lengths of parameters .* must match/325 );326 // Length is more than 2.327 runTest(328 {329 numberOfRows: '1,2,3',330 numberOfColumns: '1,2,3',331 layoutType: 'foo,bar,baz',332 },333 /At most 2 parameters for each attribute are needed/334 );335 // Passed non-number for rows/columns.336 runTest(337 {numberOfRows: 'foo', numberOfColumns: '1', layoutType: 'foo'},338 /Wrong value 'foo' for/339 );340 runTest(341 {numberOfRows: '1', numberOfColumns: 'foo', layoutType: 'foo'},342 /Wrong value 'foo' for/343 );344 });345 it('limits number of columns if publisher chose too many', function () {346 const rawPubControlParams = {347 numberOfColumns: '5', // want 5 columns.348 numberOfRows: '2',349 layoutType: LayoutType.IMAGE_STACKED,350 };351 expect(getPubControlConfig(300, rawPubControlParams)).to.deep.equal({352 numberOfColumns: 3, // only 3 columns fit at the end.353 numberOfRows: 2,354 layoutType: LayoutType.PUB_CONTROL_IMAGE_STACKED,355 slotWidth: 300,356 slotHeight: 277,357 });358 });...

Full Screen

Full Screen

documentContext.js

Source:documentContext.js Github

copy

Full Screen

1'use strict';2var TraversalTracker = require('./traversalTracker');3var isString = require('./helpers').isString;4/**5 * Creates an instance of DocumentContext - a store for current x, y positions and available width/height.6 * It facilitates column divisions and vertical sync7 */8function DocumentContext(pageSize, pageMargins) {9 this.pages = [];10 this.pageMargins = pageMargins;11 this.x = pageMargins.left;12 this.availableWidth = pageSize.width - pageMargins.left - pageMargins.right;13 this.availableHeight = 0;14 this.page = -1;15 this.snapshots = [];16 this.endingCell = null;17 this.tracker = new TraversalTracker();18 this.addPage(pageSize);19 this.hasBackground = false;20}21DocumentContext.prototype.beginColumnGroup = function () {22 this.snapshots.push({23 x: this.x,24 y: this.y,25 availableHeight: this.availableHeight,26 availableWidth: this.availableWidth,27 page: this.page,28 bottomMost: {29 x: this.x,30 y: this.y,31 availableHeight: this.availableHeight,32 availableWidth: this.availableWidth,33 page: this.page34 },35 endingCell: this.endingCell,36 lastColumnWidth: this.lastColumnWidth37 });38 this.lastColumnWidth = 0;39};40DocumentContext.prototype.beginColumn = function (width, offset, endingCell) {41 var saved = this.snapshots[this.snapshots.length - 1];42 this.calculateBottomMost(saved);43 this.endingCell = endingCell;44 this.page = saved.page;45 this.x = this.x + this.lastColumnWidth + (offset || 0);46 this.y = saved.y;47 this.availableWidth = width; //saved.availableWidth - offset;48 this.availableHeight = saved.availableHeight;49 this.lastColumnWidth = width;50};51DocumentContext.prototype.calculateBottomMost = function (destContext) {52 if (this.endingCell) {53 this.saveContextInEndingCell(this.endingCell);54 this.endingCell = null;55 } else {56 destContext.bottomMost = bottomMostContext(this, destContext.bottomMost);57 }58};59DocumentContext.prototype.markEnding = function (endingCell) {60 this.page = endingCell._columnEndingContext.page;61 this.x = endingCell._columnEndingContext.x;62 this.y = endingCell._columnEndingContext.y;63 this.availableWidth = endingCell._columnEndingContext.availableWidth;64 this.availableHeight = endingCell._columnEndingContext.availableHeight;65 this.lastColumnWidth = endingCell._columnEndingContext.lastColumnWidth;66};67DocumentContext.prototype.saveContextInEndingCell = function (endingCell) {68 endingCell._columnEndingContext = {69 page: this.page,70 x: this.x,71 y: this.y,72 availableHeight: this.availableHeight,73 availableWidth: this.availableWidth,74 lastColumnWidth: this.lastColumnWidth75 };76};77DocumentContext.prototype.completeColumnGroup = function (height) {78 var saved = this.snapshots.pop();79 this.calculateBottomMost(saved);80 this.endingCell = null;81 this.x = saved.x;82 var y = saved.bottomMost.y;83 if (height) {84 if (saved.page === saved.bottomMost.page) {85 if ((saved.y + height) > y) {86 y = saved.y + height;87 }88 } else {89 y += height;90 }91 }92 this.y = y;93 this.page = saved.bottomMost.page;94 this.availableWidth = saved.availableWidth;95 this.availableHeight = saved.bottomMost.availableHeight;96 if (height) {97 this.availableHeight -= (y - saved.bottomMost.y);98 }99 this.lastColumnWidth = saved.lastColumnWidth;100};101DocumentContext.prototype.addMargin = function (left, right) {102 this.x += left;103 this.availableWidth -= left + (right || 0);104};105DocumentContext.prototype.moveDown = function (offset) {106 this.y += offset;107 this.availableHeight -= offset;108 return this.availableHeight > 0;109};110DocumentContext.prototype.initializePage = function () {111 this.y = this.pageMargins.top;112 this.availableHeight = this.getCurrentPage().pageSize.height - this.pageMargins.top - this.pageMargins.bottom;113 this.pageSnapshot().availableWidth = this.getCurrentPage().pageSize.width - this.pageMargins.left - this.pageMargins.right;114};115DocumentContext.prototype.pageSnapshot = function () {116 if (this.snapshots[0]) {117 return this.snapshots[0];118 } else {119 return this;120 }121};122DocumentContext.prototype.moveTo = function (x, y) {123 if (x !== undefined && x !== null) {124 this.x = x;125 this.availableWidth = this.getCurrentPage().pageSize.width - this.x - this.pageMargins.right;126 }127 if (y !== undefined && y !== null) {128 this.y = y;129 this.availableHeight = this.getCurrentPage().pageSize.height - this.y - this.pageMargins.bottom;130 }131};132DocumentContext.prototype.beginDetachedBlock = function () {133 this.snapshots.push({134 x: this.x,135 y: this.y,136 availableHeight: this.availableHeight,137 availableWidth: this.availableWidth,138 page: this.page,139 endingCell: this.endingCell,140 lastColumnWidth: this.lastColumnWidth141 });142};143DocumentContext.prototype.endDetachedBlock = function () {144 var saved = this.snapshots.pop();145 this.x = saved.x;146 this.y = saved.y;147 this.availableWidth = saved.availableWidth;148 this.availableHeight = saved.availableHeight;149 this.page = saved.page;150 this.endingCell = saved.endingCell;151 this.lastColumnWidth = saved.lastColumnWidth;152};153function pageOrientation(pageOrientationString, currentPageOrientation) {154 if (pageOrientationString === undefined) {155 return currentPageOrientation;156 } else if (isString(pageOrientationString) && (pageOrientationString.toLowerCase() === 'landscape')) {157 return 'landscape';158 } else {159 return 'portrait';160 }161}162var getPageSize = function (currentPage, newPageOrientation) {163 newPageOrientation = pageOrientation(newPageOrientation, currentPage.pageSize.orientation);164 if (newPageOrientation !== currentPage.pageSize.orientation) {165 return {166 orientation: newPageOrientation,167 width: currentPage.pageSize.height,168 height: currentPage.pageSize.width169 };170 } else {171 return {172 orientation: currentPage.pageSize.orientation,173 width: currentPage.pageSize.width,174 height: currentPage.pageSize.height175 };176 }177};178DocumentContext.prototype.moveToNextPage = function (pageOrientation) {179 var nextPageIndex = this.page + 1;180 var prevPage = this.page;181 var prevY = this.y;182 var createNewPage = nextPageIndex >= this.pages.length;183 if (createNewPage) {184 var currentAvailableWidth = this.availableWidth;185 var currentPageOrientation = this.getCurrentPage().pageSize.orientation;186 var pageSize = getPageSize(this.getCurrentPage(), pageOrientation);187 this.addPage(pageSize);188 if (currentPageOrientation === pageSize.orientation) {189 this.availableWidth = currentAvailableWidth;190 }191 } else {192 this.page = nextPageIndex;193 this.initializePage();194 }195 return {196 newPageCreated: createNewPage,197 prevPage: prevPage,198 prevY: prevY,199 y: this.y200 };201};202DocumentContext.prototype.addPage = function (pageSize) {203 var page = {items: [], pageSize: pageSize};204 this.pages.push(page);205 this.page = this.pages.length - 1;206 this.initializePage();207 this.tracker.emit('pageAdded');208 return page;209};210DocumentContext.prototype.getCurrentPage = function () {211 if (this.page < 0 || this.page >= this.pages.length) {212 return null;213 }214 return this.pages[this.page];215};216DocumentContext.prototype.getCurrentPosition = function () {217 var pageSize = this.getCurrentPage().pageSize;218 var innerHeight = pageSize.height - this.pageMargins.top - this.pageMargins.bottom;219 var innerWidth = pageSize.width - this.pageMargins.left - this.pageMargins.right;220 return {221 pageNumber: this.page + 1,222 pageOrientation: pageSize.orientation,223 pageInnerHeight: innerHeight,224 pageInnerWidth: innerWidth,225 left: this.x,226 top: this.y,227 verticalRatio: ((this.y - this.pageMargins.top) / innerHeight),228 horizontalRatio: ((this.x - this.pageMargins.left) / innerWidth)229 };230};231function bottomMostContext(c1, c2) {232 var r;233 if (c1.page > c2.page) {234 r = c1;235 } else if (c2.page > c1.page) {236 r = c2;237 } else {238 r = (c1.y > c2.y) ? c1 : c2;239 }240 return {241 page: r.page,242 x: r.x,243 y: r.y,244 availableHeight: r.availableHeight,245 availableWidth: r.availableWidth246 };247}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var workbook = new Excel.Workbook();2var worksheet = workbook.addWorksheet('My Sheet');3 { header: 'Id', key: 'id', width: 10 },4 { header: 'Name', key: 'name', width: 32 },5 { header: 'D.O.B.', key: 'dob', width: 10 }6];7worksheet.addRow({ id: 1, name: 'John Doe', dob: new Date(1970, 1, 1) });8worksheet.addRow({ id: 2, name: 'Jane Doe', dob: new Date(1965, 1, 7) });9worksheet.addRow({ id: 3, name: 'Sam', dob: new Date(1983, 4, 12) });10var column = worksheet.getColumn(2);11column.eachCell(function(cell, rowNumber) {12 if (rowNumber == 1) {13 cell.font = {14 };15 }16 else {17 cell.border = {18 top: { style: 'thin' },19 left: { style: 'thin' },20 bottom: { style: 'thin' },21 right: { style: 'thin' }22 };23 }24});25worksheet.getCell('A1').border = {26 top: { style: 'thin' },27 left: { style: 'thin' },28 bottom: { style: 'thin' },29 right: { style: 'thin' }30};31worksheet.getCell('B1').border = {32 top: { style: 'thin' },33 left: { style: 'thin' },34 bottom: { style: 'thin' },35 right: { style: 'thin' }36};37worksheet.getCell('C1').border = {38 top: { style: 'thin' },39 left: { style: 'thin' },40 bottom: { style: 'thin' },41 right: { style: 'thin' }42};43worksheet.getCell('A1').font = {44};45worksheet.getCell('B1').font = {46};47worksheet.getCell('C1').font = {48};49var widths = new Excel.BestFitColumnWidths(worksheet);50widths.availableWidth = 100;51worksheet.columns = widths.columns;52workbook.xlsx.writeFile("test4.xlsx")53 .then(function

Full Screen

Using AI Code Generation

copy

Full Screen

1var win = Ti.UI.createWindow({2});3var view = Ti.UI.createView({4});5var label = Ti.UI.createLabel({6});7view.add(label);8win.add(view);9win.open();10var availableWidth = view.getLayout().availableWidth;11Ti.API.info('availableWidth: ' + availableWidth);12var availableHeight = view.getLayout().availableHeight;13Ti.API.info('availableHeight: ' + availableHeight);14var viewWidth = view.getLayout().width;15Ti.API.info('viewWidth: ' + viewWidth);16var viewHeight = view.getLayout().height;17Ti.API.info('viewHeight: ' + viewHeight);18var viewLeft = view.getLayout().left;19Ti.API.info('viewLeft: ' + viewLeft);20var viewTop = view.getLayout().top;21Ti.API.info('viewTop: ' + viewTop);22var viewRight = view.getLayout().right;23Ti.API.info('viewRight: ' + viewRight);24var viewBottom = view.getLayout().bottom;25Ti.API.info('viewBottom: ' + viewBottom);26var viewCenter = view.getLayout().center;27Ti.API.info('viewCenter: ' + viewCenter);28var viewCenterX = view.getLayout().centerX;29Ti.API.info('viewCenterX: ' + viewCenterX);30var viewCenterY = view.getLayout().centerY;31Ti.API.info('viewCenterY: ' + viewCenterY);32var viewSize = view.getLayout().size;33Ti.API.info('viewSize: ' + viewSize);34var viewBounds = view.getLayout().bounds;35Ti.API.info('viewBounds: ' + viewBounds);36var viewRect = view.getLayout().rect;37Ti.API.info('viewRect: ' + viewRect);38var viewZIndex = view.getLayout().zIndex;39Ti.API.info('viewZIndex: ' + viewZIndex);40var viewVisible = view.getLayout().visible;41Ti.API.info('viewVisible: ' + viewVisible);42var viewOpacity = view.getLayout().opacity;43Ti.API.info('viewOpacity: ' + viewOpacity);44var viewTransform = view.getLayout().transform;45Ti.API.info('viewTransform: ' +

Full Screen

Using AI Code Generation

copy

Full Screen

1var win = Ti.UI.createWindow({2});3var view1 = Ti.UI.createView({4});5var view2 = Ti.UI.createView({6});7var view3 = Ti.UI.createView({8});9var view4 = Ti.UI.createView({10});11var view5 = Ti.UI.createView({12});13var view6 = Ti.UI.createView({14});15var view7 = Ti.UI.createView({16});17var view8 = Ti.UI.createView({18});19var view9 = Ti.UI.createView({20});21var view10 = Ti.UI.createView({22});23var view11 = Ti.UI.createView({24});25var view12 = Ti.UI.createView({26});27var view13 = Ti.UI.createView({28});29var view14 = Ti.UI.createView({30});31var view15 = Ti.UI.createView({32});33var view16 = Ti.UI.createView({34});35var view17 = Ti.UI.createView({36});37var view18 = Ti.UI.createView({38});

Full Screen

Using AI Code Generation

copy

Full Screen

1importPackage(Packages.com.tibco.n2.de.api);2importPackage(Packages.com.tibco.n2.de.api.ui);3importPackage(Packages.com.tibco.n2.de.api.ui.grid);4importPackage(Packages.com.tibco.n2.de.api.ui.grid.column);5importPackage(Packages.com.tibco.n2.de.api.ui.grid.column.renderer);6importPackage(Packages.com.tibco.n2.de.api.ui.grid.column.renderer.cell);7importPackage(Packages.com.tibco.n2.de.api.ui.grid.column.renderer.header);8importPackage(Packages.com.tibco.n2.de.api.ui.grid.column.renderer.footer);9importPackage(Packages.com.tibco.n2.de.api.ui.grid.column.renderer.footer);10importPackage(Packages.com.tibco.n2.de.api.ui.grid.column.data);11importPackage(Packages.com.tibco.n2.de.api.ui.grid.column.data.cell);12importPackage(Packages.com.tibco.n2.de.api.ui.grid.column.data.header);13importPackage(Packages

Full Screen

Using AI Code Generation

copy

Full Screen

1importPackage(Packages.java.awt);2importPackage(Packages.java.lang);3importPackage(Packages.java.util);4importPackage(Packages.javax.swing);5importPackage(Packages.com.jgraph);6importPackage(Packages.com.jgraph.graph);7importPackage(Packages.com.jgraph.layout);8importPackage(Packages.com.jgraph.layout.tree);9importPackage(Packages.com.jgraph.layout.hierarchical);10importPackage(Packages.com.jgraph.layout.orthogonal);11importPackage(Packages.com.jgraph.layout.radial);12importPackage(Packages.com.jgraph.layout.graph);13importPackage(Packages.com.jgraph.layout.hierarchical.model);14importPackage(Packages.com.jgraph.layout.hierarchical.stage);15importPackage(Packages.com.jgraph.layout.hierarchical.JGraphFacade);16importPackage(Packages.com.jgraph.layout.hierarchical.JGraphLayoutCache);17importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyModel);18importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyNode);19importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyEdge);20importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyRank);21importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyCell);22importPackage(Packages.com.jgraph.layout.hierarchical.JGraphInterRankEdge);23importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyModel);24importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyNode);25importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyEdge);26importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyRank);27importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyCell);28importPackage(Packages.com.jgraph.layout.hierarchical.JGraphInterRankEdge);29importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyModel);30importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyNode);31importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyEdge);32importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyRank);33importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyCell);34importPackage(Packages.com.jgraph.layout.hierarchical.JGraphInterRankEdge);35importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyModel);36importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyNode);37importPackage(Packages.com.jgraph.layout.hierarchical.JGraphHierarchyEdge);38importPackage(Packages.com.jgraph

Full Screen

Using AI Code Generation

copy

Full Screen

1importPackage(Packages.java.awt);2importPackage(Packages.javax.swing);3importPackage(Packages.java.lang);4var frame = new JFrame("BestFitLayout");5var panel = new JPanel();6panel.setLayout(new BestFitLayout());7var button1 = new JButton("Button1");8panel.add(button1);9var button2 = new JButton("Button2");10panel.add(button2);11var button3 = new JButton("Button3");12panel.add(button3);13var button4 = new JButton("Button4");14panel.add(button4);15frame.getContentPane().add(panel);16frame.setSize(400, 300);17frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);18frame.show();19var availableWidth = panel.getLayout().availableWidth(panel);20System.out.println("Available width: " + availableWidth);21var size = panel.getPreferredSize();22System.out.println("Preferred size: " + size);23var insets = panel.getInsets();24System.out.println("Insets: " + insets);25var width = size.width + insets.left + insets.right;26System.out.println("Width: " + width);27insets = frame.getInsets();28System.out.println("Insets: " + insets);29width = width + insets.left + insets.right;30System.out.println("Width: " + width);31insets = frame.getInsets();32System.out.println("Insets: " + insets);33width = width + insets.left + insets.right;

Full Screen

Using AI Code Generation

copy

Full Screen

1var app = new qx.application.Standalone("BestFitLayout");2var label = new qx.ui.basic.Label("Hello World!");3var container = new qx.ui.container.Composite(new qx.ui.layout.BestFit());4container.add(label);5app.getRoot().add(container, {edge: 0});6app.getRoot().addListener("resize", function(e) {7 var w = container.getInnerSize().width;8 label.setWidth(w);9});

Full Screen

Using AI Code Generation

copy

Full Screen

1function resizeGrid() {2 var grid = document.getElementById('grid');3 grid.style.width = grid.availableWidth() + 'px';4 grid.updateLayout();5}6function resizeGrid() {7 var grid = document.getElementById('grid');8 grid.style.height = grid.availableHeight() + 'px';9 grid.updateLayout();10}11function resizeGrid() {12 var grid = document.getElementById('grid');13 grid.style.width = grid.availableWidth() + 'px';14 grid.style.height = grid.availableHeight() + 'px';15 grid.updateLayout();16}17function resizeGrid() {18 var grid = document.getElementById('grid');19 grid.style.width = grid.availableWidth() + 'px';

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Best automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful