1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401:
<?php
namespace Nethgui\Renderer;
/*
* Copyright (C) 2011 Nethesis S.r.l.
*
* This script is part of NethServer.
*
* NethServer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NethServer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NethServer. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Create Widget objects applying default widget flags
*
* The interface methods create and configure widget objects.
*
* @author Davide Principi <davide.principi@nethesis.it>
* @see WidgetInterface
* @since 1.0
* @api
*/
interface WidgetFactoryInterface
{
const LABEL_NONE = 0x1;
const LABEL_LEFT = 0x2;
const LABEL_RIGHT = 0x4;
const LABEL_ABOVE = 0x8;
const STATE_CHECKED = 0x10;
const STATE_DISABLED = 0x20;
const STATE_VALIDATION_ERROR = 0x40;
const STATE_READONLY = 0x80;
/**
* @deprecated since 1.6
*/
const STATE_UNOBSTRUSIVE = 0x2000000;
const STATE_UNOBTRUSIVE = 0x2000000;
const INSET_WRAP = 0x8000;
const INSET_FORM = 0x10000;
const INSET_DIALOG = 0x4000;
const BUTTON_SUBMIT = 0x100;
const BUTTON_CANCEL = 0x200;
const BUTTON_RESET = 0x400;
const BUTTON_LINK = 0x800;
const BUTTON_CUSTOM = 0x1000;
const SELECTOR_MULTIPLE = 0x40000;
const SELECTOR_DROPDOWN = 0x80000;
const TEXTINPUT_PASSWORD = 0x100000;
const FIELDSET_EXPANDABLE = 0x200000;
const BUTTONSET = 0x400000;
const BUTTON_DROPDOWN = 0x800000;
const BUTTON_HELP = 0x1000000;
const FIELDSETSWITCH_CHECKBOX = 0x4000000; // Refs #1093
const FIELDSETSWITCH_EXPANDABLE = self::FIELDSET_EXPANDABLE;
const SLIDER_ENUMERATIVE = 0x8000000; // Refs #1242;
const FORM_ENC_MULTIPART = 0x10000000;
/**
* The default flags inherited by widget generated by this factory.
*
* @api
* @return integer
*/
public function getDefaultFlags();
/**
* The default flags inherited by widget generated by this factory.
*
* @api
* @param integer $flags
* @return \Nethgui\Renderer\WidgetFactoryInterface
*/
public function setDefaultFlags($flags);
/**
* Include a view element that is a sub-view
*
* @param string $name The view member name
* @param integer $flags Optional {STATE_DISABLED}
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function inset($name, $flags = 0);
/**
* Create a text input control
*
* @api
* @param string $name The view member name
* @param integer $flags Optional {STATE_DISABLED}
* @return \Nethgui\Renderer\WidgetInterface
*/
public function textInput($name, $flags = 0);
/**
* Create a text label.
*
* @param string $name The view member name to generate the label contents
* @param integer $flags Optional {STATE_DISABLED}
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function textLabel($name, $flags = 0);
/**
* Create a fieldset container
*
* @see textLabel()
* @param string $name OPTIONAL - The view member passed as argument for the "template" attribute.
* @param integer $flags OPTIONAL - flags
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function fieldset($name = NULL, $flags = 0);
/**
* Create a text header control
*
* @see textLabel()
* @param string $name OPTIONAL - The view member passed as argument for the "template" attribute.
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function header($name = NULL, $flags = 0);
/**
* Create an hidden control
*
* @param string $name The view member name
* @param integer $flags Optional {STATE_DISABLED}
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function hidden($name, $flags = 0);
/**
* Create a selector control
*
* @param string $name The view member name holding the selected value(s)
* @param integer $flags
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function selector($name, $flags = 0);
/**
* Create a button control
*
* @param string $name The view member name
* @param integer $flags Optional
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function button($name, $flags = 0);
/**
* Create a radio button control
*
* @param string $name The view member name
* @param string $value The value assigned to the control, when selected.
* @param integer $flags Optional {STATE_DISABLED, STATE_CHECKED}
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function radioButton($name, $value, $flags = 0);
/**
* Create a checkbox control
*
* Optionally specify the "uncheckedValue" to get a value from the form
* when the checkbox is unchecked.
*
* @param string $name The view member name
* @param string $value The value assigned to the control, when checked.
* @param integer $flags Optional {STATE_DISABLED, STATE_CHECKED}
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function checkBox($name, $value, $flags = 0);
/**
* Create a selectable fieldset container
*
* Set FIELDSETSWITCH_CHECKBOX flag to get a checkbox switch, otherwise
* a radioButton is rendered
*
* Set FIELDSETSWITCH_EXPANDABLE flag to fold out the fieldset, when
* selected
*
* @see checkbox(), radioButton()
* @param string $name
* @param string $value
* @param integer $flags
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function fieldsetSwitch($name, $value, $flags = 0);
/**
* Create a tabs container.
*
* @param integer $flags {STATE_DISABLED}
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function tabs($flags = 0);
/**
* Create a simple form container.
*
* @param integer $flags Optional - {STATE_DISABLED}
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function form($flags = 0);
/**
* Create a panel container
*
* @param integer $flags
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function panel($flags = 0);
/**
* Create a list of elements
*
* Add the actual elements invoking the insert() operation of the returned object.
*
* @param integer $flags
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function elementList($flags = 0);
/**
* Create a list of button elements
*
* Add the actual elements invoking the insert() operation of the returned object.
*
* @param integer $flags
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function buttonList($flags = 0);
/**
* Create literal data - helper.
*
* @param string|object|\Nethgui\View\ViewInterface $data Can be a string, any object implementing toString() method, or a View.
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function literal($data, $flags = 0);
/**
* Create a column container - helper.
*
* Add the actual columns through the insert() operation of the returned object
*
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function columns();
/**
* Create a progress bar
*
* - name View member holding the percent value Int range [0, 100]
*
* @see #554
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function progressbar($name, $flags = 0);
/**
* Create a text area
*
* Attributes:
* - dimensions
* - appendOnly
*
* @see #556
* @param string $name
* @param int $flags
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function textArea($name, $flags = 0);
/**
* A javascript-configurable object collection editor, with a TEXTAREA
* backend.
*
* @api
* @see #1446
* @param string $name
* @param int $flags
* @return \Nethgui\Renderer\WidgetInterface
*/
public function collectionEditor($name, $flags = 0);
/**
* Create a console-like text area
*
* @see textArea()
*
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function console($name, $flags = 0);
/**
* Create a date picker widget:
*
*
* Attributes:
* - class (string) "Date " plus one of "be" (default), "me", "le".
*
* @see 474
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function dateInput($name, $flags);
/**
* Create a time picker widget:
*
* Attributes:
* - class (string) "Time " plus one of "hm" or "hms"
*
* @return \Nethgui\Renderer\WidgetInterface
* @since 1.7
* @api
*/
public function timeInput($name, $flags);
/**
* Pick/selects objects from a collection
*
* @see WidgetFactoryInterface::selector()
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function objectPicker($name = NULL, $flags = 0);
/**
* Select a value in the given range.
*
* Set attributes
* - min
* - max
* - step
*
* @see Feature #1242
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function slider($name, $flags);
/**
* Create a text list widget
*
* @param string $name A view element containing an array value
* @param int $flags
* @return \Nethgui\Renderer\WidgetInterface
* @api
*/
public function textList($name, $flags = 0);
/**
* Create widget that renders the given collection applying a specific template
*
* @param string $name A view element containing the collection data source
* @param int $flags
*/
public function objectsCollection($name, $flags = 0);
/**
* Create a file upload widget
* @param string $name
* @param int $flags
*/
public function fileUpload($name, $flags = 0);
}
define('NETHGUI_INHERITABLE_FLAGS', WidgetFactoryInterface::STATE_DISABLED | WidgetFactoryInterface::LABEL_ABOVE | WidgetFactoryInterface::LABEL_LEFT | WidgetFactoryInterface::LABEL_RIGHT | WidgetFactoryInterface::LABEL_NONE | WidgetFactoryInterface::STATE_UNOBTRUSIVE);