use of net.sourceforge.nattable.NatTable in project translationstudio8 by heartsome.
the class HsMultiCellEditorControl method activeCell.
private static HsMultiCellEditor activeCell(ViewportLayer vLayer, XLIFFEditorImplWithNatTable xliffEditor, IConfigRegistry configRegistry, int columnIndex, int rowIndex, int rowPosition, String cellType) {
NatTable natTable = xliffEditor.getTable();
int columnPosition = vLayer.getColumnPositionByIndex(columnIndex);
LayerCell cell = natTable.getCellByPosition(columnPosition, rowPosition);
if (cell == null) {
return null;
}
Rectangle cellBounds = cell.getBounds();
List<String> configLabels = cell.getConfigLabels().getLabels();
if (!xliffEditor.isHorizontalLayout()) {
if (cellType.equals(NatTableConstant.SOURCE)) {
configLabels.remove(XLIFFEditorImplWithNatTable.TARGET_EDIT_CELL_LABEL);
} else if (cellType.equals(NatTableConstant.TARGET)) {
configLabels.remove(XLIFFEditorImplWithNatTable.SOURCE_EDIT_CELL_LABEL);
}
}
ILayer layer = cell.getLayer();
Object originalCanonicalValue = cell.getDataValue();
IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.EDIT, configLabels);
IStyle cellStyle = new CellStyleProxy(configRegistry, DisplayMode.EDIT, configLabels);
IDataValidator dataValidator = configRegistry.getConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, DisplayMode.EDIT, configLabels);
Rectangle editorBounds = layer.getLayerPainter().adjustCellBounds(new Rectangle(cellBounds.x, cellBounds.y, cellBounds.width, cellBounds.height));
int cellStartY = cellBounds.y;
int cellEndY = cellStartY + cellBounds.height;
Rectangle clientArea = natTable.getClientAreaProvider().getClientArea();
int clientAreaEndY = clientArea.y + clientArea.height;
if (cellEndY > clientAreaEndY) {
editorBounds.height = clientAreaEndY - cellStartY;
}
StyledTextCellEditor cellEditor = (StyledTextCellEditor) configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, configLabels);
ICellEditHandler editHandler = new HsMultiCellEditorHandler(cellEditor, layer);
HsMultiCellEditor hsCellEditor = new HsMultiCellEditor(cellType, cellEditor, editHandler, columnPosition, rowPosition, columnIndex, rowIndex, dataValidator, originalCanonicalValue, displayConverter, cellStyle, editorBounds);
return hsCellEditor;
}
use of net.sourceforge.nattable.NatTable in project translationstudio8 by heartsome.
the class MenuItemProviders method columnChooserMenuItemProvider.
public static IMenuItemProvider columnChooserMenuItemProvider(final String menuLabel) {
return new IMenuItemProvider() {
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem columnChooser = new MenuItem(popupMenu, SWT.PUSH);
columnChooser.setText(menuLabel);
columnChooser.setImage(GUIHelper.getImage("column_chooser"));
columnChooser.setEnabled(true);
columnChooser.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new DisplayColumnChooserCommand(natTable));
}
});
}
};
}
use of net.sourceforge.nattable.NatTable in project translationstudio8 by heartsome.
the class MenuItemProviders method clearToggleFilterRowMenuItemProvider.
public static IMenuItemProvider clearToggleFilterRowMenuItemProvider(final String menuLabel) {
return new IMenuItemProvider() {
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
menuItem.setText(menuLabel);
menuItem.setImage(GUIHelper.getImage("toggle_filter"));
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new ToggleFilterRowCommand());
}
});
}
};
}
use of net.sourceforge.nattable.NatTable in project translationstudio8 by heartsome.
the class MenuItemProviders method columnStyleEditorMenuItemProvider.
public static IMenuItemProvider columnStyleEditorMenuItemProvider(final String menuLabel) {
return new IMenuItemProvider() {
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem columnStyleEditor = new MenuItem(popupMenu, SWT.PUSH);
columnStyleEditor.setText(menuLabel);
columnStyleEditor.setImage(GUIHelper.getImage("preferences"));
columnStyleEditor.setEnabled(true);
columnStyleEditor.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int rowPosition = getNatEventData(event).getRowPosition();
int columnPosition = getNatEventData(event).getColumnPosition();
natTable.doCommand(new DisplayColumnStyleEditorCommand(natTable, natTable.getConfigRegistry(), columnPosition, rowPosition));
}
});
}
};
}
use of net.sourceforge.nattable.NatTable in project translationstudio8 by heartsome.
the class MenuItemProviders method categoriesBasedColumnChooserMenuItemProvider.
public static IMenuItemProvider categoriesBasedColumnChooserMenuItemProvider(final String menuLabel) {
return new IMenuItemProvider() {
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem columnChooser = new MenuItem(popupMenu, SWT.PUSH);
columnChooser.setText(menuLabel);
columnChooser.setImage(GUIHelper.getImage("column_categories_chooser"));
columnChooser.setEnabled(true);
columnChooser.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new ChooseColumnsFromCategoriesCommand(natTable));
}
});
}
};
}
Aggregations