<commit_before><link rel="import" href="/resources/polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
<link rel="import" href="/resources/polymer/iron-icons/iron-icons.html">

<link rel="import" href="/resources/polymer/polymer/polymer.html">
<link rel="import" href="/resources/polymer/paper-styles/paper-styles-classes.html">

<link rel="import" href="/app/tg-reflector.html">
<link rel="import" href="/resources/components/tg-scrollable-component.html">
<link rel="import" href="/resources/actions/tg-shortcut-processing-behavior.html">
<link rel="import" href="/resources/actions/tg-ui-action.html">
<link rel="import" href="/resources/images/tg-document-related-icons.html">

<dom-module id="tg-selection-view">
    <style>
        :host {
            background-color: white;
            @apply(--layout-vertical);
        }
        tg-scrollable-component {
            --tg-scrollable-layout: {
                flex: 1;
            };
        }
        .toolbar {
            padding: 0 12px;
            height: auto;
            position: relative;
            overflow: hidden;
            flex-grow: 0;
            flex-shrink: 0;
        }
        .toolbar-content::content > * {
            margin-top: 8px;
        }
    </style>
    <template>
        <tg-reflector id="reflector"></tg-reflector>
        <!--Selection view toolbar-->
        <div class="toolbar layout horizontal wrap">
            <div class="toolbar-content layout horizontal center">
                <content id="custom_action_selector" select=".custom-front-action"></content>
            </div>
            <div class="toolbar-content layout horizontal center" style="margin-left:auto">
              <tg-ui-action ui-role='ICON' short-desc='New configuration' long-desc='Create new configuration' icon='tg-document-related-icons:file-outline' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigNewAction' element-name='tg-CentreConfigNewAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigNewAction-master_0_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.0.attrs]]' pre-action='[[topLevelActions.0.preAction]]' post-action-success='[[topLevelActions.0.postActionSuccess]]' post-action-error='[[topLevelActions.0.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Load configuration' long-desc='Load configuration...' icon='icons:folder-open' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigLoadAction' element-name='tg-CentreConfigLoadAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigLoadAction-master_2_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.2.attrs]]' pre-action='[[topLevelActions.2.preAction]]' post-action-success='[[topLevelActions.2.postActionSuccess]]' post-action-error='[[topLevelActions.2.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Duplicate configuration' long-desc='Duplicate current configuration' icon='icons:content-copy' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigDuplicateAction' element-name='tg-CentreConfigDuplicateAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigDuplicateAction-master_1_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.1.attrs]]' pre-action='[[topLevelActions.1.preAction]]' post-action-success='[[topLevelActions.1.postActionSuccess]]' post-action-error='[[topLevelActions.1.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Edit' long-desc='Edit title and description...' icon='tg-document-related-icons:square-edit-outline' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigEditAction' element-name='tg-CentreConfigEditAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigEditAction-master_3_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.3.attrs]]' pre-action='[[topLevelActions.3.preAction]]' post-action-success='[[topLevelActions.3.postActionSuccess]]' post-action-error='[[topLevelActions.3.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Delete configuration' long-desc='Delete current configuration' icon='tg-document-related-icons:delete-outline' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigDeleteAction' element-name='tg-CentreConfigDeleteAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigDeleteAction-master_4_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.4.attrs]]' pre-action='[[topLevelActions.4.preAction]]' post-action-success='[[topLevelActions.4.postActionSuccess]]' post-action-error='[[topLevelActions.4.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Settings' long-desc='Customize selection criteria and resultset of the current configuration' icon='icons:settings' icon-style='' component-uri='/master_ui/fielden.work.ui_actions.OpenWorkActivityMasterAction' element-name='tg-OpenWorkActivityMasterAction-master' action-kind='TOP_LEVEL' element-alias='tg-OpenWorkActivityMasterAction-master_5_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.5.attrs]]' pre-action='[[topLevelActions.5.preAction]]' post-action-success='[[topLevelActions.5.postActionSuccess]]' post-action-error='[[topLevelActions.5.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled style='cursor:initial'></tg-ui-action>
            </div>
        </div>
        <tg-scrollable-component class="flex relative">
            <content select=".custom-selection-criteria"></content>
        </tg-scrollable-component>
        <content select=".selection-criteria-buttons"></content>
    </template>
    <script>
        Polymer({
            is: 'tg-selection-view',

            behaviors: [
                Polymer.IronA11yKeysBehavior,
                Polymer.TgBehaviors.TgShortcutProcessingBehavior
            ],

            properties: {
                _showDialog: Function,
                /**
                 * Creates standard action object for centre config action like EDIT, LOAD etc.
                 */
                _createActionObject: {
                    type: Function
                },
                /**
                 * Current saveAsName for centre configuration. This will flow upward to main centre elements.
                 */
                saveAsName: {
                    type: String,
                    notify: true
                },
                _createContextHolder: Function,
                uuid: String,
                _confirm: Function
            },

            ready: function() {
                const customShortcuts = [];
                Array.prototype.forEach.call(Polymer.dom(this.$.custom_action_selector).getDistributedNodes(), function (item) {
                    if (item.getAttribute("shortcut")) {
                        customShortcuts.push(item.getAttribute("shortcut"));
                    }
                }.bind(this));
                this._ownKeyBindings = {};
                this._ownKeyBindings[customShortcuts.join(" ") + (customShortcuts.length > 0 ? " " : "") + "ctrl+s ctrl+e ctrl+r f5"] = '_shortcutPressed';
            },

            attached: function () {
                const self = this;
                this.async(function () {
                    self.keyEventTarget = self._getKeyEventTarget();
                }, 1);

                self.topLevelActions = [
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigNewAction'),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigDuplicateAction'),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigLoadAction'),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigEditAction'),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigDeleteAction', () => self._confirm('Should this configuration be deleted?', [{name:'YES', confirm:true, autofocus:true}, {name:'NO'}])),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigSettingsAction')
                ];
            },<commit_msg>#1068 Reversed the order of YES/NO buttons to be NO/YES as per the masters/dialogs convension.<commit_after><link rel="import" href="/resources/polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
<link rel="import" href="/resources/polymer/iron-icons/iron-icons.html">

<link rel="import" href="/resources/polymer/polymer/polymer.html">
<link rel="import" href="/resources/polymer/paper-styles/paper-styles-classes.html">

<link rel="import" href="/app/tg-reflector.html">
<link rel="import" href="/resources/components/tg-scrollable-component.html">
<link rel="import" href="/resources/actions/tg-shortcut-processing-behavior.html">
<link rel="import" href="/resources/actions/tg-ui-action.html">
<link rel="import" href="/resources/images/tg-document-related-icons.html">

<dom-module id="tg-selection-view">
    <style>
        :host {
            background-color: white;
            @apply(--layout-vertical);
        }
        tg-scrollable-component {
            --tg-scrollable-layout: {
                flex: 1;
            };
        }
        .toolbar {
            padding: 0 12px;
            height: auto;
            position: relative;
            overflow: hidden;
            flex-grow: 0;
            flex-shrink: 0;
        }
        .toolbar-content::content > * {
            margin-top: 8px;
        }
    </style>
    <template>
        <tg-reflector id="reflector"></tg-reflector>
        <!--Selection view toolbar-->
        <div class="toolbar layout horizontal wrap">
            <div class="toolbar-content layout horizontal center">
                <content id="custom_action_selector" select=".custom-front-action"></content>
            </div>
            <div class="toolbar-content layout horizontal center" style="margin-left:auto">
              <tg-ui-action ui-role='ICON' short-desc='New configuration' long-desc='Create new configuration' icon='tg-document-related-icons:file-outline' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigNewAction' element-name='tg-CentreConfigNewAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigNewAction-master_0_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.0.attrs]]' pre-action='[[topLevelActions.0.preAction]]' post-action-success='[[topLevelActions.0.postActionSuccess]]' post-action-error='[[topLevelActions.0.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Load configuration' long-desc='Load configuration...' icon='icons:folder-open' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigLoadAction' element-name='tg-CentreConfigLoadAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigLoadAction-master_2_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.2.attrs]]' pre-action='[[topLevelActions.2.preAction]]' post-action-success='[[topLevelActions.2.postActionSuccess]]' post-action-error='[[topLevelActions.2.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Duplicate configuration' long-desc='Duplicate current configuration' icon='icons:content-copy' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigDuplicateAction' element-name='tg-CentreConfigDuplicateAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigDuplicateAction-master_1_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.1.attrs]]' pre-action='[[topLevelActions.1.preAction]]' post-action-success='[[topLevelActions.1.postActionSuccess]]' post-action-error='[[topLevelActions.1.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Edit' long-desc='Edit title and description...' icon='tg-document-related-icons:square-edit-outline' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigEditAction' element-name='tg-CentreConfigEditAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigEditAction-master_3_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.3.attrs]]' pre-action='[[topLevelActions.3.preAction]]' post-action-success='[[topLevelActions.3.postActionSuccess]]' post-action-error='[[topLevelActions.3.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Delete configuration' long-desc='Delete current configuration' icon='tg-document-related-icons:delete-outline' icon-style='' component-uri='/master_ui/ua.com.fielden.platform.web.centre.CentreConfigDeleteAction' element-name='tg-CentreConfigDeleteAction-master' action-kind='TOP_LEVEL' element-alias='tg-CentreConfigDeleteAction-master_4_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.4.attrs]]' pre-action='[[topLevelActions.4.preAction]]' post-action-success='[[topLevelActions.4.postActionSuccess]]' post-action-error='[[topLevelActions.4.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled='[[_computeConfigButtonDisabled(saveAsName)]]' style='[[_computeConfigButtonStyle(saveAsName)]]'></tg-ui-action>
              <tg-ui-action ui-role='ICON' short-desc='Settings' long-desc='Customize selection criteria and resultset of the current configuration' icon='icons:settings' icon-style='' component-uri='/master_ui/fielden.work.ui_actions.OpenWorkActivityMasterAction' element-name='tg-OpenWorkActivityMasterAction-master' action-kind='TOP_LEVEL' element-alias='tg-OpenWorkActivityMasterAction-master_5_TOP_LEVEL' show-dialog='[[_showDialog]]' create-context-holder='[[_createContextHolder]]' attrs='[[topLevelActions.5.attrs]]' pre-action='[[topLevelActions.5.preAction]]' post-action-success='[[topLevelActions.5.postActionSuccess]]' post-action-error='[[topLevelActions.5.postActionError]]' require-selection-criteria='true' require-selected-entities='NONE' require-master-entity='false' disabled style='cursor:initial'></tg-ui-action>
            </div>
        </div>
        <tg-scrollable-component class="flex relative">
            <content select=".custom-selection-criteria"></content>
        </tg-scrollable-component>
        <content select=".selection-criteria-buttons"></content>
    </template>
    <script>
        Polymer({
            is: 'tg-selection-view',

            behaviors: [
                Polymer.IronA11yKeysBehavior,
                Polymer.TgBehaviors.TgShortcutProcessingBehavior
            ],

            properties: {
                _showDialog: Function,
                /**
                 * Creates standard action object for centre config action like EDIT, LOAD etc.
                 */
                _createActionObject: {
                    type: Function
                },
                /**
                 * Current saveAsName for centre configuration. This will flow upward to main centre elements.
                 */
                saveAsName: {
                    type: String,
                    notify: true
                },
                _createContextHolder: Function,
                uuid: String,
                _confirm: Function
            },

            ready: function() {
                const customShortcuts = [];
                Array.prototype.forEach.call(Polymer.dom(this.$.custom_action_selector).getDistributedNodes(), function (item) {
                    if (item.getAttribute("shortcut")) {
                        customShortcuts.push(item.getAttribute("shortcut"));
                    }
                }.bind(this));
                this._ownKeyBindings = {};
                this._ownKeyBindings[customShortcuts.join(" ") + (customShortcuts.length > 0 ? " " : "") + "ctrl+s ctrl+e ctrl+r f5"] = '_shortcutPressed';
            },

            attached: function () {
                const self = this;
                this.async(function () {
                    self.keyEventTarget = self._getKeyEventTarget();
                }, 1);

                self.topLevelActions = [
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigNewAction'),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigDuplicateAction'),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigLoadAction'),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigEditAction'),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigDeleteAction', () => self._confirm('Should this configuration be deleted?', [{name:'NO'}, {name:'YES', confirm:true, autofocus:true}])),
                    self._createActionObject('ua.com.fielden.platform.web.centre.CentreConfigSettingsAction')
                ];
            },
{'fraction_non_alphanumeric': 0.1491196915114922, 'fraction_numerical': 0.004870871175605054, 'mean_word_length': 3.5976207137858642, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '683831', 'n_tokens_mistral': 5609, 'n_tokens_neox': 5463, 'n_words': 684}