use of gate.swing.XJTable in project gate-core by GateNLP.
the class CorpusEditor method initGuiComponents.
protected void initGuiComponents() {
setLayout(new BorderLayout());
renderer = new DocumentNameRenderer();
docTable = new XJTable(docTableModel);
docTable.setSortable(true);
docTable.setSortedColumn(DocumentTableModel.COL_INDEX);
docTable.setAutoResizeMode(XJTable.AUTO_RESIZE_LAST_COLUMN);
docTable.getColumnModel().getColumn(DocumentTableModel.COL_NAME).setCellRenderer(renderer);
docTable.setDragEnabled(true);
docTable.setTransferHandler(new TransferHandler() {
// drag and drop to move up and down the table rows
// import selected documents from the resources tree
String source = "";
@Override
public int getSourceActions(JComponent c) {
return MOVE;
}
@Override
protected Transferable createTransferable(JComponent c) {
int[] selectedRows = docTable.getSelectedRows();
Arrays.sort(selectedRows);
return new StringSelection("CorpusEditor" + Arrays.toString(selectedRows));
}
@Override
protected void exportDone(JComponent c, Transferable data, int action) {
}
@Override
public boolean canImport(JComponent c, DataFlavor[] flavors) {
for (DataFlavor flavor : flavors) {
if (DataFlavor.stringFlavor.equals(flavor)) {
return true;
}
}
return false;
}
@Override
public boolean importData(JComponent c, Transferable t) {
if (!canImport(c, t.getTransferDataFlavors())) {
return false;
}
try {
source = (String) t.getTransferData(DataFlavor.stringFlavor);
if (source.startsWith("ResourcesTree")) {
int insertion = docTable.getSelectedRow();
List<Document> documents = new ArrayList<Document>();
source = source.replaceFirst("^ResourcesTree\\[", "");
source = source.replaceFirst("\\]$", "");
final String[] documentsNames = source.split(", ");
List<Resource> loadedDocuments;
try {
loadedDocuments = Gate.getCreoleRegister().getAllInstances("gate.Document");
} catch (GateException e) {
e.printStackTrace();
return false;
}
// get the list of documents selected when dragging started
for (String documentName : documentsNames) {
for (Resource loadedDocument : loadedDocuments) {
if (loadedDocument.getName().equals(documentName) && !corpus.contains(loadedDocument)) {
documents.add((Document) loadedDocument);
}
}
}
// add the documents at the insertion point
for (Document document : documents) {
if (insertion != -1) {
corpus.add(docTable.rowViewToModel(insertion), document);
if (insertion == docTable.getRowCount()) {
insertion++;
}
} else {
corpus.add(document);
}
}
// select the moved/already existing documents
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
docTable.clearSelection();
for (String documentName : documentsNames) {
for (int row = 0; row < docTable.getRowCount(); row++) {
if (docTable.getValueAt(row, docTable.convertColumnIndexToView(1)).equals(documentName)) {
docTable.addRowSelectionInterval(row, row);
}
}
}
}
});
changeMessage();
return true;
} else if (source.startsWith("CorpusEditor")) {
int insertion = docTable.getSelectedRow();
int initialInsertion = insertion;
List<Document> documents = new ArrayList<Document>();
source = source.replaceFirst("^CorpusEditor\\[", "");
source = source.replaceFirst("\\]$", "");
String[] selectedRows = source.split(", ");
if (Integer.parseInt(selectedRows[0]) < insertion) {
insertion++;
}
// get the list of documents selected when dragging started
for (String row : selectedRows) {
if (Integer.parseInt(row) == initialInsertion) {
// the user dragged the selected rows on themselves, do nothing
return false;
}
documents.add(corpus.get(docTable.rowViewToModel(Integer.parseInt(row))));
if (Integer.parseInt(row) < initialInsertion) {
insertion--;
}
}
// remove the documents selected when dragging started
for (Document document : documents) {
corpus.remove(document);
}
// add the documents at the insertion point
for (Document document : documents) {
corpus.add(docTable.rowViewToModel(insertion), document);
insertion++;
}
// select the moved documents
docTable.addRowSelectionInterval(insertion - selectedRows.length, insertion - 1);
return true;
} else {
return false;
}
} catch (UnsupportedFlavorException ufe) {
return false;
} catch (IOException ioe) {
return false;
}
}
});
JScrollPane scroller = new JScrollPane(docTable);
scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scroller.getViewport().setBackground(docTable.getBackground());
add(scroller, BorderLayout.CENTER);
toolbar = new JToolBar();
toolbar.setFloatable(false);
toolbar.add(newDocumentAction = new NewDocumentAction());
toolbar.add(removeDocumentsAction = new RemoveDocumentsAction());
toolbar.addSeparator();
toolbar.add(moveUpAction = new MoveUpAction());
toolbar.add(moveDownAction = new MoveDownAction());
toolbar.addSeparator();
toolbar.add(openDocumentsAction = new OpenDocumentsAction());
removeDocumentsAction.setEnabled(false);
moveUpAction.setEnabled(false);
moveDownAction.setEnabled(false);
openDocumentsAction.setEnabled(false);
JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(toolbar, BorderLayout.NORTH);
messageLabel = new JLabel();
changeMessage();
topPanel.add(messageLabel, BorderLayout.SOUTH);
add(topPanel, BorderLayout.NORTH);
}
use of gate.swing.XJTable in project gate-core by GateNLP.
the class SerialControllerEditor method initGuiComponents.
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void initGuiComponents() {
// we use a JSplitPane for most of the content, and add the Run button to
// the South area
setLayout(new BorderLayout());
JPanel topSplit = new JPanel();
topSplit.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.BOTH;
constraints.gridy = 0;
loadedPRsTableModel = new LoadedPRsTableModel();
loadedPRsTable = new XJTable();
loadedPRsTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
loadedPRsTable.setSortable(false);
loadedPRsTable.setModel(loadedPRsTableModel);
loadedPRsTable.setDragEnabled(true);
loadedPRsTable.setDefaultRenderer(ProcessingResource.class, new ResourceRenderer());
// create a renderer that doesn't mind being extended horizontally.
loadedPRsTable.setDefaultRenderer(String.class, new DefaultTableCellRenderer() {
@Override
public Dimension getMaximumSize() {
// we don't mind being extended horizontally
Dimension dim = super.getMaximumSize();
if (dim != null) {
dim.width = Integer.MAX_VALUE;
setMaximumSize(dim);
}
return dim;
}
@Override
public Dimension getMinimumSize() {
// we don't like being squashed!
return getPreferredSize();
}
});
final int width1 = new JLabel("Loaded Processing resources").getPreferredSize().width + 30;
JScrollPane scroller = new JScrollPane() {
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = Math.max(dim.width, width1);
return dim;
}
@Override
public Dimension getMinimumSize() {
Dimension dim = super.getMinimumSize();
dim.width = Math.max(dim.width, width1);
return dim;
}
};
scroller.getViewport().setView(loadedPRsTable);
scroller.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " Loaded Processing resources "));
// adding a scrollable table
constraints.weightx = 1;
constraints.weighty = 1;
constraints.insets = new Insets(0, 0, 0, 5);
topSplit.add(scroller, constraints);
addButton = new JButton(addPRAction);
addButton.setText("");
addButton.setEnabled(false);
removeButton = new JButton(removePRAction);
removeButton.setText("");
removeButton.setEnabled(false);
Box buttonsBox = Box.createVerticalBox();
buttonsBox.add(Box.createVerticalGlue());
buttonsBox.add(addButton);
buttonsBox.add(Box.createVerticalStrut(5));
buttonsBox.add(removeButton);
buttonsBox.add(Box.createVerticalGlue());
constraints.weightx = 0;
constraints.weighty = 0;
constraints.insets = new Insets(0, 0, 0, 5);
topSplit.add(buttonsBox, constraints);
memberPRsTableModel = new MemberPRsTableModel();
memberPRsTable = new XJTable();
memberPRsTable.setSortable(false);
memberPRsTable.setModel(memberPRsTableModel);
memberPRsTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
memberPRsTable.setDefaultRenderer(ProcessingResource.class, new ResourceRenderer());
memberPRsTable.setDefaultRenderer(String.class, new DefaultTableCellRenderer() {
@Override
public Dimension getMaximumSize() {
// we don't mind being extended horizontally
Dimension dim = super.getMaximumSize();
if (dim != null) {
dim.width = Integer.MAX_VALUE;
setMaximumSize(dim);
}
return dim;
}
@Override
public Dimension getMinimumSize() {
// we don't like being squashed!
return getPreferredSize();
}
});
memberPRsTable.setDefaultRenderer(Icon.class, new IconRenderer());
memberPRsTable.setDragEnabled(true);
final int width2 = new JLabel("Selected Processing resources").getPreferredSize().width + 30;
scroller = new JScrollPane() {
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = Math.max(dim.width, width2);
return dim;
}
@Override
public Dimension getMinimumSize() {
Dimension dim = super.getMinimumSize();
dim.width = Math.max(dim.width, width2);
return dim;
}
};
scroller.getViewport().setView(memberPRsTable);
scroller.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " Selected Processing resources "));
// adding a scrollable table
constraints.weightx = 1;
constraints.weighty = 1;
constraints.insets = new Insets(0, 0, 0, 5);
topSplit.add(scroller, constraints);
moveUpButton = new JButton(MainFrame.getIcon("up"));
moveUpButton.setMnemonic(KeyEvent.VK_UP);
moveUpButton.setToolTipText("Move the selected resources up.");
moveUpButton.setEnabled(false);
moveDownButton = new JButton(MainFrame.getIcon("down"));
moveDownButton.setMnemonic(KeyEvent.VK_DOWN);
moveDownButton.setToolTipText("Move the selected resources down.");
moveDownButton.setEnabled(false);
buttonsBox = Box.createVerticalBox();
buttonsBox.add(Box.createVerticalGlue());
buttonsBox.add(moveUpButton);
buttonsBox.add(Box.createVerticalStrut(5));
buttonsBox.add(moveDownButton);
buttonsBox.add(Box.createVerticalGlue());
// adding a scrollable table
constraints.weightx = 0;
constraints.weighty = 0;
constraints.insets = new Insets(0, 0, 0, 0);
topSplit.add(buttonsBox, constraints);
// =========== BOTTOM Half ===========
JPanel bottomSplit = new JPanel();
bottomSplit.setLayout(new GridBagLayout());
// first row
constraints.gridy = 0;
if (conditionalMode) {
strategyPanel = new JPanel();
strategyPanel.setLayout(new BoxLayout(strategyPanel, BoxLayout.X_AXIS));
strategyPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
runBtnGrp = new ButtonGroup();
yes_RunRBtn = new JRadioButton("Yes", true);
yes_RunRBtn.setHorizontalTextPosition(AbstractButton.LEFT);
runBtnGrp.add(yes_RunRBtn);
no_RunRBtn = new JRadioButton("No", false);
no_RunRBtn.setHorizontalTextPosition(AbstractButton.LEFT);
runBtnGrp.add(no_RunRBtn);
conditional_RunRBtn = new JRadioButton("If value of feature", false);
conditional_RunRBtn.setHorizontalTextPosition(AbstractButton.LEFT);
runBtnGrp.add(conditional_RunRBtn);
featureNameTextField = new JTextField("", 25);
featureNameTextField.setMaximumSize(new Dimension(Integer.MAX_VALUE, featureNameTextField.getPreferredSize().height));
featureValueTextField = new JTextField("", 25);
featureValueTextField.setMaximumSize(new Dimension(Integer.MAX_VALUE, featureValueTextField.getPreferredSize().height));
strategyPanel.add(new JLabel(MainFrame.getIcon("greenBall")));
strategyPanel.add(yes_RunRBtn);
strategyPanel.add(Box.createHorizontalStrut(5));
strategyPanel.add(new JLabel(MainFrame.getIcon("redBall")));
strategyPanel.add(no_RunRBtn);
strategyPanel.add(Box.createHorizontalStrut(5));
strategyPanel.add(new JLabel(MainFrame.getIcon("yellowBall")));
strategyPanel.add(conditional_RunRBtn);
strategyPanel.add(Box.createHorizontalStrut(5));
strategyPanel.add(featureNameTextField);
strategyPanel.add(Box.createHorizontalStrut(5));
strategyPanel.add(new JLabel("is"));
strategyPanel.add(Box.createHorizontalStrut(5));
strategyPanel.add(featureValueTextField);
strategyPanel.add(Box.createHorizontalStrut(5));
strategyBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " No processing resource selected... ");
strategyPanel.setBorder(strategyBorder);
constraints.weightx = 1;
constraints.weighty = 0;
constraints.insets = new Insets(0, 0, 0, 0);
bottomSplit.add(strategyPanel, constraints);
constraints.gridy++;
}
if (corpusControllerMode) {
// we need to add the corpus combo
corpusCombo = new JComboBox(corpusComboModel = new CorporaComboModel());
corpusCombo.setRenderer(new ResourceRenderer());
corpusCombo.setMaximumSize(new Dimension(Integer.MAX_VALUE, corpusCombo.getPreferredSize().height));
Corpus corpus = null;
if (controller instanceof CorpusController) {
corpus = ((CorpusController) controller).getCorpus();
} else {
throw new GateRuntimeException("Controller editor in corpus " + "controller mode " + "but the target controller is not an " + "CorpusController!");
}
if (corpus != null) {
corpusCombo.setSelectedItem(corpus);
} else {
if (corpusCombo.getModel().getSize() > 1)
corpusCombo.setSelectedIndex(1);
else
corpusCombo.setSelectedIndex(0);
}
JPanel horBox = new JPanel();
horBox.setLayout(new BoxLayout(horBox, BoxLayout.X_AXIS));
horBox.setAlignmentX(Component.LEFT_ALIGNMENT);
horBox.add(new JLabel("Corpus:"));
horBox.add(Box.createHorizontalStrut(5));
horBox.add(corpusCombo);
horBox.add(Box.createHorizontalStrut(5));
constraints.weightx = 1;
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.BOTH;
constraints.weighty = 0;
constraints.insets = new Insets(0, 0, 0, 0);
bottomSplit.add(horBox, constraints);
// all the following rows have one element only
constraints.gridwidth = 1;
constraints.gridy++;
}
// if(corpusControllerMode)
parametersPanel = new JPanel();
parametersPanel.setLayout(new BoxLayout(parametersPanel, BoxLayout.Y_AXIS));
parametersPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
parametersBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " No selected processing resource ");
parametersPanel.setBorder(parametersBorder);
parametersEditor = new ResourceParametersEditor();
parametersEditor.init(null, null);
parametersPanel.add(new JScrollPane(parametersEditor));
// parametersPanel.add(parametersEditor, constraints);
constraints.weighty = 1;
constraints.weightx = 1;
constraints.anchor = GridBagConstraints.CENTER;
constraints.fill = GridBagConstraints.BOTH;
constraints.insets = new Insets(0, 0, 0, 0);
bottomSplit.add(parametersPanel, constraints);
constraints.gridy++;
constraints.weightx = 0;
constraints.weighty = 0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.CENTER;
bottomSplit.add(new JButton(runAction), constraints);
final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topSplit, bottomSplit);
splitPane.addAncestorListener(new AncestorListener() {
@Override
public void ancestorRemoved(AncestorEvent event) {
}
@Override
public void ancestorMoved(AncestorEvent event) {
}
/**
* One-shot ancestor listener that places the divider location on first
* show, and then de-registers self.
*/
@Override
public void ancestorAdded(AncestorEvent event) {
// This seems to work more reliably if queued rather than executed
// directly.
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
splitPane.setDividerLocation(0.5);
}
});
splitPane.removeAncestorListener(this);
}
});
add(splitPane, BorderLayout.CENTER);
}
use of gate.swing.XJTable in project gate-core by GateNLP.
the class AnnotationSetsView method initGUI.
@Override
protected void initGUI() {
// get a pointer to the textual view used for highlights
Iterator<DocumentView> centralViewsIter = owner.getCentralViews().iterator();
while (textView == null && centralViewsIter.hasNext()) {
DocumentView aView = centralViewsIter.next();
if (aView instanceof TextualDocumentView)
textView = (TextualDocumentView) aView;
}
textPane = (JTextArea) ((JScrollPane) textView.getGUI()).getViewport().getView();
// get a pointer to the list view
Iterator<DocumentView> horizontalViewsIter = owner.getHorizontalViews().iterator();
while (listView == null && horizontalViewsIter.hasNext()) {
DocumentView aView = horizontalViewsIter.next();
if (aView instanceof AnnotationListView)
listView = (AnnotationListView) aView;
}
// get a pointer to the stack view
horizontalViewsIter = owner.getHorizontalViews().iterator();
while (stackView == null && horizontalViewsIter.hasNext()) {
DocumentView aView = horizontalViewsIter.next();
if (aView instanceof AnnotationStackView)
stackView = (AnnotationStackView) aView;
}
mainTable = new XJTable();
tableModel = new SetsTableModel();
mainTable.setSortable(false);
mainTable.setModel(tableModel);
mainTable.setRowMargin(0);
mainTable.getColumnModel().setColumnMargin(0);
SetsTableCellRenderer cellRenderer = new SetsTableCellRenderer();
mainTable.getColumnModel().getColumn(NAME_COL).setCellRenderer(cellRenderer);
mainTable.getColumnModel().getColumn(SELECTED_COL).setCellRenderer(cellRenderer);
SetsTableCellEditor cellEditor = new SetsTableCellEditor();
mainTable.getColumnModel().getColumn(SELECTED_COL).setCellEditor(cellEditor);
mainTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
mainTable.setColumnSelectionAllowed(false);
mainTable.setRowSelectionAllowed(true);
mainTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
// block autocreation of new columns from now on
mainTable.setAutoCreateColumnsFromModel(false);
mainTable.setTableHeader(null);
mainTable.setShowGrid(false);
mainTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
// the background colour seems to change somewhere when using the GTK+
// look and feel on Linux, so we copy the value now and set it
Color tableBG = mainTable.getBackground();
// make a copy of the value (as the reference gets changed somewhere)
tableBG = new Color(tableBG.getRGB());
mainTable.setBackground(tableBG);
scroller = new JScrollPane(mainTable);
scroller.getViewport().setOpaque(true);
scroller.getViewport().setBackground(tableBG);
try {
annotationEditor = createAnnotationEditor(textView, this);
} catch (ResourceInstantiationException e) {
// this should not really happen
throw new GateRuntimeException("Could not initialise the annotation editor!", e);
}
mainPanel = new JPanel();
mainPanel.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridy = 0;
constraints.gridx = GridBagConstraints.RELATIVE;
constraints.gridwidth = 2;
constraints.weighty = 1;
constraints.weightx = 1;
constraints.fill = GridBagConstraints.BOTH;
mainPanel.add(scroller, constraints);
constraints.gridy = 1;
constraints.gridwidth = 1;
constraints.weighty = 0;
newSetNameTextField = new JTextField();
mainPanel.add(newSetNameTextField, constraints);
constraints.weightx = 0;
newSetAction = new NewAnnotationSetAction();
mainPanel.add(new JButton(newSetAction), constraints);
populateUI();
tableModel.fireTableDataChanged();
eventMinder.start();
initListeners();
}
use of gate.swing.XJTable in project gate-core by GateNLP.
the class CorpusAnnotationDiff method init.
/**
* This method does the diff, Precision,Recall,FalsePositive
* calculation and so on.
*/
@Override
public Resource init() throws ResourceInstantiationException {
colors[DEFAULT_TYPE] = WHITE;
colors[CORRECT_TYPE] = GREEN;
colors[SPURIOUS_TYPE] = RED;
colors[PARTIALLY_CORRECT_TYPE] = BLUE;
colors[MISSING_TYPE] = YELLOW;
// Initialize the partially sets...
keyPartiallySet = new HashSet<Annotation>();
responsePartiallySet = new HashSet<Annotation>();
// Do the diff, P&R calculation and so on
AnnotationSet keyAnnotSet = null;
AnnotationSet responseAnnotSet = null;
if (annotationSchema == null)
throw new ResourceInstantiationException("No annotation schema defined !");
if (keyCorpus == null || 0 == keyCorpus.size())
throw new ResourceInstantiationException("No key corpus or empty defined !");
if (responseCorpus == null || 0 == responseCorpus.size())
throw new ResourceInstantiationException("No response corpus or empty defined !");
// init counters and do difference for documents by pairs
for (int type = 0; type < MAX_TYPES; type++) typeCounter[type] = 0;
diffSet = new HashSet<DiffSetElement>();
for (int i = 0; i < keyCorpus.size(); ++i) {
keyDocument = keyCorpus.get(i);
// find corresponding responce document if any
Document doc;
responseDocument = null;
for (int j = 0; j < responseCorpus.size(); ++j) {
doc = responseCorpus.get(j);
if (0 == doc.getName().compareTo(keyDocument.getName()) || 0 == doc.getSourceUrl().getFile().compareTo(keyDocument.getSourceUrl().getFile())) {
responseDocument = doc;
// response corpus loop
break;
}
// if
}
if (null == responseDocument) {
Out.prln("There is no mach in responce corpus for document '" + keyDocument.getName() + "' from key corpus");
// key corpus loop
continue;
}
if (keyAnnotationSetName == null) {
// Get the default key AnnotationSet from the keyDocument
keyAnnotSet = keyDocument.getAnnotations().get(annotationSchema.getAnnotationName());
} else {
keyAnnotSet = keyDocument.getAnnotations(keyAnnotationSetName).get(annotationSchema.getAnnotationName());
}
if (keyAnnotSet == null)
// The diff will run with an empty set.All annotations from response
// would be spurious.
keyAnnotList = new LinkedList<Annotation>();
else
// The alghoritm will modify this annotation set. It is better to make a
// separate copy of them.
keyAnnotList = new LinkedList<Annotation>(keyAnnotSet);
if (responseAnnotationSetName == null)
// Get the response AnnotationSet from the default set
responseAnnotSet = responseDocument.getAnnotations().get(annotationSchema.getAnnotationName());
else
responseAnnotSet = responseDocument.getAnnotations(responseAnnotationSetName).get(annotationSchema.getAnnotationName());
if (responseAnnotSet == null)
// The diff will run with an empty set.All annotations from key
// would be missing.
responseAnnotList = new LinkedList<Annotation>();
else
// The alghoritm will modify this annotation set. It is better to make a
// separate copy of them.
responseAnnotList = new LinkedList<Annotation>(responseAnnotSet);
// Sort them ascending on Start offset (the comparator does that)
AnnotationSetComparator asComparator = new AnnotationSetComparator();
Collections.sort(keyAnnotList, asComparator);
Collections.sort(responseAnnotList, asComparator);
// Calculate the diff Set. This set will be used later with graphic
// visualisation.
doDiff(keyAnnotList, responseAnnotList);
}
// If it runs under text mode just stop here.
if (textMode)
return this;
// Show it
// Configuring the formatter object. It will be used later to format
// precision and recall
formatter.setMaximumIntegerDigits(1);
formatter.setMinimumFractionDigits(4);
formatter.setMinimumFractionDigits(4);
// Create an Annotation diff table model
AnnotationDiffTableModel diffModel = new AnnotationDiffTableModel(diffSet);
// Create a XJTable based on this model
diffTable = new XJTable(diffModel);
diffTable.setAlignmentX(Component.LEFT_ALIGNMENT);
// Set the cell renderer for this table.
AnnotationDiffCellRenderer cellRenderer = new AnnotationDiffCellRenderer();
diffTable.setDefaultRenderer(java.lang.String.class, cellRenderer);
diffTable.setDefaultRenderer(java.lang.Long.class, cellRenderer);
// Put the table into a JScroll
// Arange all components on a this JPanel
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
arangeAllComponents();
}
});
if (DEBUG)
printStructure(diffSet);
return this;
}
use of gate.swing.XJTable in project gate-core by GateNLP.
the class LuceneDataStoreSearchGUI method initGui.
/**
* Initialize the GUI.
*/
protected void initGui() {
// see the global layout schema at the end
setLayout(new BorderLayout());
stringCollator = java.text.Collator.getInstance();
stringCollator.setStrength(java.text.Collator.TERTIARY);
Comparator<String> lastWordComparator = new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
if (o1 == null || o2 == null) {
return 0;
}
return stringCollator.compare(o1.substring(o1.trim().lastIndexOf(' ') + 1), o2.substring(o2.trim().lastIndexOf(' ') + 1));
}
};
integerComparator = new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
if (o1 == null || o2 == null) {
return 0;
}
return o1.compareTo(o2);
}
};
/**
********************************
* Stack view configuration frame *
*********************************
*/
configureStackViewFrame = new ConfigureStackViewFrame("Stack view configuration");
configureStackViewFrame.setIconImage(((ImageIcon) MainFrame.getIcon("WindowNew")).getImage());
configureStackViewFrame.setLocationRelativeTo(LuceneDataStoreSearchGUI.this);
configureStackViewFrame.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("ESCAPE"), "close row manager");
configureStackViewFrame.getRootPane().getActionMap().put("close row manager", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
configureStackViewFrame.setVisible(false);
}
});
configureStackViewFrame.validate();
configureStackViewFrame.setSize(200, 300);
configureStackViewFrame.pack();
// called when Gate is exited, in case the user doesn't close the
// datastore
MainFrame.getInstance().addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
// no parent so need to be disposed explicitly
configureStackViewFrame.dispose();
}
});
/**
***********
* Top panel *
************
*/
JPanel topPanel = new JPanel(new GridBagLayout());
topPanel.setOpaque(false);
topPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 3));
GridBagConstraints gbc = new GridBagConstraints();
// first column, three rows span
queryTextArea = new QueryTextArea();
queryTextArea.setToolTipText("<html>Enter a query to search the datastore." + "<br><small>'{' or '.' activate auto-completion." + "<br>Ctrl+Enter add a new line.</small></html>");
queryTextArea.setLineWrap(true);
gbc.gridheight = 3;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(0, 0, 0, 4);
topPanel.add(new JScrollPane(queryTextArea), gbc);
gbc.gridheight = 1;
gbc.weightx = 0;
gbc.weighty = 0;
gbc.insets = new Insets(0, 0, 0, 0);
// second column, first row
gbc.gridx = GridBagConstraints.RELATIVE;
topPanel.add(new JLabel("Corpus: "), gbc);
corpusToSearchIn = new JComboBox<String>();
corpusToSearchIn.addItem(Constants.ENTIRE_DATASTORE);
corpusToSearchIn.setPrototypeDisplayValue(Constants.ENTIRE_DATASTORE);
corpusToSearchIn.setToolTipText("Select the corpus to search in.");
if (target == null || target instanceof Searcher) {
corpusToSearchIn.setEnabled(false);
}
corpusToSearchIn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ie) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
updateAnnotationSetsList();
}
});
}
});
topPanel.add(corpusToSearchIn, gbc);
topPanel.add(Box.createHorizontalStrut(4), gbc);
topPanel.add(new JLabel("Annotation set: "), gbc);
annotationSetsToSearchIn = new JComboBox<String>();
annotationSetsToSearchIn.setPrototypeDisplayValue(Constants.COMBINED_SET);
annotationSetsToSearchIn.setToolTipText("Select the annotation set to search in.");
annotationSetsToSearchIn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ie) {
updateAnnotationTypesList();
}
});
topPanel.add(annotationSetsToSearchIn, gbc);
// refresh button
topPanel.add(Box.createHorizontalStrut(4), gbc);
RefreshAnnotationSetsAndFeaturesAction refreshAction = new RefreshAnnotationSetsAndFeaturesAction();
JButton refreshTF = new ButtonBorder(new Color(240, 240, 240), new Insets(4, 2, 4, 3), false);
refreshTF.setAction(refreshAction);
topPanel.add(refreshTF, gbc);
// second column, second row
gbc.gridy = 1;
JLabel noOfResultsLabel = new JLabel("Results: ");
topPanel.add(noOfResultsLabel, gbc);
numberOfResultsSlider = new JSlider(1, 1100, 50);
numberOfResultsSlider.setToolTipText("50 results per page");
numberOfResultsSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (numberOfResultsSlider.getValue() > (numberOfResultsSlider.getMaximum() - 100)) {
numberOfResultsSlider.setToolTipText("Retrieve all results.");
nextResults.setText("Retrieve all results.");
nextResultsAction.setEnabled(false);
} else {
numberOfResultsSlider.setToolTipText("Retrieve " + numberOfResultsSlider.getValue() + " results per page.");
nextResults.setText("Next page of " + numberOfResultsSlider.getValue() + " results");
if (searcher.getHits().length == noOfResults) {
nextResultsAction.setEnabled(true);
}
}
// show the tooltip each time the value change
ToolTipManager.sharedInstance().mouseMoved(new MouseEvent(numberOfResultsSlider, MouseEvent.MOUSE_MOVED, 0, 0, 0, 0, 0, false));
}
});
// always show the tooltip for this component
numberOfResultsSlider.addMouseListener(new MouseAdapter() {
ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
int initialDelay, reshowDelay, dismissDelay;
boolean enabled;
@Override
public void mouseEntered(MouseEvent e) {
initialDelay = toolTipManager.getInitialDelay();
reshowDelay = toolTipManager.getReshowDelay();
dismissDelay = toolTipManager.getDismissDelay();
enabled = toolTipManager.isEnabled();
toolTipManager.setInitialDelay(0);
toolTipManager.setReshowDelay(0);
toolTipManager.setDismissDelay(Integer.MAX_VALUE);
toolTipManager.setEnabled(true);
}
@Override
public void mouseExited(MouseEvent e) {
toolTipManager.setInitialDelay(initialDelay);
toolTipManager.setReshowDelay(reshowDelay);
toolTipManager.setDismissDelay(dismissDelay);
toolTipManager.setEnabled(enabled);
}
});
gbc.insets = new Insets(5, 0, 0, 0);
topPanel.add(numberOfResultsSlider, gbc);
gbc.insets = new Insets(0, 0, 0, 0);
topPanel.add(Box.createHorizontalStrut(4), gbc);
JLabel contextWindowLabel = new JLabel("Context size: ");
topPanel.add(contextWindowLabel, gbc);
contextSizeSlider = new JSlider(1, 50, 5);
contextSizeSlider.setToolTipText("Display 5 tokens of context in the results.");
contextSizeSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
contextSizeSlider.setToolTipText("Display " + contextSizeSlider.getValue() + " tokens of context in the results.");
ToolTipManager.sharedInstance().mouseMoved(new MouseEvent(contextSizeSlider, MouseEvent.MOUSE_MOVED, 0, 0, 0, 0, 0, false));
}
});
// always show the tooltip for this component
contextSizeSlider.addMouseListener(new MouseAdapter() {
ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
int initialDelay, reshowDelay, dismissDelay;
boolean enabled;
@Override
public void mouseEntered(MouseEvent e) {
initialDelay = toolTipManager.getInitialDelay();
reshowDelay = toolTipManager.getReshowDelay();
dismissDelay = toolTipManager.getDismissDelay();
enabled = toolTipManager.isEnabled();
toolTipManager.setInitialDelay(0);
toolTipManager.setReshowDelay(0);
toolTipManager.setDismissDelay(Integer.MAX_VALUE);
toolTipManager.setEnabled(true);
}
@Override
public void mouseExited(MouseEvent e) {
toolTipManager.setInitialDelay(initialDelay);
toolTipManager.setReshowDelay(reshowDelay);
toolTipManager.setDismissDelay(dismissDelay);
toolTipManager.setEnabled(enabled);
}
});
gbc.insets = new Insets(5, 0, 0, 0);
topPanel.add(contextSizeSlider, gbc);
gbc.insets = new Insets(0, 0, 0, 0);
// second column, third row
gbc.gridy = 2;
JPanel panel = new JPanel();
panel.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0)));
executeQueryAction = new ExecuteQueryAction();
JButton executeQuery = new ButtonBorder(new Color(240, 240, 240), new Insets(0, 2, 0, 3), false);
executeQuery.setAction(executeQueryAction);
panel.add(executeQuery);
ClearQueryAction clearQueryAction = new ClearQueryAction();
JButton clearQueryTF = new ButtonBorder(new Color(240, 240, 240), new Insets(4, 2, 4, 3), false);
clearQueryTF.setAction(clearQueryAction);
panel.add(Box.createHorizontalStrut(5));
panel.add(clearQueryTF);
nextResultsAction = new NextResultsAction();
nextResultsAction.setEnabled(false);
nextResults = new ButtonBorder(new Color(240, 240, 240), new Insets(0, 0, 0, 3), false);
nextResults.setAction(nextResultsAction);
panel.add(Box.createHorizontalStrut(5));
panel.add(nextResults);
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.WEST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
topPanel.add(panel, gbc);
// will be added to the GUI via a split panel
/**
**************
* Center panel *
***************
*/
// these components will be used in updateStackView()
centerPanel = new AnnotationStack(150, 30);
configureStackViewButton = new ButtonBorder(new Color(250, 250, 250), new Insets(0, 0, 0, 3), true);
configureStackViewButton.setHorizontalAlignment(SwingConstants.LEFT);
configureStackViewButton.setAction(new ConfigureStackViewAction());
// will be added to the GUI via a split panel
/**
*******************
* Bottom left panel *
********************
*/
JPanel bottomLeftPanel = new JPanel(new GridBagLayout());
bottomLeftPanel.setOpaque(false);
gbc = new GridBagConstraints();
// title of the table, results options, export and next results
// button
gbc.gridy = 0;
panel = new JPanel();
panel.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0)));
titleResults = new JLabel("Results");
titleResults.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0)));
panel.add(titleResults);
panel.add(Box.createHorizontalStrut(5), gbc);
exportResultsAction = new ExportResultsAction();
exportResultsAction.setEnabled(false);
JButton exportToHTML = new ButtonBorder(new Color(240, 240, 240), new Insets(0, 0, 0, 3), false);
exportToHTML.setAction(exportResultsAction);
panel.add(exportToHTML, gbc);
bottomLeftPanel.add(panel, gbc);
// table of results
resultTableModel = new ResultTableModel();
resultTable = new XJTable(resultTableModel);
resultTable.setDefaultRenderer(String.class, new ResultTableCellRenderer());
resultTable.setEnableHidingColumns(true);
resultTable.addMouseListener(new MouseAdapter() {
private JPopupMenu mousePopup;
JMenuItem menuItem;
@Override
public void mousePressed(MouseEvent e) {
int row = resultTable.rowAtPoint(e.getPoint());
if (e.isPopupTrigger() && !resultTable.isRowSelected(row)) {
// if right click outside the selection then reset selection
resultTable.getSelectionModel().setSelectionInterval(row, row);
}
if (e.isPopupTrigger()) {
createPopup();
mousePopup.show(e.getComponent(), e.getX(), e.getY());
}
}
@Override
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
createPopup();
mousePopup.show(e.getComponent(), e.getX(), e.getY());
}
}
private void createPopup() {
mousePopup = new JPopupMenu();
menuItem = new JMenuItem("Remove the selected result" + (resultTable.getSelectedRowCount() > 1 ? "s" : ""));
mousePopup.add(menuItem);
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
int[] rows = resultTable.getSelectedRows();
for (int i = 0; i < rows.length; i++) {
rows[i] = resultTable.rowViewToModel(rows[i]);
}
Arrays.sort(rows);
for (int i = rows.length - 1; i >= 0; i--) {
results.remove(rows[i]);
}
resultTable.clearSelection();
resultTableModel.fireTableDataChanged();
mousePopup.setVisible(false);
}
});
if (target instanceof LuceneDataStoreImpl && SwingUtilities.getRoot(LuceneDataStoreSearchGUI.this) instanceof MainFrame) {
menuItem = new JMenuItem("Open the selected document" + (resultTable.getSelectedRowCount() > 1 ? "s" : ""));
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
Set<Pattern> patterns = new HashSet<Pattern>();
Set<String> documentIds = new HashSet<String>();
for (int rowView : resultTable.getSelectedRows()) {
// create and display the document for this result
int rowModel = resultTable.rowViewToModel(rowView);
Pattern pattern = (Pattern) results.get(rowModel);
if (!documentIds.contains(pattern.getDocumentID())) {
patterns.add(pattern);
documentIds.add(pattern.getDocumentID());
}
}
if (patterns.size() > 10) {
Object[] possibleValues = { "Open the " + patterns.size() + " documents", "Don't open" };
int selectedValue = JOptionPane.showOptionDialog(LuceneDataStoreSearchGUI.this, "Do you want to open " + patterns.size() + " documents in the central tabbed pane ?", "Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, possibleValues, possibleValues[1]);
if (selectedValue == 1 || selectedValue == JOptionPane.CLOSED_OPTION) {
return;
}
}
for (final Pattern pattern : patterns) {
// create and display the document for this result
FeatureMap features = Factory.newFeatureMap();
features.put(DataStore.DATASTORE_FEATURE_NAME, target);
features.put(DataStore.LR_ID_FEATURE_NAME, pattern.getDocumentID());
final Document doc;
try {
doc = (Document) Factory.createResource("gate.corpora.DocumentImpl", features);
} catch (gate.util.GateException e) {
e.printStackTrace();
return;
}
// show the expression in the document
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
MainFrame.getInstance().select(doc);
}
});
if (patterns.size() == 1) {
// wait some time for the document to be displayed
Date timeToRun = new Date(System.currentTimeMillis() + 2000);
Timer timer = new Timer("Annic show document timer", true);
timer.schedule(new TimerTask() {
@Override
public void run() {
showResultInDocument(doc, pattern);
}
}, timeToRun);
}
}
}
});
mousePopup.add(menuItem);
}
}
});
// resultTable.addMouseListener
// when selection change in the result table
// update the stack view and export button
resultTable.getSelectionModel().addListSelectionListener(new javax.swing.event.ListSelectionListener() {
@Override
public void valueChanged(javax.swing.event.ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
updateStackView();
}
}
});
resultTable.setColumnSelectionAllowed(false);
resultTable.setRowSelectionAllowed(true);
resultTable.setSortable(true);
resultTable.setComparator(ResultTableModel.LEFT_CONTEXT_COLUMN, lastWordComparator);
resultTable.setComparator(ResultTableModel.RESULT_COLUMN, stringCollator);
resultTable.setComparator(ResultTableModel.RIGHT_CONTEXT_COLUMN, stringCollator);
JScrollPane tableScrollPane = new JScrollPane(resultTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.NORTH;
gbc.gridy = 1;
gbc.gridx = 0;
gbc.insets = new Insets(0, 0, 0, 0);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = GridBagConstraints.REMAINDER;
gbc.weightx = 1;
gbc.weighty = 1;
bottomLeftPanel.add(tableScrollPane, gbc);
/**
************************
* Statistics tabbed pane *
*************************
*/
statisticsTabbedPane = new JTabbedPane();
globalStatisticsTable = new XJTable() {
@Override
public boolean isCellEditable(int rowIndex, int vColIndex) {
return false;
}
};
globalStatisticsTableModel = new DefaultTableModel(new Object[] { "Annotation Type", "Count" }, 0);
globalStatisticsTable.setModel(globalStatisticsTableModel);
globalStatisticsTable.setComparator(0, stringCollator);
globalStatisticsTable.setComparator(1, integerComparator);
globalStatisticsTable.setSortedColumn(1);
globalStatisticsTable.setAscending(false);
globalStatisticsTable.addMouseListener(new MouseInputAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
updateQuery();
}
}
private void updateQuery() {
int caretPosition = queryTextArea.getCaretPosition();
String query = queryTextArea.getText();
String type = (String) globalStatisticsTable.getValueAt(globalStatisticsTable.getSelectedRow(), globalStatisticsTable.convertColumnIndexToView(0));
String queryMiddle = "{" + type + "}";
String queryLeft = (queryTextArea.getSelectionStart() == queryTextArea.getSelectionEnd()) ? query.substring(0, caretPosition) : query.substring(0, queryTextArea.getSelectionStart());
String queryRight = (queryTextArea.getSelectionStart() == queryTextArea.getSelectionEnd()) ? query.substring(caretPosition, query.length()) : query.substring(queryTextArea.getSelectionEnd(), query.length());
queryTextArea.setText(queryLeft + queryMiddle + queryRight);
}
});
statisticsTabbedPane.addTab("Global", null, new JScrollPane(globalStatisticsTable), "Global statistics on the Corpus and Annotation Set selected.");
statisticsTabbedPane.addMouseListener(new MouseAdapter() {
private JPopupMenu mousePopup;
JMenuItem menuItem;
@Override
public void mousePressed(MouseEvent e) {
int tabIndex = statisticsTabbedPane.indexAtLocation(e.getX(), e.getY());
if (e.isPopupTrigger() && tabIndex > 0) {
createPopup(tabIndex);
mousePopup.show(e.getComponent(), e.getX(), e.getY());
}
}
@Override
public void mouseReleased(MouseEvent e) {
int tabIndex = statisticsTabbedPane.indexAtLocation(e.getX(), e.getY());
if (e.isPopupTrigger() && tabIndex > 0) {
createPopup(tabIndex);
mousePopup.show(e.getComponent(), e.getX(), e.getY());
}
}
private void createPopup(final int tabIndex) {
mousePopup = new JPopupMenu();
if (tabIndex == 1) {
menuItem = new JMenuItem("Clear table");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ie) {
oneRowStatisticsTableModel.setRowCount(0);
}
});
} else {
menuItem = new JMenuItem("Close tab");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ie) {
statisticsTabbedPane.remove(tabIndex);
}
});
}
mousePopup.add(menuItem);
}
});
class RemoveCellEditorRenderer extends AbstractCellEditor implements TableCellRenderer, TableCellEditor, ActionListener {
private JButton button;
public RemoveCellEditorRenderer() {
button = new JButton();
button.setHorizontalAlignment(SwingConstants.CENTER);
button.setIcon(MainFrame.getIcon("Delete"));
button.setToolTipText("Remove this row.");
button.setContentAreaFilled(false);
button.setBorderPainted(false);
button.setMargin(new Insets(0, 0, 0, 0));
button.addActionListener(this);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object color, boolean isSelected, boolean hasFocus, int row, int col) {
button.setSelected(isSelected);
return button;
}
@Override
public boolean shouldSelectCell(EventObject anEvent) {
return false;
}
@Override
public void actionPerformed(ActionEvent e) {
int editingRow = oneRowStatisticsTable.getEditingRow();
fireEditingStopped();
oneRowStatisticsTableModel.removeRow(oneRowStatisticsTable.rowViewToModel(editingRow));
}
@Override
public Object getCellEditorValue() {
return null;
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int col) {
button.setSelected(isSelected);
return button;
}
}
oneRowStatisticsTable = new XJTable() {
@Override
public boolean isCellEditable(int rowIndex, int vColIndex) {
return vColIndex == 2;
}
@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
Component c = super.prepareRenderer(renderer, row, col);
if (c instanceof JComponent && col != 2) {
// display a custom tooltip saved when adding statistics
((JComponent) c).setToolTipText("<html>" + oneRowStatisticsTableToolTips.get(rowViewToModel(row)) + "</html>");
}
return c;
}
};
oneRowStatisticsTableModel = new DefaultTableModel(new Object[] { "Annotation Type/Feature", "Count", "" }, 0);
oneRowStatisticsTable.setModel(oneRowStatisticsTableModel);
oneRowStatisticsTable.getColumnModel().getColumn(2).setCellEditor(new RemoveCellEditorRenderer());
oneRowStatisticsTable.getColumnModel().getColumn(2).setCellRenderer(new RemoveCellEditorRenderer());
oneRowStatisticsTable.setComparator(0, stringCollator);
oneRowStatisticsTable.setComparator(1, integerComparator);
statisticsTabbedPane.addTab("One item", null, new JScrollPane(oneRowStatisticsTable), "<html>One item statistics.<br>" + "Right-click on an annotation<br>" + "to add statistics here.");
oneRowStatisticsTableToolTips = new Vector<String>();
// will be added to the GUI via a split panel
/**
************************************************************
* Vertical splits between top, center panel and bottom panel *
*************************************************************
*/
/**
* ________________________________________
* | topPanel |
* |__________________3_____________________|
* | |
* | centerPanel |
* |________2________ __________2___________|
* | | |
* | bottomLeftPanel 1 statisticsTabbedPane |
* |_________________|______________________|
*
* 1 bottomSplitPane 2 centerBottomSplitPane 3 topBottomSplitPane
*/
bottomSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
Dimension minimumSize = new Dimension(0, 0);
bottomLeftPanel.setMinimumSize(minimumSize);
statisticsTabbedPane.setMinimumSize(minimumSize);
bottomSplitPane.add(bottomLeftPanel);
bottomSplitPane.add(statisticsTabbedPane);
bottomSplitPane.setOneTouchExpandable(true);
bottomSplitPane.setResizeWeight(0.75);
bottomSplitPane.setContinuousLayout(true);
JSplitPane centerBottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
centerBottomSplitPane.add(new JScrollPane(centerPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
centerBottomSplitPane.add(bottomSplitPane);
centerBottomSplitPane.setResizeWeight(0.5);
centerBottomSplitPane.setContinuousLayout(true);
JSplitPane topBottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
topBottomSplitPane.add(topPanel);
topBottomSplitPane.add(centerBottomSplitPane);
topBottomSplitPane.setContinuousLayout(true);
add(topBottomSplitPane, BorderLayout.CENTER);
}
Aggregations