Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  utils.js   Sprache: JAVA

 
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


"use strict";

const Menu = require("resource://devtools/client/framework/menu.js");
const MenuItem = require("resource://devtools/client/framework/menu-item.js");

/**
 * Helper function for opening context menu.
 *
 * @param {Array} items
 *        List of menu items.
 * @param {Object} options:
 * @property {Element} button
 *           Button element used to open the menu.
 * @property {Number} screenX
 *           Screen x coordinate of the menu on the screen.
 * @property {Number} screenY
 *           Screen y coordinate of the menu on the screen.
 */

function showMenu(items, options) {
  if (items.length === 0) {
    return;
  }

  // Build the menu object from provided menu items.
  const menu = new Menu();
  items.forEach(item => {
    if (item == "-") {
      item = { type: "separator" };
    }

    const menuItem = new MenuItem(item);
    const subItems = item.submenu;

    if (subItems) {
      const subMenu = new Menu();
      subItems.forEach(subItem => {
        subMenu.append(new MenuItem(subItem));
      });
      menuItem.submenu = subMenu;
    }

    menu.append(menuItem);
  });

  // Calculate position on the screen according to
  // the parent button if available.
  if (options.button) {
    menu.popupAtTarget(options.button);
  } else {
    const screenX = options.screenX;
    const screenY = options.screenY;
    menu.popup(screenX, screenY, window.document);
  }
}

module.exports = {
  showMenu,
};

99%


¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge