Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/devtools/client/responsive/components/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  DeviceList.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 {
  createFactory,
  PureComponent,
} = require("resource://devtools/client/shared/vendor/react.mjs");
const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");

const Types = require("resource://devtools/client/responsive/types.js");

const Device = createFactory(
  require("resource://devtools/client/responsive/components/Device.js")
);

class DeviceList extends PureComponent {
  static get propTypes() {
    return {
      // Whether or not to show the custom device edit/remove buttons.
      devices: PropTypes.shape(Types.devices).isRequired,
      isDeviceFormShown: PropTypes.bool.isRequired,
      onDeviceCheckboxChange: PropTypes.func.isRequired,
      onDeviceFormHide: PropTypes.func.isRequired,
      onDeviceFormShow: PropTypes.func.isRequired,
      onRemoveCustomDevice: PropTypes.func.isRequired,
      type: PropTypes.string.isRequired,
    };
  }

  renderCustomDevice(device) {
    const {
      isDeviceFormShown,
      type,
      onDeviceCheckboxChange,
      onRemoveCustomDevice,
    } = this.props;

    // Show a remove button for custom devices.
    const removeDeviceButton = dom.button({
      id: "device-edit-remove",
      className: "device-remove-button devtools-button",
      onClick: () => {
        onRemoveCustomDevice(device);
        this.props.onDeviceFormHide();
      },
    });

    // Show an edit button for custom devices
    const editButton = dom.button({
      id: "device-edit-button",
      className: "devtools-button",
      onClick: () => {
        this.props.onDeviceFormShow("edit", device);
      },
    });

    return Device(
      {
        device,
        key: device.name,
        type,
        onDeviceCheckboxChange,
      },
      // Don't show the remove/edit buttons for a custom device if the form is open.
      !isDeviceFormShown ? editButton : null,
      !isDeviceFormShown ? removeDeviceButton : null
    );
  }

  render() {
    const { devices, type, onDeviceCheckboxChange } = this.props;

    return dom.div(
      { className: "device-list" },
      devices[type].map(device => {
        if (type === "custom") {
          return this.renderCustomDevice(device);
        }

        return Device({
          device,
          key: device.name,
          type,
          onDeviceCheckboxChange,
        });
      })
    );
  }
}

module.exports = DeviceList;

Messung V0.5 in Prozent
C=93 H=97 G=94

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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 und die Messung sind noch experimentell.