001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.unifiedGui.interfaces;
032:
033: import java.util.*;
034:
035: import de.ug2t.kernel.*;
036:
037: /**
038: * @author Dirk
039: *
040: * date: 15.03.2004 project: WiSer-Framework
041: *
042: * <p>
043: * IUnTable is the common interface to a table-widget. A table-widget consists
044: * of a table header and one or more table rows. Each row as well as the header
045: * has multiple cells. A cell may contain a string or other widgets. The table
046: * model is a table-object (KeTable)
047: * </p>
048: */
049: public interface IUnTable extends IUnComponent, IUnListSelectComponent,
050: IUnMultiSelectComponent, IUnScrollController {
051: /**
052: * @author Dirk
053: *
054: * date: 29.05.2007 project: WiSer-Framework
055: *
056: * <p>
057: * Factory is a convenience class to create components of the surrounding
058: * interface's type without taking care for the WidgetServer MultiChannel API.
059: * It's use is similar to a constructor.
060: * </p>
061: */
062: public static class Factory {
063: /**
064: * Creates a standard version of this component as described in the factory.
065: * If you create masses of components for e.g. within a renderer use
066: * <i> create(IUnApplication xAppl)</i> for performance
067: * reasons.
068: *
069: * @param xSelectable
070: * true indicates that the table is selecatble, otherwise false
071: * @return new component
072: */
073: public static IUnTable create(boolean xSelectable) {
074: IUnApplication l_appl = (IUnApplication) KeRegisteredObject
075: .pcmf_getObjByName(IUnApplication.MY_APPL);
076: return (l_appl.pcmf_getComponentFactory().pcmf_createTable(
077: l_appl.pcmf_getApplType(), "", null, xSelectable,
078: l_appl));
079: }
080:
081: /**
082: * Creates a special version of this component as described in the factory
083: * configuration under the descriptor xFactoryDesc. If you create masses of
084: * components for e.g. within a renderer use <i>
085: * create(IUnApplication xAppl, String xFactoryDesc)</i> for performance
086: * reasons.
087: *
088: * @param xSelectable
089: * true indicates that the table is selecatble, otherwise false
090: * @param xFactoryDesc
091: * descriptor
092: * @return new component
093: */
094: public static IUnTable create(boolean xSelectable,
095: String xFactoryDesc) {
096: IUnApplication l_appl = (IUnApplication) KeRegisteredObject
097: .pcmf_getObjByName(IUnApplication.MY_APPL);
098: return (l_appl.pcmf_getComponentFactory()
099: .pcmf_createTablePlugin(l_appl.pcmf_getApplType(),
100: "", null, xSelectable, l_appl, xFactoryDesc));
101: }
102:
103: /**
104: * Creates a standard version of this component as described in the factory
105: * within the given application-context. If you create masses of components
106: * for e.g. within a renderer use this method for performance reasons.
107: *
108: * @param xSelectable
109: * true indicates that the table is selecatble, otherwise false
110: * @param xAppl
111: * application in which context the component is created
112: * @return new component
113: */
114: public static IUnTable create(boolean xSelectable,
115: IUnApplication xAppl) {
116: return (xAppl.pcmf_getComponentFactory().pcmf_createTable(
117: xAppl.pcmf_getApplType(), "", null, xSelectable,
118: xAppl));
119: }
120:
121: /**
122: * Creates a special version of this component as described in the factory
123: * configuration under the descriptor xFactoryDesc. If you create masses of
124: * components for e.g. within a renderer use this function for performance
125: * reasons.
126: *
127: * @param xSelectable
128: * true indicates that the table is selecatble, otherwise false
129: * @param xFactoryDesc
130: * descriptor
131: * @param xAppl
132: * application in which context the component is created
133: * @return new component
134: */
135: public static IUnTable create(boolean xSelectable,
136: IUnApplication xAppl, String xFactoryDesc) {
137: return (xAppl.pcmf_getComponentFactory()
138: .pcmf_createTablePlugin(xAppl.pcmf_getApplType(),
139: "", null, xSelectable, xAppl, xFactoryDesc));
140: }
141: }
142:
143: /**
144: * <p>
145: * Gets the spacing in pixel.
146: * </p>
147: * <p>
148: *
149: * @return spacing
150: * </p>
151: * <p>
152: * </p>
153: */
154: public int pcmf_getSpacing();
155:
156: /**
157: * <p>
158: * Gets the padding in pixel.
159: * </p>
160: * <p>
161: *
162: * @return padding
163: * </p>
164: * <p>
165: * </p>
166: */
167: public int pcmf_getPadding();
168:
169: /**
170: * <p>
171: * Gets the border width in pixel.
172: * </p>
173: * <p>
174: *
175: * @return border width
176: * </p>
177: * <p>
178: * </p>
179: */
180: public int pcmf_getTableBorder();
181:
182: /**
183: * <p>
184: * Sets the spacing in pixel between the table-cells.
185: * </p>
186: * <p>
187: *
188: * </p>
189: * <p>
190: *
191: * @param xSpace
192: * space in cells
193: * </p>
194: */
195: public void pcmf_setSpacing(int xSpace);
196:
197: /**
198: * <p>
199: * Sets the distance between the cell's content and the cell's border in pixel
200: * </p>
201: * <p>
202: *
203: * </p>
204: * <p>
205: *
206: * @param xPad
207: * distance in pixel
208: * </p>
209: */
210: public void pcmf_setPadding(int xPad);
211:
212: /**
213: * <p>
214: * Sets the width of the cell's border in pixel
215: * </p>
216: * <p>
217: *
218: * </p>
219: * <p>
220: *
221: * @param xBorder
222: * width in pixel
223: * </p>
224: */
225: public void pcmf_setTableBorder(int xBorder);
226:
227: /**
228: * <p>
229: * Gets an iterator which returns all rows of the table. Each row consists of
230: * one collection of cells
231: * </p>
232: * <p>
233: *
234: * @return row-iterator
235: * </p>
236: * <p>
237: * </p>
238: */
239: public Iterator pcmf_getRows();
240:
241: /**
242: * <p>
243: * Sets new table-data (header as well as rows) and commits it.
244: * </p>
245: * <p>
246: *
247: * </p>
248: * <p>
249: *
250: * @param xRows
251: * a collection of one collection containing a new table header and
252: * multiple collections containing the row-values
253: * </p>
254: */
255: public void pcmf_refresh(Collection xRows);
256:
257: /**
258: * <p>
259: * Sets new table-data (rows only).
260: * </p>
261: * <p>
262: *
263: * </p>
264: * <p>
265: *
266: * @param xRows
267: * a collection of collections containing the row-values
268: * </p>
269: */
270: public void pcmf_setRowsOnly(Collection xRows);
271:
272: /**
273: * <p>
274: * Sets new table-data (rows only) from another table.
275: * </p>
276: * <p>
277: *
278: * </p>
279: * <p>
280: *
281: * @param xRows
282: * a table object to copy row data from
283: * </p>
284: */
285: public void pcmf_setRowsOnly(KeTable xRows);
286:
287: /**
288: * <p>
289: * Sets a new header
290: * </p>
291: * <p>
292: *
293: * </p>
294: * <p>
295: *
296: * @param xHead
297: * collection containing the header-values
298: * </p>
299: */
300: public void pcmf_setHeader(Collection xHead);
301:
302: /**
303: * <p>
304: * Gets table-data excluding the header
305: * </p>
306: * <p>
307: *
308: * @return collection of multiple collections each of which contains one table
309: * row
310: * </p>
311: * <p>
312: * </p>
313: */
314: public Collection pcmf_getRowsOnly();
315:
316: /**
317: * <p>
318: * Gets the table header
319: * </p>
320: * <p>
321: *
322: * @return collection of table-header values
323: * </p>
324: * <p>
325: * </p>
326: */
327: public Collection pcmf_getHeader();
328:
329: /**
330: * <p>
331: * Adds a row to a table
332: * </p>
333: * <p>
334: *
335: * </p>
336: * <p>
337: *
338: * @param xRow
339: * collection of row-data
340: * </p>
341: */
342: public void pcmf_addRow(Collection xRow);
343:
344: /**
345: * <p>
346: * Adds multiple rows to a table
347: * </p>
348: * <p>
349: *
350: * </p>
351: * <p>
352: *
353: * @param xRow
354: * collection of multiple collections each of which contains one
355: * table row
356: * </p>
357: */
358: public void pcmf_addRows(Collection xRow);
359:
360: /**
361: * <p>
362: * Removes one row from the table
363: * </p>
364: * <p>
365: *
366: * @return Collection containing the removed row-values
367: * </p>
368: * <p>
369: * @param xIdx
370: * row index (started by 0)
371: * </p>
372: */
373: public Collection pcmf_removeRow(int xIdx);
374:
375: /**
376: * <p>
377: * Removes all selected Rows
378: * </p>
379: * <p>
380: */
381: public void pcmf_removeSelected();
382:
383: /**
384: * <p>
385: * Adds a row to a table
386: * </p>
387: * <p>
388: *
389: * </p>
390: * <p>
391: *
392: * @param xRow
393: * collection of row-data
394: * @param xIdx
395: * RowIndex, 0 = header
396: * </p>
397: */
398: public void pcmf_addRow(Collection xRow, int xIdx);
399:
400: /**
401: * <p>
402: * Modifies one existing table-cell
403: * </p>
404: * <p>
405: *
406: * @return old value of the table-cell
407: * </p>
408: * <p>
409: * @param xRow
410: * index of the row (started by 0)
411: * @param xCol
412: * index of the column (started by 0)
413: * @param xObj
414: * new object
415: * </p>
416: */
417: public Object pcmf_modCell(int xRow, int xCol, Object xObj);
418:
419: /**
420: * <p>
421: * Gets on table cell's content
422: * </p>
423: * <p>
424: *
425: * @return content
426: * </p>
427: * <p>
428: * @param xRow
429: * index of the row (started by 0)
430: * @param xCol
431: * index of the column (started by 0)
432: * </p>
433: */
434: public Object pcmf_getCellValue(int xRow, int xCol);
435:
436: /**
437: * <p>
438: * Changes the complete table content including header and rows. The new
439: * content is read from another table
440: * </p>
441: * <p>
442: *
443: * </p>
444: * <p>
445: *
446: * @param xTable
447: * table-object to copy the content from
448: * </p>
449: */
450: public void pcmf_setComplete(KeTable xTable);
451:
452: /**
453: * <p>
454: * Gets a new table from this one
455: * </p>
456: * <p>
457: *
458: * @return new table object
459: * </p>
460: * <p>
461: * </p>
462: */
463: public KeTable pcmf_getComplete();
464:
465: /**
466: * <p>
467: * Commits the changes
468: * </p>
469: * <p>
470: *
471: * </p>
472: * <p>
473: * </p>
474: */
475: public void pcmf_commitTable();
476:
477: /**
478: * <p>
479: * Sets a commit handler which is called each time the table is commited
480: * </p>
481: * <p>
482: *
483: * @param xHandler
484: * handler
485: * </p>
486: */
487: public void pcmf_setCommitHandler(IKeExecutable xHandler);
488:
489: /**
490: * <p>
491: * Clears the commit handler
492: * </p>
493: */
494: public void pcmf_clearCommitHandler();
495:
496: /**
497: * <p>
498: * Gets the selected row
499: * </p>
500: * <p>
501: *
502: * </p>
503: * <p>
504: *
505: * @return ArrayList which contains the row values
506: * </p>
507: */
508: public ArrayList pcmf_getSelectedTableRow();
509:
510: /**
511: * <p>
512: * Gets the selected rows in case of multiselectable
513: * </p>
514: * <p>
515: *
516: * </p>
517: * <p>
518: *
519: * @return ArrayList which contains the rows each as an own ArrayList
520: * </p>
521: */
522: public ArrayList pcmf_getSelectedTableRows();
523:
524: /**
525: * <p>
526: * Gets the number of rows including the header
527: * </p>
528: * <p>
529: *
530: * </p>
531: * <p>
532: *
533: * @return number of rows
534: * </p>
535: */
536: public int pcmf_getRowCount();
537:
538: /**
539: * <p>
540: * Gets the number of cols
541: * </p>
542: * <p>
543: *
544: * </p>
545: * <p>
546: *
547: * @return number of cols
548: * </p>
549: */
550: public int pcmf_getColCount();
551:
552: /**
553: * <p>
554: * Clears the tables roes
555: * </p>
556: * <p>
557: *
558: * </p>
559: * <p>
560: * </p>
561: */
562: public void pcmf_clearTableBody();
563:
564: /**
565: * <p>
566: * Modifies the background of a cell
567: * </p>
568: * <p>
569: *
570: * @param xRow
571: * row index (started by 0)
572: * @param xCol
573: * col index (started by 0)
574: * @param xColor
575: * color
576: * </p>
577: */
578: public void pcmf_setCellBgColor(int xRow, int xCol, String xColor);
579:
580: /**
581: * <p>
582: * Modifies the foreground of a cell
583: * </p>
584: * <p>
585: *
586: * @param xRow
587: * row index (started by 0)
588: * @param xCol
589: * col index (started by 0)
590: * @param xColor
591: * color
592: * </p>
593: */
594: public void pcmf_setCellFgColor(int xRow, int xCol, String xColor);
595:
596: /**
597: * <p>
598: * Sets the border of a cell. To unset a border set its width to 0.
599: * </p>
600: * <p>
601: *
602: * @param xRow
603: * row index (started by 0)
604: * @param xCol
605: * col index (started by 0)
606: * @param xDir
607: * IUnBox.LEFT | IUnBox.RIGHT | IUnBox.TOP | IUnBox.BOTTOM
608: * @param xColor
609: * color
610: * @param xWidth
611: * width in pixel
612: * @param xStyle
613: * IUnBox.DOTTED | IUnBox.DASHED | IUnBox.DOUBLE | IUnBox.LINE
614: * </p>
615: */
616: public void pcmf_setCellBorder(int xRow, int xCol, int xDir,
617: String xColor, int xWidth, int xStyle);
618:
619: /**
620: * <p>
621: * Sets the padding of a cell.
622: * </p>
623: * <p>
624: *
625: * @param xRow
626: * row index (started by 0)
627: * @param xCol
628: * col index (started by 0)
629: * @param xDir
630: * IUnBox.LEFT | IUnBox.RIGHT | IUnBox.TOP | IUnBox.BOTTOM
631: * @param xWidth
632: * width in pixel
633: * </p>
634: */
635: public void pcmf_setCellPadding(int xRow, int xCol, int xDir,
636: int xWidth);
637:
638: /**
639: * <p>
640: * Sets the margin of a cell. (Does not work in HTML by default)
641: * </p>
642: * <p>
643: *
644: * @param xRow
645: * row index (started by 0)
646: * @param xCol
647: * col index (started by 0)
648: * @param xDir
649: * IUnBox.LEFT | IUnBox.RIGHT | IUnBox.TOP | IUnBox.BOTTOM
650: * @param xWidth
651: * width in pixel
652: * </p>
653: */
654: public void pcmf_setCellMargin(int xRow, int xCol, int xDir,
655: int xWidth);
656:
657: /**
658: * <p>
659: * Sets the alignment of the cell content.
660: * </p>
661: * <p>
662: *
663: * @param xRow
664: * row index (started by 0)
665: * @param xCol
666: * col index (started by 0)
667: * @param xAlign
668: * NORTH | WEST | EAST | SOUTH - and combinations
669: * </p>
670: */
671: public void pcmf_setCellAlign(int xRow, int xCol, String xAlign);
672:
673: /**
674: * <p>
675: * Sets the css class of the cell. (Works only im markup based channels by
676: * default)
677: * </p>
678: * <p>
679: *
680: * @param xRow
681: * row index (started by 0)
682: * @param xCol
683: * col index (started by 0)
684: * @param xClass
685: * css class
686: * </p>
687: */
688: public void pcmf_setCellCssClass(int xRow, int xCol, String xClass);
689:
690: /**
691: * <p>
692: * Locks the columns, that means that the column is not scrolled horizonally.
693: * </p>
694: * <p>
695: *
696: * @param xCol
697: * column started by 0
698: * @param xLock
699: * true indicates lock, false indicates unlock
700: * </p>
701: */
702: public void pcmf_lockColumn(int xCol, boolean xLock);
703:
704: /**
705: * <p>
706: * Refreshes the locked columns. The function is only used internally
707: * </p>
708: */
709: public void pcmf_relockCol();
710:
711: /**
712: * <p>
713: * Gets the cell values of the specifoed column
714: * </p>
715: * <p>
716: *
717: * @param xCol
718: * column started by 0
719: *
720: * @return ArrayList which contains the column
721: * </p>
722: */
723: public ArrayList pcmf_getCol(int xCol);
724:
725: /**
726: * Create and store a span defintion upon the table.
727: *
728: * @param xRow
729: * @param xColumn
730: * @param xRowSpan
731: * @param xColumnSpan
732: */
733: public void pcmf_setSpan(int xRow, int xColumn, int xRowSpan,
734: int xColumnSpan);
735:
736: /**
737: * Removes a column span for the given row (if present)
738: *
739: * @param xRow
740: * @param xColumn
741: */
742: public void pcmf_removeSpan(int xRow, int xColumn);
743:
744: /**
745: * Clears the selection
746: */
747: public void pcmf_clearSelection();
748:
749: /**
750: * Hides a row. A call to index row 0 (which is the header) does not work in
751: * all channels
752: *
753: * @param xRow
754: */
755: public void pcmf_hideRow(int xRow);
756:
757: /**
758: * Returns whether a row is hidden or not
759: */
760: public boolean pcmf_isHiddenRow(int xRow);
761:
762: /**
763: * Unhides a row. A call to index row 0 (which is the header) does not work in
764: * all channels
765: *
766: * @param xRow
767: */
768: public void pcmf_unHideRow(int xRow);
769:
770: /**
771: * <p>
772: * Sets one row selected and returns the row
773: * </p>
774: * <p>
775: *
776: * @param xRow
777: * rowIndex
778: *
779: * @return ArrayList which contains the row
780: * </p>
781: */
782: public Object pcmf_setSelectedRow(int xRow);
783:
784: /**
785: * <p>
786: * Sets multiple rows selected and returns the rows
787: * </p>
788: * <p>
789: *
790: * @param xRow
791: * rowIndex to select
792: *
793: * @return ArrayList which contains the rows
794: * </p>
795: */
796: public ArrayList pcmf_setSelectedRows(int[] xRows);
797:
798: /**
799: * <p>
800: * Sets one row selected
801: * </p>
802: * <p>
803: *
804: * @param xRow
805: * rowIndex to select
806: * </p>
807: */
808: public void pcmf_setSelected(int xRow);
809:
810: /**
811: * <p>
812: * Sets multiple rows selected and returns the rows
813: * </p>
814: * <p>
815: *
816: * @param xRows
817: * rowIndex to select
818: * </p>
819: */
820: public void pcmf_setSelected(int[] xRows);
821: };
|