001package org.vishia.gral.ifc;
002
003import java.io.File;
004import java.io.InputStream;
005import java.io.Writer;
006import java.util.List;
007import java.util.Map;
008import java.util.Set;
009
010import org.vishia.byteData.VariableContainer_ifc;
011import org.vishia.gral.base.GralButton;
012import org.vishia.gral.base.GralCurveView;
013import org.vishia.gral.base.GralGraphicTimeOrder;
014import org.vishia.gral.base.GralHtmlBox;
015import org.vishia.gral.base.GralLed;
016import org.vishia.gral.base.GralMenu;
017import org.vishia.gral.base.GralPos;
018import org.vishia.gral.base.GralTable;
019import org.vishia.gral.base.GralValueBar;
020import org.vishia.gral.base.GralWidgImpl_ifc;
021import org.vishia.gral.base.GralWidget;
022import org.vishia.gral.base.GralMng;
023import org.vishia.gral.base.GralPanelContent;
024import org.vishia.gral.base.GralWindow;
025import org.vishia.gral.base.GralTabbedPanel;
026import org.vishia.gral.base.GralPanelActivated_ifc;
027import org.vishia.gral.base.GralTable;
028import org.vishia.gral.base.GralTextBox;
029import org.vishia.gral.base.GralTextField;
030import org.vishia.gral.cfg.GralCfgBuilder;
031import org.vishia.gral.cfg.GralCfgData;
032//import org.vishia.gral.ifc.GuiShellMngIfc;
033import org.vishia.gral.widget.GralHorizontalSelector;
034import org.vishia.gral.widget.GralInfoBox;
035import org.vishia.util.KeyCode;
036import org.vishia.util.ReplaceAlias_ifc;
037
038
039
040/**This is a unique interface for the GUI-panel-manager to build its content.
041 * To work with the graphical application see {@link GralMng_ifc}. 
042 * <br><br>
043 * <br><br>
044 * For the most
045 * simple applications, the capability of this interface and its given implementation 
046 * for the platform may be sufficient, so the platform-specific widget isn't necessary to use.
047 * It may be better to enhance this interface and its implementation(s) if new features are need.
048 * But the definition of that enhancements should be done in a commonly form which is able to implement
049 * in any known Java GUI platform.
050 * <br><br>
051 * Generally, the widgets are able to address with an identification String to do something with it
052 * for symbolic access. 
053 * <br><br>
054 * To build a GUI you must use the following order of calls:
055 * <ul>
056 * <li>Create a graphic manager which is typeof {@link GralMng} or this interface.
057 *   For example create {@link org.vishia.gral.swt.SwtMng}.
058 * <li>Create a panel, for example call {@link #createGridPanel(GralColor, int, int, int, int)}
059 *   and add the panel to the given     
060 * <li>Before add, you can select any given panel by String-identifier, using {@link #selectPanel(String)}.
061 * <li>Before add, you have to determine the position and size using 
062 *   <ul><li>{@link #setPositionSize(int, int, int, int, char)} in grid units
063 *     <li>{@link #setFinePositionSize(int, int, int, int, int, int, int, int, char)} 
064 *     <li>{@link #setNextPositionX()}
065 *   </ul>   
066 * <li>The call the <b>add method</b>: This methods create the graphic widget in the current selected panel.
067 * </ul>
068 * <br><br>
069 * <b>Concept of positioning</b>: see method {@link #setPosition(float, float, float, float, char, int)}
070 * and {@link GralWidget_ifc}.
071 * <br><br>
072 * <br><br>
073 * <b>Concept for widgets</b>: see {@link GralWidget}
074 *  
075 * @author Hartmut Schorrig
076 *
077 */
078public interface GralMngBuild_ifc 
079{
080  
081  /**The version of this interface:
082   * <ul>
083   * <li>2016-09-01 Hartmut chg: instead extends {@link ReplaceAlias_ifc} now contains {@link #getReplacerAlias()}.
084   *   It is an extra class for a ReplacerAlias given independent of the graphic. 
085   * <li>2016-07-20 Hartmut chg: instead setToPanel now {@link #createImplWidget_Gthread()}. It is a better name. 
086   * <li>2012-04-01 Hartmut new: {@link #addDataReplace(Map)}, {@link #replaceDataPathPrefix(String)}.
087   *   using alias in the {@link GralWidget#setDataPath(String)}. The resolving of the alias is done
088   *   only if the datapath is used. 
089   * <li>2012-03-10 Hartmut chg: Rename this class to GralMngBuild_ifc
090   * <li>2012-03-09 Hartmut new: {@link #addCheckButton(String, String, String, String, GralColor, GralColor, GralColor)}
091   * <li>2012-02-11 Hartmut new: {@link #setContextMenu(GralWidget, GralMenu)}. 
092   * <li>2011-11-16 Hartmut new: {@link #addText(String)} simple with standards.
093   * <li>2011-11-17 Hartmut chg: {@link #createWindow(String, String, int)} now not only exclusive or not
094   *   but with some control bits {@link GralWindow#windExclusive} etc.
095   * <li>2011-06-18 Hartmut chg: createFileDialog() improved, 
096   *     new addFileSelectField(): A Field that comprises the possibility to open a file select dialog
097   *     and that are a destination for drop or paste a file mime type from clipboard. 
098   * <li>2011-05-01 Hartmut new: {@link #addTextBox(GralWidget, boolean, String, char)}: 
099   *     A Text box with more as one line. The TextField has only one line.
100   * <li>2011-05-01 Hartmut new: {@link #createCompositeBox()}. It is a box with its own PanelMng
101   *     which is located in an area of another panel. (Composite)
102   * <li>2011-05-01 Hartmut new: {@link #remove(GralGridBuild_ifc)} and {@link #remove(GralWidget)}
103   *     to remove widgets, for dynamic views.
104   * <li>2011-05-01 Hartmut new: {@link #createWindow(String, boolean)} instead createModalWindow(String).
105   *     This method should be used for any sub-windows in the application. The window position is determined
106   *     inside the current window with the known {@link #setPositionSize(int, int, int, int, char)} functionality.
107   *     The {@link #createWindow(int, int, int, int, VariableContainer_ifc)} with absolute coordinates
108   *     may be deprecated. (Is it necessary to create a window outside the own borders? )             
109   * <li>All other changes in 2010
110   * </ul>
111   * 
112   * <b>Copyright/Copyleft</b>:<br>
113   * For this source the LGPL Lesser General Public License,
114   * published by the Free Software Foundation is valid.
115   * It means:
116   * <ol>
117   * <li> You can use this source without any restriction for any desired purpose.
118   * <li> You can redistribute copies of this source to everybody.
119   * <li> Every user of this source, also the user of redistribute copies
120   *    with or without payment, must accept this license for further using.
121   * <li> But the LPGL is not appropriate for a whole software product,
122   *    if this source is only a part of them. It means, the user
123   *    must publish this part of source,
124   *    but doesn't need to publish the whole source of the own product.
125   * <li> You can study and modify (improve) this source
126   *    for own using or for redistribution, but you have to license the
127   *    modified sources likewise under this LGPL Lesser General Public License.
128   *    You mustn't delete this Copyright/Copyleft inscription in this source file.
129   * </ol>
130   * If you intent to use this source without publishing its usage, you can get
131   * a second license subscribing a special contract with the author. 
132   * 
133   * @author Hartmut Schorrig = hartmut.schorrig@vishia.de
134   */
135  public static final int version = 20120303;
136
137
138  /**
139   * 
140   */
141  public static final int propZoomedPanel = 0x0001;
142  
143  public static final int propGridZoomedPanel = 0x0002;
144  
145  
146  
147  /**Sets the action for main keys. Main keys are used in an application independent of the focused widget.
148   * The {@link GralUserAction#userActionGui(int, GralWidget, Object...)} is invoked on any key down event,
149   * exclusive some graphic implementation specific keys. The user should return false in this method
150   * if the key is not used and should not be blocked for widget specific key listeners. 
151   * @param userKeyAction The user action to process main keys.
152   * @return the last set user action.
153   */
154  GralUserAction setMainKeyAction(GralUserAction userKeyAction);
155
156  ReplaceAlias_ifc getReplacerAlias();
157
158        /**Returns the width (number of grid step horizontal) of the last element.
159   * @return Difference between current auto-position and last pos.
160   */
161  //int getWidthLast();
162
163  /**Registers a panel to place the widgets. The panel can be selected
164   * with its name calling the {@link #selectPanel(String)} -Routine
165   * <br>parameter panel:
166   * <ul><li>Swing: javax.swing.JPanel
167   * <li>SWT: org.eclipse.swt.widgets.Composite
168   * </ul>
169   * @param name Name of the panel.
170   * @param panel The panel. It should be from the correct type of the base-graphic-system.
171   *              If it the instance is fault, a ClassCastException is thrown.
172   *         
173   */
174  public void registerPanel(GralPanelContent panel);
175  
176  
177  /**Adds a panel for tabs as child of the current panel.
178   * @param user If not null, then this user class will be notified when a tab is selected.
179   *             The user should update showed values.
180   * @param properties use or of constants {@link #propZoomedPanel}, {@link #propGridZoomedPanel}
181   * @return The tab-container, there the tabs can be registered.
182   */
183  GralTabbedPanel addTabbedPanel(String namePanel, GralPanelActivated_ifc user, int properties);
184  
185  /**selects a registered panel for the next add-operations.
186   * see {@link #registerPanel(String, Object)}. 
187   */
188  void selectPanel(String sName);
189
190  /**Selects the given panel as current panel to build some content. */
191  void selectPanel(GralPanelContent panel);
192  
193  /**Selects the primary window as current panel to build some content. */
194  void selectPrimaryWindow();
195  
196  
197  /**Sets the position for the next widget to add in the container.
198   * @param xpos x-Position in x-Units, count from left of the box.
199   * @param ypos y-Position in y-Units, count from top of the box. It is the bottom line of the widget.
200   *              It means ypos = 0 is not a proper value. To show a text in the first line, use ypos=2.
201   */
202  //void setPosition(int ypos, int xpos);
203  
204  
205  
206  /**Sets the position and size for the next widget to add in the container.
207   * @param line y-Position in y-Units, count from top of the box. 
208   *              It is either the top or bottom line of the widget, depending on height.
209   *              If < 0, then the previous position is valid furthermore.
210   * @param column x-Position in x-Units, count from left of the box. 
211   *              If < 0, then the previous position is valid furthermore.
212   * @param heigth The height of the line. If <0, then the param line respectively the current line 
213   *                will be used as bottom line of the next widget, and (line-height) is the top line. 
214   *                If 0 then the last value of height is taken furthermore. 
215   * @param length The number of columns. If <0, then the param column is the right column, 
216   *                and column-length is the left column. If 0 then the last value of length is not changed.
217   * @param direction direction for a next widget, use 'r', 'l', 'u', 'd' for right, left, up, down
218   * @deprecated. Use {@link #setPosition(float, float, float, float, char, int)}.                
219   */
220  public void setPositionSize(int line, int column, int height, int length, char direction);
221  
222  
223  /**Sets the position.
224   * 
225   *        
226   * @param framePos The given frame.
227   * @param line The line. Positive: from top, negative: from end. 
228   * @param lineEndOrSize The position of end of widget. negative or 0: from end. 0: the end position of Panel.
229   *   see {@link GralPos#same} etc.
230   * @param column
231   * @param columnEndOrSize
232   */
233  public void setPosition(float line, float lineEndOrSize, float column, float columnEndOrSize
234    , int origin, char direction );
235  
236  
237  /**Sets the position in relation to a given position.
238   * @param framePos The given frame.
239   * @param line The line
240   * @param lineEnd
241   * @param column
242   * @param columnEnd
243   * @deprecated. 
244   */
245  public void setPosition(GralPos framePos, float line, float lineEnd, float column, float columnEnd
246    , int origin, char direction);
247
248
249  public void setPosition(GralPos framePos, float line, float lineEnd, float column, float columnEnd
250    , int origin, char direction, float border);
251
252
253  /**Sets the position with fine position given as float value. Only one digit after the float point is regarded,
254   * see definition for the fine position as description of {@link GralPos}.
255   * @param line either position or combinded with {@link GralPos#refer} etc.
256   * @param lineEnd
257   * @param column
258   * @param columnEnd
259   * @param origin see {@link #setFinePosition(int, int, int, int, int, int, int, int, int, char, int, int, GralPos)}
260   * @param direction
261   * @param border
262   */
263  public void setPosition(float line, float lineEnd, float column, float columnEnd
264    , int origin, char direction, float border);
265
266
267  
268  /**Same as {@link #setPositionSize(int, int, int, int, char)}, but the positions can be in a fine division.
269   * @param y The line. 
270   * @param yFrac Number between 0..9 for fine positioning in the grid step.
271   * @param yEnd
272   * @param yEndFrac Number between 0..9 for fine positioning in the grid step.
273   * @param x
274   * @param xFrac Number between 0..9 for fine positioning in the grid step.
275   * @param xEnd
276   * @param xEndFrac Number between 0..9 for fine positioning in the grid step.
277   * @param direction Direction of the next position if that is not given than or {@link GralPos#next} is given than.
278   *        A value other then r, l, u, d let the direction unchanged from previous call.
279   * @param origin Origin of inner widgets or next widgets. Use:
280   *        <pre>
281   *        1    4    7
282   *        2    5    8
283   *        3    6    9
284   *        </pre>
285   *        for the origin points. (origin-1) %3 is the horizontal origin, (origin-1 /3) is the vertical one.
286   *        A value 0 let the origin unchanged from previous call.
287   */
288  public void setFinePosition(int y, int yFrac, int yEnd, int yEndFrac
289      , int x, int xFrac, int xEnd, int xEndFrac
290      , int origin, char direction, int border, int borderFrac, GralPos frame);
291  
292  /**Sets the next position if the position is used, but change the size.
293   * @param ySize
294   * @param ySizeFrac
295   * @param xSize
296   * @param xSizeFrac
297   */
298  public void setSize(int ySize, int ySizeFrac, int xSize, int xSizeFrac);
299
300  
301  
302  /**Gets the current position in the panel to store anywhere other. Usual the position is stored in the widget itself.
303   * This operation returns an independent instance of GralGridPos. 
304   * Note that the {@link GralMng#pos} is reused there. Therefore the implementation of the method
305   * returns a cloned instance.   
306   * @return An independent instance with current data of {@link GralMng#pos}.
307   * @deprecated see {@link GralWidget.ImplAccess}. 
308   */
309  @Deprecated
310  GralPos getPositionInPanel();
311  
312  
313  
314  /**Adds a button
315   * @param sButtonText text in the button
316   * @param height in grid-units
317   * @param width in grid-unigs
318   * @param sCmd The command string will be transfered to the action-method
319   * @param sUserAction The user action shoult be registered before 
320   *         calling {@link #registerUserAction(String, GralUserAction)}
321   * @param sName
322   * @return
323   */
324  //Object addButton(String sButtonText, int height, int width, String sCmd, String sUserAction, String sName);
325  public GralButton addButton(
326    String sName
327  , GralUserAction action
328  , String sCmd
329  //, String sShowMethod
330  , String sDataPath
331  , String sButtonText
332  );
333  
334  
335  /**Adds a button
336   * @param sButtonText text in the button
337   * @param height in grid-units
338   * @param width in grid-unigs
339   * @param sCmd The command string will be transfered to the action-method
340   * @param sUserAction The user action shoult be registered before 
341   *         calling {@link #registerUserAction(String, GralUserAction)}
342   * @param sName
343   * @return
344   */
345  //Object addButton(String sButtonText, int height, int width, String sCmd, String sUserAction, String sName);
346  public GralButton addButton(
347    String sName
348  , GralUserAction action
349  , String sButtonText
350  );
351  
352  
353  //public void add(GralHorizontalSelector<?> sel);
354
355  
356  /**Adds a button which saves its state, pressed or non-pressed.
357   * 
358   * @param sName
359   * @param action
360   * @param sCmd
361   * @param sShowMethod
362   * @param sDataPath
363   * @param sButtonText
364   * @return
365   */
366  public GralButton addSwitchButton(
367    String sName
368  , GralUserAction action
369  , String sCmd
370  //, String sShowMethod
371  , String sDataPath
372  , String sButtonText
373  , String color0
374  , String color1
375  );
376  
377  
378  
379  /**Adds a button which is switching on or off. The state is shown with 2 colors and 2 different texts
380   * inside the button. The state is able to retrieve calling {@link GralButton#isOn()} 
381   * or {@link GralButton#getValue()}.
382   * @param sName
383   * @param sButtonText0
384   * @param sButtonText1
385   * @param color0
386   * @param color1
387   * @return
388   */
389  public GralButton addSwitchButton(
390    String sName
391  , String sButtonTextOff
392  , String sButtonTextOn
393  , GralColor colorOff
394  , GralColor colorOn
395  );
396  
397  
398  
399  /**Adds a button which is switching on or off. The state is shown with 2 colors and 2 different texts
400   * inside the button. The state is able to retrieve calling {@link GralButton#isOn()} 
401   * or {@link GralButton#getValue()}.
402   * @param sName
403   * @param sButtonText0
404   * @param sButtonText1
405   * @param color0
406   * @param color1
407   * @return
408   */
409  public GralButton addCheckButton(
410    String sName
411  , String sButtonTextOn
412  , String sButtonTextOff
413  , String sButtonTextDisabled
414  , GralColor colorOn
415  , GralColor colorOff
416  , GralColor colorDisabled
417  );
418  
419  
420  
421  
422  /**Adds a Led (round)
423   * @param sName
424   * @return
425   */
426  //Object addButton(String sButtonText, int height, int width, String sCmd, String sUserAction, String sName);
427  GralLed addLed(
428        String sName
429  //, String sShowMethod
430  , String sDataPath
431  );
432  
433  GralValueBar addValueBar(
434        String sName
435  //, String sShowMethod
436  , String sDataPath
437  );
438  
439  
440  GralWidget addSlider(
441        String sName
442  , GralUserAction action
443  , String sShowMethod
444  , String sDataPath
445  );
446  
447  
448  /**Adds a table, which is able to scroll.
449   * A user action on the GUI with the table invokes the {@link GralWidget#setActionChange(GralUserAction)}
450   * with 
451   * <ul>
452   * <li> with given command "table-key".
453   * <li>values[0] is the selected line referenced with {@link GralTableLine_ifc}
454   * <li>values[1] is the key code described in {@link KeyCode}
455   * </ul> 
456   * If the method isn't given or returns false, the central key action given in {@link GralMng#getRegisteredUserAction(String)}
457   * for "keyAction" is tried to get and then invoked with cmd = "key" and the key code in values[0].
458   * This central keyAction may be used for application centralized keys without association to the table itself.
459   * 
460   * @param sName register name, used for {@link GuiPanelMngWorkingIfc#insertInfo(String, int, String).}
461   * @param height The height in grid units for the appearance
462   * @param columnWidths Array with width of the columns. 
463   *        Each column has a fix default width per construction.
464   *        It may or may not a fix widht, it may able to change by mouse actions,
465   *        adequate to the possibilities of the used graphic base system. 
466   * @return
467   * @deprecated Create an instance of {@link GralTable} and call {@link GralTable#setToPanel(GralMngBuild_ifc)} 
468   */
469  @Deprecated
470  GralTable addTable(String sName, int height, int[] columnWidths);
471
472  //void add(GralTable<?> table);
473  
474  
475  
476  /**This routine is called from {@link GralWidget#setToPanel(GralMngBuild_ifc)}.
477   * It is not intent to call from the application immediately. Use {@link GralWidget#setToPanel(GralMngBuild_ifc)} instead.
478   * The implementation of this routine checks the type of the widget and invokes the proper routine
479   * for the implementation graphic in the implementation level of the {@link GralMng}.
480   * @param widgg The widget should be initialized already.
481   */
482  void createImplWidget_Gthread(GralWidget widgg);
483
484  /**Adds a text to the current panel at given position with standard colors, left origin.
485   * The size of text is calculated using the height of positioning values.
486   * @param text
487   */
488  GralWidget addText(String sText);
489  
490  /**Adds a simple text at the current position.
491   * 
492   * @param sText The text
493   * @param size size, 'A' is small ...'E' is large.
494   * @param color The color as RGB-value in 3 Byte. 0xffffff is white, 0xff0000 is red.
495   * @return
496   * @deprecated
497   */
498  @Deprecated
499  GralWidget addText(String sText, char size, int color);
500 
501  
502  /**Adds a simple text at the current position.
503   * @param sText
504   * @param origin Origin, use char 1..9 for 1 top-left, 2 top-middle, ... 5 middle, 9 bottom-right.  
505   * @param textColor
506   * @param BackColor
507   * @return
508   */
509  GralWidget addText(String sText, int origin, GralColor textColor, GralColor BackColor);
510  
511  Object addImage(String sName, InputStream imageStream, int height, int width, String sCmd);
512
513  
514  /**Adds a line.
515   * <br><br>To adding a line is only possible if the current panel is of type 
516   * {@link SwtCanvasStorePanel}. This class stores the line coordinates and conditions 
517   * and draws it as background if drawing is invoked.
518   * 
519   * @param colorValue The value for color, 0xffffff is white, 0xff0000 is red.
520   * @param xa start of line relative to current position in grid units.
521   *          The start is relative to the given position! Not absolute in window! 
522   * @param ya start of line relative to current position in grid units.
523   * @param xe end of line relative to current position in grid units.
524   * @param ye end of line relative to current position in grid units.
525   * @deprecated it is the old form before a {@link org.vishia.gral.widget.GralPlotArea} was created. Use that.
526   */
527  @Deprecated void addLine(int colorValue, float xa, float ya, float xe, float ye);
528    
529  
530  /**Adds a line.
531   * <br><br>To adding a line is only possible if the current panel is of type 
532   * {@link SwtCanvasStorePanel}. This class stores the line coordinates and conditions 
533   * and draws it as background if drawing is invoked.
534   * 
535   * @param color
536   * @param points
537   */
538  void addLine(GralColor color, List<GralPoint> points);
539      
540    
541
542    
543  
544  /** Adds a field for editing or showing a text. This text can be prepared especially as number value too.
545   * The field has one line. The number of chars are not limited. 
546   * <br><br>
547   * The current content of the edit field is able to get any time calling {@link GralPanelMngWorking_ifc#getValue(String)}
548   * with the given registering name.
549   * <br><br>
550   * To force a set of content or an action while getting focus of this field the method {@link #addActionFocused(String, GralUserAction, String)}
551   * can be called after invoking this method (any time, able to change). The {@link GralUserAction#userActionGui(String, String, GralWidget, Map)}
552   * is called in the GUI-thread before the field gets the focus.
553   * <br><br>
554   * To force a check of content or an action while finish editing the method {@link #addActionFocusRelease(String, GralUserAction, String)}
555   * can be called after invoking this method (any time, able to change). The adequate userActionGui is called after editing the field.
556   * <br><br>
557   * If the {@link GralWidget#action} refers an instance of type {@link GralUserAction}, than it is the action on finish editing.
558   * 
559   * @param sName The registering name
560   * @param widgetInfo The informations about the textfield.
561   * @param editable true than edit-able, false to show content 
562   * @param prompt If not null, than a description label is shown
563   * @param promptStylePosition Position and size of description label:
564   *   upper case letter: normal font, lower case letter: small font
565   *   'l' left, 't' top (above field) 
566   * @return
567   * @deprecated
568   */
569  //Object addTextField(GralWidget widgetInfo, boolean editable, String prompt, char promptStylePosition);
570  
571  /**Adds a text field at the current position.
572   * @param name The registering name to get the value from outside or set the content.
573   * @param editable true then an input field, false only for show
574   * @param prompt If not null, then this prompt text is shown above, left, rigth
575   * @param promptStylePosition Position and size of description label:
576   *   upper case letter: normal font, lower case letter: small font
577   *   'l' left, 't' top (above field) 
578   * @return The WidgetDescriptor. An action, tooltip, color etc. can be set there later.
579   */
580  GralTextField addTextField(String name, boolean editable, String prompt, String promptStylePosition);
581  
582  /** Adds a box for editing or showing a text.
583   * <br><br>
584   * The current content of the edit field is able to get anytime calling {@link GralMng_ifc#getValue(String)}
585   * with the given registering name.
586   * <br><br>
587   * To force a set of content or an action while getting focus of this field the method {@link #addActionFocused(String, GralUserAction, String)}
588   * can be called after invoking this method (any time, able to change). The {@link GralUserAction#userActionGui(String, String, GralWidget, Map)}
589   * is called in the GUI-thread before the field gets the focus.
590   * <br><br>
591   * To force a check of content or an action while finish editing the method {@link #addActionFocusRelease(String, GralUserAction, String)}
592   * can be called after invoking this method (any time, able to change). The adequate userActionGui is called after editing the field.
593   * <br><br>
594   * If the {@link GralWidget#action} refers an instance of type {@link GralUserAction}, than it is the action on finish editing.
595   * 
596   * @param sName The registering name
597   * @param widgetInfo The informations about the textfield.
598   * @param editable true than edit-able, false to show content 
599   * @param prompt If not null, than a description label is shown
600   * @param promptStylePosition Position and size of description label:
601   *   upper case letter: normal font, lower case letter: small font
602   *   'l' left, 't' top (above field) 
603   * @return
604   */
605  //GralTextBox_ifc 
606  GralTextBox addTextBox(String name,/*GralWidget widgetInfo, */boolean editable, String prompt, char promptStylePosition);
607  
608  /** Adds a box which presents html content.
609   * 
610   * @param sName The registering name
611   * @return The instance arranged in the current panel at current position of the GralWidgetMng
612   */
613  GralHtmlBox addHtmlBox(String name);
614  
615  /**Adds a curve view for displaying values with ordinary x-coordinate.
616   * The scaling of the curve view is set to -100..100 per default. 
617   * @param sName Its registered name
618   * @param dyGrid height in grid-units
619   * @param dxGrid width in grid-units
620   * @param nrofXvalues depth of the buffer for x-values. It should be 6..20 times of dx.
621   * @param nrofTracks number of curves (tracks).
622   * @return The Canvas Object.
623   */
624  GralCurveView addCurveViewY(String sName, int nrofXvalues, GralCurveView.CommonCurve common);
625  
626  /**Adds a special text field to select a file. On the right side a small button [<] is arranged
627   * to open the standard file select dialog. 
628   * The text field is a receiver of file objects for drag % drop or paste the clipboard. 
629   * @param name Name of the widget
630   * @param listRecentFiles maybe null, a list which stores and offers selected files.
631   * @param defaultDir The start directory on open the dialog.
632   * @param startDirMask The start dir and selection mask. Both are separated with a ':' character
633   *        in this string. See {@link GralFileDialog_ifc}. 
634   *        If the last or only one char is '/' then a directory should be selected.
635   *        For example "D:/MyDir:*.txt" shows only .txt-files to select in the dialog starting from d:/MyDir. 
636   * @param prompt Prompt for the text field.
637   * @param promptStylePosition
638   * @return
639   */
640  GralTextField addFileSelectField(String name, List<String> listRecentFiles, String startDirMask, String prompt, String promptStylePosition);
641  
642  
643  /**Adds a panel that is not bound yet.
644   * @param panel
645   */
646  //void addPanel(GralPanelContent panel);
647  
648  /**Adds the given Focus action to the named widget.
649   * @param sName The name of the widget. It should be registered calling any add... method.
650   * @param action
651   * @param sCmdEnter
652   * @param sCmdRelease
653   * @return
654   */
655  GralWidget addFocusAction(String sName, GralUserAction action, String sCmdEnter, String sCmdRelease);
656
657  /**Adds the given Focus action to the known widget.
658   * @param widgetInfo
659   * @param action
660   * @param sCmdEnter
661   * @param sCmdRelease
662   */
663  void addFocusAction(GralWidget widgetInfo, GralUserAction action, String sCmdEnter, String sCmdRelease);
664
665  
666  /**Register all widgets, which are created in its own classes, not add here.
667   * The widgets are stored in the index of names.
668   * @param widgd
669   */
670  void registerWidget(GralWidget widgd);
671  
672  /**Sets the values for a line
673   * @param sName The registered name
674   * @param yNull array of values for all tracks in percent from 0..100.0, where its 0-line is shown.
675   * @param yOffset This value will be subtract from the input values before scale. 
676   *         It is the 0-line-reference of the input values. 
677   * @param yScale This value is that value, which is shown in a 10%-difference in the output window.
678   */
679  //void setLineCurveView(String sNameView, int trackNr, String sNameLine, String sVariable, int colorValue, int style, int y0Line, float yScale, float yOffset);
680  
681  
682  /**Sets the appearance of the graphic respectively color and grid.
683   * @param sName The registered name
684   * @param backgroundColor The color of the background
685   * @param colorLines Array of color values for the lines. Any value should be given 
686   *        as red-green-blue value in 24 bit. Additionally 
687   *        <ul>
688   *        <li>bit24,25, is the thickness of the line.
689   *        </ul> 
690   * @param grid character to determine how the grid is shown. '0' no grid, 'a'..'f' weak to strong.
691   * 
692   */
693  //void setColorGridCurveViewY(String sName, int backgroundColor, int[] colorLines, char grid);
694  
695  /**Gets the value to the named color. It is a method of the graphic.
696   * @param sName supported: red, green, blue, yellow
697   * @return 3 bytes intensity: bit23..16 blue, bit15..8: green, bit 7..0 red. 
698   */
699  int getColorValue(String sName);
700  
701
702  /**Gets the named color. 
703   * @param sName supported: red, green, blue, yellow
704   */
705  GralColor getColor(String sName);
706  
707
708  /**Forces a newly paint of the GUI-container. 
709   * This method should only be called in the graphic thread (SWT).*/
710  void repaint();
711  
712  
713  /**Forces a newly paint of the current panel. 
714   * This method should only be called in the graphic thread. It should be used after changing content. */
715  void repaintCurrentPanel();
716  
717  /**Registered any user action. A registered user action is used especially for a script build GUI.
718   * Action can be given by this register name. 
719   * <br><br>
720   * The registering of user actions should be done at startup of the application, before the 
721   * {@link GralCfgBuilder#buildGui(org.vishia.msgDispatch.LogMessage, int)} is invoked.
722   * The user actions can be called in any specialized context.
723   * <br><br>
724   * @param name Name of the action
725   * @param action what to do.
726   */
727  void registerUserAction(String name, GralUserAction action);
728  
729  GralUserAction getRegisteredUserAction(String name);
730  
731  
732  /**Returns a Set of all fields, which are created to show.
733   * @return the set, never null, possible an empty set.
734   */
735  public Set< Map.Entry <String, GralWidget>> getShowFields();
736
737  
738  
739  /**Creates a box inside the current panel to hold some widgets.
740   * 
741   * @return
742   * @since 2010-05-01
743   */
744  GralPanelContent createCompositeBox(String name);
745  
746  
747  
748  /**Creates an independent grid panel which is managed by this.
749   * The panel can be associated to any graphic frame.
750   * @param namePanel
751   * @param backGround
752   * @param xG
753   * @param yG
754   * @param xS
755   * @param yS
756   * @return
757   */
758  GralPanelContent createGridPanel(String namePanel, GralColor backGround, int xG, int yG, int xS, int yS);
759  
760  
761  /**Creates an empty context menu.
762   * @return
763   */
764  //GralMenu createContextMenu(String name, GralWidget widg);
765  
766  /**Removes a composite box from the graphic representation.
767   * @param compositeBox
768   * @return true if removed.
769   */
770  boolean remove(GralPanelContent compositeBox);
771  
772  boolean remove(GralWidget widget);
773  
774        /**Creates a new window additional to a given window with Panel Manager.
775         * @param left
776         * @param top
777         * @param width
778         * @param height
779         * @param variableContainer A Container for variables
780         * @return
781         * @deprecated
782         */
783        //GuiShellMngBuildIfc createWindow(int left, int top, int width, int height, VariableContainer_ifc variableContainer);
784        
785        /**Creates a Window for a modal or non modal dialog. The window is described by the returned interface. 
786         * It can be filled with elements. The dialog is able to show and hide calling 
787         * {@link GralWindow_ifc#setWindowVisible(boolean)} or 
788         * {@link GralMng_ifc#setWindowsVisible(GralWindow_ifc, GralPos)}. 
789         * The position and size of the window is set with the adequate strategy like all other widget: 
790         * using {@link #setPositionSize(int, int, int, int, char)}. 
791         * @param title Title of the window, may be null, then without title bar.
792         * @param windProps Or of the static variables {@link GralWindow#windExclusive} etc. 
793         * @return
794         * @deprecated use {@link GralWindow#GralWindow(String, String, String, int)} and then {@link GralWidget#createImplWidget_Gthread()}
795         *   with this window.
796         */
797  @Deprecated 
798        GralWindow createWindow(String name, String title, int windProps);
799  
800        
801  GralInfoBox createTextInfoBox(String name, String title);
802
803  GralInfoBox createHtmlInfoBox(String posString, String name, String title, boolean onTop);
804
805  /**Sets the builder for content configuration.
806   * @param cfgBuilder
807   */
808  void buildCfg(GralCfgData data, File fileCfg);
809        
810  /**Sets or resets the design mode. The design mode allows to change the content.
811   * @param mode
812   */
813  void setDesignMode(boolean mode);
814  
815  /**Saves the given configuration.
816   * @param dest
817   * @return
818   */
819  String saveCfg(Writer dest);
820  
821  /**Creates a file or directory dialog. The dialog can be activated (showed) any time. 
822   * The dialog is showed in a own window, maybe modal or not.
823   * @return Interface to deal with the dialog.
824   */
825        GralFileDialog_ifc createFileDialog();
826        
827        //GuiShellMngIfc getShellMngIfc();
828
829}