@author ad
| 47 | * @author ad |
| 48 | */ |
| 49 | public class ExTextBox { |
| 50 | |
| 51 | public final TextBox textbox = new TextBox("", "", 500, TextField.ANY); |
| 52 | protected Displayable parentView = midlet.BombusMod.getInstance().getCurrentDisplayable(); |
| 53 | protected StaticData sd = StaticData.getInstance(); |
| 54 | |
| 55 | public String body; |
| 56 | private String subj; |
| 57 | protected int caretPos; |
| 58 | |
| 59 | protected Config cf; |
| 60 | |
| 61 | //#ifdef ARCHIVE |
| 62 | protected Command cmdArchive = new Command(SR.MS_ARCHIVE, Command.SCREEN, 6); |
| 63 | //#endif |
| 64 | //#if TEMPLATES |
| 65 | protected Command cmdTemplate = new Command(SR.MS_TEMPLATE, Command.SCREEN, 7); |
| 66 | //#endif |
| 67 | //#ifdef CLIPBOARD |
| 68 | private Command cmdCopy = new Command(SR.MS_COPY, Command.SCREEN, 3); |
| 69 | private Command cmdCopyPlus = new Command("+ "+SR.MS_COPY, Command.SCREEN, 4); |
| 70 | protected Command cmdPasteText = new Command(SR.MS_PASTE, Command.SCREEN, 8); |
| 71 | //#endif |
| 72 | |
| 73 | private VirtualList parentList; |
| 74 | |
| 75 | int maxSize = 500; |
| 76 | |
| 77 | final boolean writespaces; |
| 78 | |
| 79 | /** Creates a new instance of UniTextEdit */ |
| 80 | public ExTextBox(VirtualList parent, String body, String subj, boolean writespaces) { |
| 81 | cf = Config.getInstance(); |
| 82 | textbox.setTitle(subj); |
| 83 | parentList = parent; |
| 84 | this.writespaces = writespaces; |
| 85 | try { |
| 86 | //expanding buffer as much as possible |
| 87 | maxSize = textbox.setMaxSize(4096); //must not trow |
| 88 | insert(body, 0, writespaces); |
| 89 | } catch (Exception e) {} |
| 90 | |
| 91 | } |
| 92 | |
| 93 | public ExTextBox(VirtualList parent, String body, String subj) { |
| 94 | this(parent, body, subj, true); |
| 95 | } |
| 96 | |
| 97 | public void show(CommandListener listener) { |
| 98 | commandState(); |
| 99 | textbox.setCommandListener(listener); |
| 100 | midlet.BombusMod.getInstance().setDisplayable(textbox); |
| 101 | } |
| 102 | |
| 103 | public void destroyView() { |
| 104 | midlet.BombusMod.getInstance().setDisplayable(parentView); |
| 105 | VirtualCanvas.getInstance().show(parentList); |
| 106 | } |
nothing calls this directly
no test coverage detected