Create a global variable with default value and select its row

        Triggered when the add button in the global variables tab is clicked.
540125
def on_add(self, widget, data=None):
        
        gv_name = "new_global_%s" % self.global_variable_counter
        self.global_variable_counter += 1
        try:
            self.model.global_variable_manager.set_variable(gv_name, None)
        except (RuntimeError, AttributeError, TypeError) as e:
            logger.warning("Addition of new global variable '{0}' failed: {1}".format(gv_name, e))
        self.select_entry(gv_name)
        return True
1308108
public static Object getVariableEL(PageContext pc, String var, Object defaultValue) {
	StringList list = parse(pc, new ParserString(var), false);
	if (list == null) return defaultValue;

	int scope = scopeString2Int(pc.ignoreScopes(), list.next());
	Object coll = null;
	if (scope == Scope.SCOPE_UNDEFINED) {
	    coll = pc.undefinedScope().get(KeyImpl.init(list.current()), NullSupportHelper.NULL());
	    if (coll == NullSupportHelper.NULL()) return defaultValue;
	}
	else {
	    try {
		coll = VariableInterpreter.scope(pc, scope, list.hasNext());
		// coll=pc.scope(scope);
	    }
	    catch (PageException e) {
		return defaultValue;
	    }
	}

	while (list.hasNext()) {
	    coll = pc.getVariableUtil().get(pc, coll, KeyImpl.init(list.next()), NullSupportHelper.NULL());
	    if (coll == NullSupportHelper.NULL()) return defaultValue;
	}
	return coll;
    }
40146
def global_var(self, name):
        """"""
        self.newline_label(name, False, True)
        self.newline_text("WORD\t1", True)
483767
def inject_global(node: Node, global_key: str, inject_key: Any):
    """"""
    value = get_current_scope().container.get(inject_key)
    set_global(node, global_key, value)
33030
function() {
			if (this.$buttonContainer && Array.isArray(this.buttons)) {
				var self = this;
				this.buttons.forEach(function(buttonDefinition) {
					var button = uiUtil.createButton(buttonDefinition.text, buttonDefinition.callback);
					if (buttonDefinition.id) {
						button.id = buttonDefinition.id;
						self['$'+ button.id] = button; //$NON-NLS-0$					
					}
					if (buttonDefinition.isDefault) {
						self._defaultCallback = buttonDefinition.callback;
						self._defaultButton = button;
						button.classList.add("primaryButton"); //$NON-NLS-0$
					}
					self.$buttonContainer.appendChild(button);
				});
			}
		}
592283
function(el, attrName, val) {
                    var oldValue;
                    // In order to later trigger an event we need to compare the new value to the old value, so here we go ahead and retrieve the old value for browsers that don't have native MutationObservers.
                    if (!attr.MutationObserver) {
                        oldValue = attr.get(el, attrName);
                    }

                    var tagName = el.nodeName.toString()
                        .toLowerCase(),
                        prop = attr.map[attrName],
                        newValue;

                    // Using the property of `attr.map`, go through and check if the property is a function, and if so call it. Then check if the property is `true`, and if so set the value to `true`, also making sure to set `defaultChecked` to `true` for elements of `attr.defaultValue`. We always set the value to true because for these boolean properties, setting them to false would be the same as removing the attribute.
                    // For all other attributes use `setAttribute` to set the new value.
                    if (typeof prop === "function") {
                        newValue = prop(el, val);
                    } else if (prop === true) {
                        newValue = el[attrName] = true;

                        if (attrName === "checked" && el.type === "radio") {
                            if (can.inArray(tagName, attr.defaultValue) >= 0) {
                                el.defaultChecked = true;
                            }
                        }

                    } else if (prop) {
                        newValue = el[prop] = val;
                        if (prop === "value" && can.inArray(tagName, attr.defaultValue) >= 0) {
                            el.defaultValue = val;
                        }
                    } else {
                        el.setAttribute(attrName, val);
                        newValue = val;
                    }

                    // Now that the value has been set, for browsers without MutationObservers, check to see that value has changed and if so trigger the "attributes" event on the element.
                    if (!attr.MutationObserver && newValue !== oldValue) {
                        attr.trigger(el, attrName, oldValue);
                    }
                }
