/** Close Variable Editor */ public void close() { SwingScilabWindow editvarWindow = SwingScilabWindow.allScilabWindows.get(editorTab.getParentWindowId()); ChangeListener[] cl = tabPane.getChangeListeners(); for (int i = 0; i < cl.length; i++) { tabPane.removeChangeListener(cl[i]); } instance = null; map.clear(); super.close(); }
/** * Set data displayed in JTable * * @param name the variable name * @param type the variable type * @param data : data to be displayed in JTable */ public void updateData(String name, String type, Object[][] data) { if (map.containsKey(name)) { editorTab.updateData(map.get(name), name, type, data); } else { editorTab.setData(name, type, data); map.put(name, tabPane.getSelectedComponent()); } }
/** * Constructor * * @param type the variable type * @param data the JTable data. * @param variableName the name in Scilab of the variable being edited. */ private ScilabVariableEditor(String type, Object[][] data, String variableName) { super(); editorTab = new SwingScilabVariableEditor(variableName, type, data); tabPane = editorTab.getTabPane(); TextBox infobar = ScilabTextBox.createTextBox(); editorTab.addInfoBar(infobar); addTab(editorTab); map.put(variableName, tabPane.getSelectedComponent()); }
/** {@inheritDoc} */ public void setVariableName(String variableName) { tabPane.setTitleAt(tabPane.getSelectedIndex(), SwingScilabVariableEditor.PREFIX + variableName); }
/** {@inheritDoc} */ public String getVariablename() { String title = tabPane.getScilabTitleAt(tabPane.getSelectedIndex()); return title.substring(SwingScilabVariableEditor.PREFIX.length()); }