use of org.apache.pivot.wtk.Window in project pivot by apache.
the class TerraPaletteSkin method mouseDown.
@Override
public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
boolean consumed = super.mouseDown(component, button, x, y);
Window window = (Window) getComponent();
boolean maximized = window.isMaximized();
if (button == Mouse.Button.LEFT && !maximized) {
Bounds titleBarBounds = titleBarTablePane.getBounds();
if (titleBarBounds.contains(x, y)) {
dragOffset = new Point(x, y);
Mouse.capture(component);
} else {
if (resizeHandle.isVisible() && x > resizeHandle.getX() && y > resizeHandle.getY()) {
resizeOffset = new Point(getWidth() - x, getHeight() - y);
Mouse.capture(component);
}
}
}
return consumed;
}
use of org.apache.pivot.wtk.Window in project pivot by apache.
the class TerraDialogSkin method mouseDown.
@Override
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
Dialog dialog = (Dialog) container;
if (!dialog.isTopMost()) {
Window rootOwner = dialog.getRootOwner();
rootOwner.moveToFront();
}
return super.mouseDown(container, button, x, y);
}
use of org.apache.pivot.wtk.Window in project pivot by apache.
the class TerraSheetSkin method mouseDown.
@Override
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
Sheet sheet = (Sheet) container;
if (!sheet.isTopMost()) {
Window owner = sheet.getOwner();
owner.moveToFront();
}
boolean consumed = super.mouseDown(container, button, x, y);
if (resizable && button == Mouse.Button.LEFT) {
Bounds resizeHandleBounds = resizeHandle.getBounds();
if (resizeHandleBounds.contains(x, y)) {
resizeOffset = new Point(getWidth() - x, getHeight() - y);
Mouse.capture(container);
}
}
return consumed;
}
use of org.apache.pivot.wtk.Window in project pivot by apache.
the class BXMLExplorerDocument method load.
public void load(File f) throws IOException, SerializationException, ParserConfigurationException, SAXException {
BXMLSerializer serializer = new BXMLSerializer();
serializer.setLocation(f.toURI().toURL());
try (FileInputStream in = new FileInputStream(f)) {
Object obj = serializer.readObject(in);
if (!(obj instanceof Component)) {
throw new IllegalStateException("obj " + obj + " is of class " + obj.getClass() + " which is not a subtype of Component");
}
// create an inverse map so we can IDs for widgets
widgetToID = new HashMap<>();
for (String key : serializer.getNamespace()) {
widgetToID.put(serializer.getNamespace().get(key), key);
}
// we can't add a Window into the component hierarchy, so fake it
if (obj instanceof Window) {
obj = new FakeWindow((Window) obj);
}
// create the explorer tree
componentToTreeNode = new HashMap<>();
// the root node is not visible
final TreeBranch rootbranch = new TreeBranch("");
rootbranch.add(analyseObjectTree(obj));
treeView.setTreeData(rootbranch);
treeView.expandAll();
// add the loaded widget to the display
this.loadedComponent = (Component) obj;
playgroundCardPane.add((Component) obj);
}
try (FileInputStream in2 = new FileInputStream(f)) {
CreateHighlightedXML xml = new CreateHighlightedXML();
bxmlSourceTextPane.setDocument(xml.prettyPrint(in2));
}
this.file = f;
}
use of org.apache.pivot.wtk.Window in project pivot by apache.
the class Windows method shutdown.
@Override
public boolean shutdown(boolean optional) {
for (int i = display.getLength() - 1; i >= 0; i--) {
Window window = (Window) display.get(i);
window.close();
}
return false;
}
Aggregations