Class PickerBuilder
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تُستخدَم PickerBuilder
لإنشاء عناصر Picker
. باستثناء ما هو موضّح،
يكون نوع الإرجاع للطرق أدناه من النوع PickerBuilder
، ما يسمح
لك بتسلسل طلب واحد بعد الآخر.
أمثلة
يمكنك إنشاء Picker
أساسي باستخدام النمط المنشئ.
const picker = new google.pickerPickerBuilder()
.setOAuthToken('TOKEN_FOR_USER')
.setAppId('1234567890') // Cloud Project number
.addView(google.picker.ViewId.DOCS)
.setCallback((data) => {
console.log(data);
})
.build();
التوقيع
export class PickerBuilder
التفاصيل
الطُرق
الاسم |
الوصف |
addView(viewOrViewId) |
أضِف طريقة عرض إلى مساحة الروابط. |
addViewGroup(viewGroup) |
أضِف ViewGroup إلى لوحة التنقّل ذات المستوى الأعلى. |
build() |
أنشئ عنصر Picker. |
disableFeature(feature) |
أوقِف ميزة أداة اختيار. |
enableFeature(feature) |
فعِّل ميزة اختيار. |
getRelayUrl() |
الحصول على عنوان URL لإعادة التوجيه المستخدَم في gadgets.rpc |
getTitle() |
الحصول على عنوان مربّع الحوار |
hideTitleBar() |
إيقاف عرض شريط العناوين لإعادة تفعيل هذه الميزة، اتصل بـ setTitle مع إدخال عنوان غير فارغ أو undefined . |
isFeatureEnabled(feature) |
تحقَّق من تفعيل أداة الاختيار Feature . |
setAppId(appId) |
لضبط معرّف التطبيق الذي يحتاج إلى الوصول إلى ملفات المستخدم من خلال Drive API . |
setCallback(method) |
اضبط طريقة ردّ الاتصال. يتمّ استدعاء هذه الطريقة عندما يختار المستخدم عناصر أو يلغي الاختيار. تتلقّى طريقة ردّ الاتصال عنصرًا واحدًا لردّ الاتصال. يمكنك الاطّلاع على بنية عنصر الاستدعاء في دليل JSON. |
setDeveloperKey(key) |
تُستخدَم لضبط مفتاح Browser API الذي تم الحصول عليه من Google Developers Console. راجِع دليل المطوّر للحصول على تفاصيل حول كيفية الحصول على مفتاح واجهة برمجة تطبيقات المتصفّح. |
setDocument(document) |
اضبط المستند. |
setLocale(locale) |
اضبط لغة أداة الاختيار. اللغة هي رمز لغة وفقًا لمعيار ISO 639. إذا لم تكن اللغة متاحة، يتم استخدام en-US. |
setMaxItems(max) |
لضبط الحد الأقصى لعدد العناصر التي يمكن للمستخدم اختيارها |
setOAuthToken(token) |
تُستخدَم لضبط رمز مميّز لبروتوكول OAuth من أجل مصادقة المستخدم الحالي. |
setOrigin(origin) |
لضبط مصدر مربّع حوار المنتقي. يجب ضبط المصدر على window.location.protocol + '//' + window.location.host للصفحة العلوية، إذا كان تطبيقك يعمل في إطار iframe. |
setRelayUrl(url) |
ضبط عنوان URL الخاص بالإرسال، والذي يتم استخدامه لـ tool.rpc. |
setSelectableMimeTypes(type) |
يمكنك ضبط قائمة أنواع MIME التي ستكون قابلة للاختيار. استخدِم الفواصل للفصل بين أنواع MIME إذا كان هناك أكثر من نوع مطلوب. إذا لم يتم تحديد أنواع MIME، فسيتم عرض ملفات من جميع أنواع MIME في طريقة العرض. |
setSize(width, height) |
اضبط حجم مربّع الحوار المفضّل. سيتم وضع مربّع الحوار في المنتصف تلقائيًا. الحد الأدنى لحجمها هو (566,350) والحد الأقصى هو (1051,650). |
setTitle(title) |
اضبط عنوان مربّع الحوار. |
toUri() |
تعرِض هذه السمة معرّف الموارد المنتظم الذي أنشأه هذا المنشئ. |
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Class PickerBuilder\n\n`PickerBuilder` is used to create `Picker` objects. Except where noted\notherwise, the return type of methods below is of type `PickerBuilder`, allowing\nyou to chain one call after another.\n\nExamples\n--------\n\nBuild a basic `Picker` using the builder pattern. \n\n const picker = new google.pickerPickerBuilder()\n .setOAuthToken('TOKEN_FOR_USER')\n .setAppId('1234567890') // Cloud Project number\n .addView(google.picker.ViewId.DOCS)\n .setCallback((data) =\u003e {\n console.log(data);\n })\n .build();\n\nSignature\n---------\n\n export class PickerBuilder\n\nDetails\n-------\n\n| Final | No |\n|-------|----|\n\nMethods\n-------\n\n| Name | Description |\n|---------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`addView(viewOrViewId)`](./picker.pickerbuilder.addview) | Add a view to the navigation pane. |\n| [`addViewGroup(viewGroup)`](./picker.pickerbuilder.addviewgroup) | Add a ViewGroup to the top-level navigation pane. |\n| [`build()`](./picker.pickerbuilder.build) | Construct the Picker object. |\n| [`disableFeature(feature)`](./picker.pickerbuilder.disablefeature) | Disable a picker feature. |\n| [`enableFeature(feature)`](./picker.pickerbuilder.enablefeature) | Enable a picker feature. |\n| [`getRelayUrl()`](./picker.pickerbuilder.getrelayurl) | Get the relay URL, used for gadgets.rpc. |\n| [`getTitle()`](./picker.pickerbuilder.gettitle) | Get the dialog title. |\n| [`hideTitleBar()`](./picker.pickerbuilder.hidetitlebar) | Disable the title bar from being shown. To re-enable, call `setTitle` with a non-empty title or `undefined`. |\n| [`isFeatureEnabled(feature)`](./picker.pickerbuilder.isfeatureenabled) | Check if a picker `Feature` is enabled. |\n| [`setAppId(appId)`](./picker.pickerbuilder.setappid) | Sets the Id of the application needing to access the user's files via the [`Drive API`](/workspace/drive/api). |\n| [`setCallback(method)`](./picker.pickerbuilder.setcallback) | Set the callback method. This method is called when the user selects items or cancels. The callback method receives a single callback object. The structure of the callback object is described in the [JSON Guide](/workspace/drive/picker/reference/results). |\n| [`setDeveloperKey(key)`](./picker.pickerbuilder.setdeveloperkey) | Sets the Browser API key obtained from Google Developers Console. See the Developer's Guide for details on how to obtain the Browser API key. |\n| [`setDocument(document)`](./picker.pickerbuilder.setdocument) | Set the document. |\n| [`setLocale(locale)`](./picker.pickerbuilder.setlocale) | Set the locale for the picker. The locale is an ISO 639 language code. If the language is not supported, en-US is used. |\n| [`setMaxItems(max)`](./picker.pickerbuilder.setmaxitems) | Sets the maximum number of items a user can pick. |\n| [`setOAuthToken(token)`](./picker.pickerbuilder.setoauthtoken) | Sets an OAuth token to use for authenticating the current user. |\n| [`setOrigin(origin)`](./picker.pickerbuilder.setorigin) | Sets the origin of picker dialog. The origin should be set to the window.location.protocol + '//' + window.location.host of the top-most page, if your application is running in an iframe. |\n| [`setRelayUrl(url)`](./picker.pickerbuilder.setrelayurl) | Set the relay URL, used for gadgets.rpc. |\n| [`setSelectableMimeTypes(type)`](./picker.pickerbuilder.setselectablemimetypes) | Set the list of MIME types which will be selectable. Use commas to separate MIME types if more than one is required. If you don't set MIME types, files of all MIME types are displayed in the view. |\n| [`setSize(width, height)`](./picker.pickerbuilder.setsize) | Set the preferred dialog size. The dialog will be auto-centered. It has a minimum size of (566,350) and a maximum size of (1051,650). |\n| [`setTitle(title)`](./picker.pickerbuilder.settitle) | Set the dialog title. |\n| [`toUri()`](./picker.pickerbuilder.touri) | Returns the URI generated by this builder. |"]]