001package org.vishia.gral.ifc; 002 003import org.vishia.gral.base.GralTable; 004import org.vishia.util.MarkMask_ifc; 005import org.vishia.util.SortedTree; 006import org.vishia.util.TreeNode_ifc; 007 008 009 010public interface GralTableLine_ifc<UserData> extends GralWidget_ifc, MarkMask_ifc 011, SortedTree<GralTableLine_ifc<UserData>> 012//, TreeNode_ifc<GralTable.TableLineData<UserData>, UserData> 013, TreeNode_ifc<GralTable<UserData>.TableLineData, UserData> 014{ 015 016 /**Version, history and license. 017 * <ul> 018 * <li>2015-07-12 Hartmut new: {@link #setBackColor(GralColor, GralColor, GralColor, GralColor, GralColor, int)} with colorSelect etc. for content-depending table presentation. 019 * <li>2011-06-00 Hartmut created 020 * </ul> 021 * 022 * <b>Copyright/Copyleft</b>:<br> 023 * For this source the LGPL Lesser General Public License, 024 * published by the Free Software Foundation is valid. 025 * It means: 026 * <ol> 027 * <li> You can use this source without any restriction for any desired purpose. 028 * <li> You can redistribute copies of this source to everybody. 029 * <li> Every user of this source, also the user of redistribute copies 030 * with or without payment, must accept this license for further using. 031 * <li> But the LPGL is not appropriate for a whole software product, 032 * if this source is only a part of them. It means, the user 033 * must publish this part of source, 034 * but doesn't need to publish the whole source of the own product. 035 * <li> You can study and modify (improve) this source 036 * for own using or for redistribution, but you have to license the 037 * modified sources likewise under this LGPL Lesser General Public License. 038 * You mustn't delete this Copyright/Copyleft inscription in this source file. 039 * </ol> 040 * If you intent to use this source without publishing its usage, you can get 041 * a second license subscribing a special contract with the author. 042 * 043 * @author Hartmut Schorrig = hartmut.schorrig@vishia.de 044 */ 045 public static final int version = 20120303; 046 047 048 /**Sets the background color for a special cell of line or for all cells of this line 049 * which has not a special cell color for the several states of the line. 050 * @param colorNormal non selected, non marked 051 * @param colorSelected non marked, the selected line. 052 * @param colorMarked marked, not the selected line 053 * @param colorSomeMarked some marked, not the selected line 054 * @param colorSelectMarked marked or some marked, the selected line. 055 * @param ix -1 for the line, 0... for one cell of the line. 056 */ 057 void setBackColor(GralColor colorNormal, GralColor colorSelected, GralColor colorMarked, GralColor colorSomeMarked, GralColor colorSelectMarked, int ix); 058 059 060 061 /**Gets the table where this line is member of. */ 062 public GralTable<UserData> getTable(); 063 064 065 066 067 /**Returns the text which is assigned to the cell of the table. 068 * @param column The column of table. 069 * @return If the cell text, an empty text "" if the cell has not any text assigned. 070 * @throws IndexOutOfBoundsException on fault column. 071 */ 072 String getCellText(int column); 073 074 String[] getCellTexts(); 075 076 String setCellText(String text, int column); 077 078 //void setUserData(UserData data); 079 080 /**Returns the instance which is related to the line on #setUserData or on construction. 081 * It is the same like GralWidget_ifct#getContentInfo. 082 */ 083 UserData getUserData(); 084 085 int getSelectedColumn(); 086 087 /**Inserts a line as child of this. This method should be used if no child line exists yet. 088 * It adds as last line of children. If child lines are existent, one can use {@link #addPrevLine(String, String[], Object)} 089 * or {@link #addNextLine(String, String[], Object)} in respect to a given child line too. 090 * @param lineKey The key for the line 091 * @param lineTexts maybe null, elsewhere texts for the cells (column texts) of the line. 092 * @param userDataP 093 * @return the added line. 094 */ 095 GralTableLine_ifc<UserData> addChildLine(String childKey, String[] childTexts, UserData data); 096 097 098 /**Inserts a line behind the current line. 099 * @param lineKey The key for the line 100 * @param lineTexts maybe null, elsewhere texts for the cells (column texts) of the line. 101 * @param userDataP 102 * @return the added line. 103 */ 104 GralTableLine_ifc<UserData> addNextLine(String childKey, String[] childTexts, UserData data); 105 106 /**Inserts a line before the current line. 107 * @param lineKey The key for the line 108 * @param lineTexts maybe null, elsewhere texts for the cells (column texts) of the line. 109 * @param userDataP 110 * @return the added line. 111 */ 112 GralTableLine_ifc<UserData> addPrevLine(String childKey, String[] childTexts, UserData data); 113 114 115 void deleteLine(); 116 117 GralTableLine_ifc<UserData> parentNode(); 118 119 120 /**Opens or closes showing children of this line. It is for tree view. 121 * @param show true then show, false then close this bough. 122 * @param bLeftGrandChildrenOpen if show==true, false then close sub children boughs of this, true left opened grand children open. 123 * This is an important behavior of operating with a tree view. Both variants are desirable in different situations. 124 */ 125 void showChildren(boolean show, boolean bLeftGrandChildrenOpen); 126 127 void showChildren(boolean show, boolean bLeftGrandChildrenOpen, boolean showReally); 128 129}