use of javax.swing.table.JTableHeader in project VideoOptimzer by attdevsupport.
the class CheckBoxHeader method getTableCellRendererComponent.
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (table != null) {
JTableHeader header = table.getTableHeader();
if (header != null) {
setForeground(header.getForeground());
setBackground(header.getBackground());
setFont(header.getFont());
header.addMouseListener(this);
}
}
// For enable the header check box
setColumn(column);
setHorizontalAlignment(SwingConstants.CENTER);
return this;
}
use of javax.swing.table.JTableHeader in project VideoOptimzer by attdevsupport.
the class SegmentTablePanel method getStreamTable.
private JPanel getStreamTable(String title, SortedMap<String, VideoEvent> eventList, JScrollPane tableScrollPane) {
// Do not resize columns or setPreferredWidth in this method
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
rightRenderer.setHorizontalAlignment(SwingConstants.RIGHT);
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
centerRenderer.setHorizontalAlignment(SwingConstants.CENTER);
Collection<VideoEvent> videoEventList = eventList.values();
rowCount = videoEventList.size();
TableModel tableModel = new SegmentTableModel(videoEventList, videoStream.getPlayRequestedTime() != null ? videoStream.getPlayRequestedTime() : 0.0);
JTable jTable;
jTable = new JTable(tableModel);
jTable.setName(title);
streamTables.put(title, jTable);
jTable.setGridColor(Color.LIGHT_GRAY);
for (int idx = 0; idx < jTable.getColumnCount() - 2; idx++) {
jTable.getColumnModel().getColumn(idx).setCellRenderer(rightRenderer);
}
jTable.getColumnModel().getColumn(((SegmentTableModel) tableModel).findColumn(SegmentTableModel.TRACK)).setCellRenderer(centerRenderer);
jTable.getColumnModel().getColumn(((SegmentTableModel) tableModel).findColumn(SegmentTableModel.TCP_STATE)).setCellRenderer(centerRenderer);
jTable.getColumnModel().getColumn(((SegmentTableModel) tableModel).findColumn(SegmentTableModel.CHANNELS)).setCellRenderer(centerRenderer);
jTable.getColumnModel().getColumn(((SegmentTableModel) tableModel).findColumn(SegmentTableModel.DOWNLOAD_DELAY)).setCellRenderer(centerRenderer);
jTable.getColumnModel().getColumn(((SegmentTableModel) tableModel).findColumn(SegmentTableModel.PLAYBACK_DELAY)).setCellRenderer(centerRenderer);
JTableHeader header = jTable.getTableHeader();
header.setDefaultRenderer(new MultiLineTableHeaderRenderer());
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createTitledBorder(title));
if (rowCount > tableHeight) {
tableScrollPane.setPreferredSize(new Dimension(0, MAX_HEIGHT));
} else {
int rowHeight = jTable.getRowHeight();
tblHeight = 100 + (eventList.size() * (rowHeight + 3));
tableScrollPane.setPreferredSize(new Dimension(0, tblHeight));
tableScrollPane.setSize(new Dimension(0, tblHeight));
panel.setPreferredSize(new Dimension(0, tblHeight));
panel.setMinimumSize(new Dimension(0, tblHeight));
panel.setSize(new Dimension(0, tblHeight));
}
tableScrollPane.setViewportView(jTable);
panel.setLayout(new BorderLayout());
panel.add(header, BorderLayout.NORTH);
panel.add(tableScrollPane, BorderLayout.CENTER);
// Sorter for jTable
TableRowSorter<TableModel> rowSorter = new TableRowSorter<TableModel>(jTable.getModel());
jTable.setRowSorter(rowSorter);
refreshSegmentPanel();
int colCount = rowSorter.getModel().getColumnCount();
for (int column = 0; column < colCount; column++) {
rowSorter.setComparator(column, new TableSortComparator(column, "-"));
}
jTable.addMouseListener(streamTableClickHandler(tableModel, jTable, jTable.getColumnModel().getColumnIndex("SessionLink")));
return panel;
}
use of javax.swing.table.JTableHeader in project VideoOptimzer by attdevsupport.
the class ImageComparatorDataTable method createDefaultTableHeader.
/**
* Returns a default table header for the DataTable.
*
* @return A JTableHeader object with default properties.
*/
@Override
public JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
private static final long serialVersionUID = 1L;
@Override
public String getToolTipText(MouseEvent mEvent) {
int column = columnAtPoint(mEvent.getPoint());
// Locate the renderer under the event location
if (column != -1) {
TableColumn aColumn = columnModel.getColumn(column);
Object tip = aColumn.getHeaderValue();
if (tip != null) {
return tip.toString();
}
}
return null;
}
};
}
use of javax.swing.table.JTableHeader in project VideoOptimzer by attdevsupport.
the class ImageBPTable method createDefaultTableHeader.
/**
* Returns a default table header for the DataTable.
*
* @return A JTableHeader object with default properties.
*/
@Override
public JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
private static final long serialVersionUID = 1L;
@Override
public String getToolTipText(MouseEvent mEvent) {
int column = columnAtPoint(mEvent.getPoint());
// Locate the renderer under the event location
if (column != -1) {
TableColumn aColumn = columnModel.getColumn(column);
Object tip = aColumn.getHeaderValue();
if (tip != null) {
return tip.toString();
}
}
return null;
}
};
}
use of javax.swing.table.JTableHeader in project VideoOptimzer by attdevsupport.
the class VideoRequestPanel method getRequestListPanel.
private JPanel getRequestListPanel() {
if (requestListPanel == null) {
requestListPanel = new JPanel();
requestListPanel.setLayout(new BorderLayout());
getDummyData();
requestListTable = new DataTable<HttpRequestResponseInfo>();
requestListPanel.setName(ResourceBundleHelper.getMessageString("video.tab.requests.tableName"));
DataTablePopupMenu popupMenu = (DataTablePopupMenu) requestListTable.getPopup();
popupMenu.initialize();
videoRequestTableModel.setData(requestURL);
requestListTable.setModel(videoRequestTableModel);
JTableHeader header = requestListTable.getTableHeader();
requestListTable.setGridColor(Color.LIGHT_GRAY);
int width = requestListTable.getParent() != null ? requestListTable.getParent().getWidth() : 1000;
width = requestPanel.getWidth();
requestListTable.getColumnModel().getColumn(0).setPreferredWidth(width);
requestListTable.getColumnModel().getColumn(0).setCellRenderer(new WordWrapRenderer());
requestListPanel.add(header, BorderLayout.NORTH);
requestListPanel.add(requestListTable, BorderLayout.CENTER);
requestListTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent event) {
if (event.getClickCount() == 2) {
int row = requestListTable.getSelectedRow();
HttpRequestResponseInfo request = requestURL.get(row);
requestListTable.getColumnModel().getColumn(0).setCellRenderer(new WordWrapRenderer(row));
if (ResourceBundleHelper.getMessageString("videotab.videorequest.table.url").equals(requestListTable.getColumnName(requestListTable.getSelectedColumn()))) {
RegexWizard regexWizard = RegexWizard.getInstance(aroView.getJFrame());
regexWizard.setRequest(request);
regexWizard.setVisible(true);
}
}
}
});
}
return requestListPanel;
}
Aggregations