use of org.apache.pivot.wtk.Component in project pivot by apache.
the class SpinnerFocusTest method startup.
@Override
public void startup(final Display display, final Map<String, String> properties) throws Exception {
Action action = new Action() {
@Override
public String getDescription() {
return null;
}
@Override
public void perform(final Component source) {
String msg = "Selected: " + spinner.getSelectedItem().toString();
Alert.alert(msg, frame);
spinner.requestFocus();
System.out.println("Focus transferred to spinner");
}
};
Action.getNamedActions().put("buttonAction", action);
BXMLSerializer bxmlSerializer = new BXMLSerializer();
frame = new Frame((Component) bxmlSerializer.readObject(getClass().getResource("spinner_focus_test.bxml")));
frame.setTitle("Spinner Focus Test");
frame.open(display);
spinner = (Spinner) bxmlSerializer.getNamespace().get("spinner");
spinner.requestFocus();
// action.setEnabled(false);
}
use of org.apache.pivot.wtk.Component in project pivot by apache.
the class LinkButtonTest method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BoxPane boxPane = new BoxPane();
boxPane.getStyles().put(Style.verticalAlignment, VerticalAlignment.CENTER);
boxPane.getStyles().put(Style.spacing, 8);
boxPane.getComponentMouseListeners().add(new ComponentMouseListener() {
@Override
public boolean mouseMove(Component component, int x, int y) {
System.out.println("BOX PANE " + x + ", " + y);
return false;
}
@Override
public void mouseOver(Component component) {
// empty block
}
@Override
public void mouseOut(Component component) {
// empty block
}
});
Image image = Image.load(getClass().getResource("go-home.png"));
LinkButton linkButton = null;
linkButton = new LinkButton("ABCDE");
boxPane.add(linkButton);
linkButton.getComponentMouseListeners().add(new ComponentMouseListener() {
@Override
public boolean mouseMove(Component component, int x, int y) {
return true;
}
@Override
public void mouseOver(Component component) {
// empty block
}
@Override
public void mouseOut(Component component) {
// empty block
}
});
linkButton = new LinkButton(image);
boxPane.add(linkButton);
linkButton = new LinkButton(new ButtonData(image, "12345"));
boxPane.add(linkButton);
window.setContent(boxPane);
window.open(display);
}
use of org.apache.pivot.wtk.Component in project pivot by apache.
the class TerraTooltipSkin method getPreferredSize.
@Override
public Dimensions getPreferredSize() {
Dimensions size = Dimensions.ZERO;
Tooltip tooltip = (Tooltip) getComponent();
Component content = tooltip.getContent();
if (content != null) {
size = content.getPreferredSize();
}
return size.expand(padding);
}
use of org.apache.pivot.wtk.Component in project pivot by apache.
the class TerraVFSBrowserSkin method getFileAt.
@Override
public FileObject getFileAt(int x, int y) {
FileObject file = null;
VFSBrowser fileBrowser = (VFSBrowser) getComponent();
Component component = fileBrowser.getDescendantAt(x, y);
if (component == fileTableView) {
Point location = fileTableView.mapPointFromAncestor(fileBrowser, x, y);
int index = fileTableView.getRowAt(location.y);
if (index != -1) {
file = (FileObject) fileTableView.getTableData().get(index);
}
}
return file;
}
use of org.apache.pivot.wtk.Component in project pivot by apache.
the class TerraExpanderSkin method getPreferredHeight.
@Override
public int getPreferredHeight(int width) {
Expander expander = (Expander) getComponent();
Component content = expander.getContent();
int preferredHeight = titleBarTablePane.getPreferredHeight(-1);
if (content != null && (expander.isExpanded() || expandTransition != null)) {
// Title bar border is only drawn when content is non-null and
// expander is expanded or expanding
preferredHeight += 1;
int contentWidth = -1;
if (width >= 0) {
contentWidth = Math.max(width - (2 + padding.getWidth()), 0);
}
int fullHeight = padding.getHeight() + content.getPreferredHeight(contentWidth);
if (expandTransition == null) {
preferredHeight += fullHeight;
} else {
float scale = expandTransition.getScale();
preferredHeight += (int) (scale * fullHeight);
}
}
preferredHeight += 2;
return preferredHeight;
}
Aggregations