use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class InputDialog method setErrorMessage.
/**
* Sets or clears the error message. If not <code>null</code>, the OK button is disabled.
* @param errorMessage
* the error message, or <code>null</code> to clear
* @since 3.0
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
if (errorMessageText != null && !errorMessageText.isDisposed()) {
String msg = errorMessageText.getText();
msg = msg == null ? "" : msg;
//$NON-NLS-1$
errorMessageText.setText(errorMessage == null ? "" : errorMessage);
// Disable the error message text control if there is no error, or
// no error text (empty or whitespace only). Hide it also to avoid
// color change.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281
boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0;
errorMessageText.setEnabled(hasError);
errorMessageText.setVisible(hasError);
errorMessageText.getParent().update();
String msg2 = errorMessageText.getText();
if (!msg.equals(msg2) && initLocation != null && initSize != null) {
Point p = getShell().computeSize(initSize.x, SWT.DEFAULT);
getShell().setBounds(getConstrainedShellBounds(new Rectangle(initLocation.x, initLocation.y, initSize.x, p.y)));
}
// Access the ok button by id, in case clients have overridden button creation.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
Control button = getButton(IDialogConstants.OK_ID);
if (button != null) {
button.setEnabled(errorMessage == null);
}
}
}
use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class HorizontalRowSelectionModel method getSelections.
public List<Rectangle> getSelections() {
List<Rectangle> selectionRectangles = new ArrayList<Rectangle>();
selectionsLock.readLock().lock();
try {
int width = selectionLayer.getColumnCount();
for (int selectedRow : selectedRows) {
if (selectedRow > -1) {
selectionRectangles.add(new Rectangle(0, selectedRow, width, 1));
}
}
} finally {
selectionsLock.readLock().unlock();
}
return selectionRectangles;
}
use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class ExportToExcelCommandHandler method setClientAreaToMaximum.
private void setClientAreaToMaximum() {
final Rectangle maxClientArea = new Rectangle(0, 0, gridLayer.getWidth(), gridLayer.getHeight());
gridLayer.setClientAreaProvider(new IClientAreaProvider() {
public Rectangle getClientArea() {
return maxClientArea;
}
});
gridLayer.doCommand(new PrintEntireGridCommand());
}
use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class NatTable method getPixelRectangleFromPositionRectangle.
protected Rectangle getPixelRectangleFromPositionRectangle(Rectangle positionRectangle) {
int positionRectWidthInPixels = 0;
int positionRectHeightInPixels = 0;
Rectangle pixelRectangle = new Rectangle(0, 0, 0, 0);
for (int i = positionRectangle.x; i < (positionRectangle.x + positionRectangle.width); i++) {
positionRectWidthInPixels += getColumnWidthByPosition(i);
}
for (int i = positionRectangle.y; i < (positionRectangle.y + positionRectangle.height); i++) {
positionRectHeightInPixels += getRowHeightByPosition(i);
}
pixelRectangle.x = getStartXOfColumnPosition(positionRectangle.x);
pixelRectangle.y = getStartYOfRowPosition(positionRectangle.y);
pixelRectangle.width = positionRectWidthInPixels;
pixelRectangle.height = positionRectHeightInPixels;
return pixelRectangle;
}
use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class NatTable method internalSetLayer.
private void internalSetLayer(ILayer layer) {
if (layer != null) {
this.underlyingLayer = layer;
underlyingLayer.setClientAreaProvider(new IClientAreaProvider() {
public Rectangle getClientArea() {
if (!isDisposed()) {
return NatTable.this.getClientArea();
} else
return new Rectangle(0, 0, 0, 0);
}
});
underlyingLayer.addLayerListener(this);
}
}
Aggregations