264732
public void setGlobal(int pathId, Boolean global) {
        PreparedStatement statement = null;

        try (Connection sqlConnection = sqlService.getConnection()) {
            statement = sqlConnection.prepareStatement(
                "UPDATE " + Constants.DB_TABLE_PATH +
                    " SET " + Constants.PATH_PROFILE_GLOBAL + " = ? " +
                    " WHERE " + Constants.GENERIC_ID + " = ?"
            );
            statement.setBoolean(1, global);
            statement.setInt(2, pathId);
            statement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
767566
def set_default(self, name, value):
        
        if self.vars is None:
            self.vars = {}
        if name not in self.vars:
            self.vars[name] = value
1086450
def setval(self, varname, value):
        
        if varname in self:
            self[varname]['value'] = value
        else:
            self[varname] = Variable(self.default_type, value=value)
714554
function () {
            var newValue = !this.getProperty("value");
            this._cfg.value = newValue;
            this.setProperty("value", newValue);
            // setProperty on value might destroy the widget
            if (this._cfg) {
                this._setState();
                this._updateDomForState();
                var changeCallback = this._cfg.onchange;
                if (changeCallback) {
                    this.evalCallback(changeCallback);
                }
            }
        }
901228
def _on_click(self, event):
        """"""
        x = event.x
        self.coords('cursor', x, 0, x, self.winfo_height())
        self._variable.set(round2((360. * x) / self.winfo_width()))
56955
def set(self, name, value):
        """"""
        if not hasattr(self, 'funcs'):
            raise StartupError('startup cannot be called again')
        self.variable_values[name] = value
348384
function (settings) {
        var self = this;

        if (!settings.delimiter) {
          settings.delimiter = '\u00BB';
        }

        self._super(settings);
        self.classes.add('path');
        self.canFocus = true;

        self.on('click', function (e) {
          var index, target = e.target;

          if ((index = target.getAttribute('data-index'))) {
            self.fire('select', { value: self.row()[index], index: index });
          }
        });

        self.row(self.settings.row);
      }
1138461
function GlobalNav() {
        var _this = this;
        this.options.modulesOptions.globalNav = $.extend(true, defaults,
            this.options.modulesOptions.globalNav,
            JSON.parse(localStorage.getItem("source_enabledFilter")) || {}
        );
        this.initTemplates();
        $(function() {
            _this.init();
        });
    }
1146481
def declare_variable(self, id_, lineno, type_, default_value=None):
        
        assert isinstance(type_, symbols.TYPEREF)
        if not self.check_is_undeclared(id_, lineno, scope=self.current_scope, show_error=False):
            entry = self.get_entry(id_)
            if entry.scope == SCOPE.parameter:
                syntax_error(lineno,
                             "Variable '%s' already declared as a parameter "
                             "at %s:%i" % (id_, entry.filename, entry.lineno))
            else:
                syntax_error(lineno, "Variable '%s' already declared at "
                                     "%s:%i" % (id_, entry.filename, entry.lineno))
            return None

        if not self.check_class(id_, CLASS.var, lineno, scope=self.current_scope):
            return None

        entry = (self.get_entry(id_, scope=self.current_scope) or
                 self.declare(id_, lineno, symbols.VAR(id_, lineno, class_=CLASS.var)))
        __DEBUG__("Entry %s declared with class %s at scope %i" % (entry.name, CLASS.to_string(entry.class_),
                                                                   self.current_scope))

        if entry.type_ is None or entry.type_ == self.basic_types[TYPE.unknown]:
            entry.type_ = type_

        if entry.type_ != type_:
            if not type_.implicit and entry.type_ is not None:
                syntax_error(lineno,
                             "'%s' suffix is for type '%s' but it was "
                             "declared as '%s'" %
                             (id_, entry.type_, type_))
                return None
                # type_ = entry.type_  # TODO: Unused??

        entry.scope = SCOPE.global_ if self.current_scope == self.global_scope else SCOPE.local
        entry.callable = False
        entry.class_ = CLASS.var  # HINT: class_ attribute could be erased if access_id was used.
        entry.declared = True  # marks it as declared

        if entry.type_.implicit and entry.type_ != self.basic_types[TYPE.unknown]:
            warning_implicit_type(lineno, id_, entry.type_.name)

        if default_value is not None and entry.type_ != default_value.type_:
            if is_number(default_value):
                default_value = symbols.TYPECAST.make_node(entry.type_, default_value,
                                                           lineno)
                if default_value is None:
                    return None
            else:
                syntax_error(lineno,
                             "Variable '%s' declared as '%s' but initialized "
                             "with a '%s' value" %
                             (id_, entry.type_, default_value.type_))
                return None

        entry.default_value = default_value
        return entry
11866
protected function setDefaultValue() : void
    {
        if (empty($this->defaultOptions['default'])) {
            return;
        }

        // If we have a default value from configuration, pass it through
        // processing for magic/dynamic values like dates and usernames.
        $eventName = (string)EventName::FIELD_HANDLER_DEFAULT_VALUE();
        $event = new Event($eventName, $this, [
            'default' => $this->defaultOptions['default']
        ]);

        $view = $this->config->getView();
        $view->getEventManager()->dispatch($event);

        // Only overwrite the default if any events were triggered
        $listeners = $view->getEventManager()->listeners($eventName);
        if (empty($listeners)) {
            return;
        }
        $this->defaultOptions['default'] = $event->result;
    }
951633
function (e) {
        if (e && e.prevValue === e.newValue) {
            return;
        }

        var rpp     = this.paginator.get('rowsPerPage')+'',
            options = this.select.options,
            i,len;

        for (i = 0, len = options.length; i < len; ++i) {
            if (options[i].value === rpp) {
                options[i].selected = true;
                break;
            }
        }
    }