use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class Pivot694 method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
System.out.println("startup: start");
System.out.println("Test for clearing (selection) in many Components");
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window) bxmlSerializer.readObject(this.getClass(), "pivot_694.bxml");
initializeFields(bxmlSerializer);
window.open(display);
System.out.println("Note that elements to clear selection, " + " are to improve Pivot on this feature in a next release, so now only some components will support it");
System.out.println("Note that elements to clear (data) inside, will be emptied" + " only if they have a buttonDataKey/listDataKey/tableDataKey/treeDataKey/spinnerDataKey/xxxDataKey" + " property set at creation time");
System.out.println("startup: end");
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class MenuBarTest method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BoxPane boxPane = new BoxPane(Orientation.VERTICAL);
boxPane.add(new TextInput());
boxPane.add(new TextInput());
boxPane.add(new TextInput());
frame1 = new Frame(boxPane);
frame1.setLocation(50, 50);
frame1.setPreferredSize(320, 240);
frame1.setTitle("Frame 1");
// put this before loading the related bxml, or an
// IllegalArgumentException will be thrown
Action.getNamedActions().put("about", new Action() {
@Override
public void perform(Component source) {
String msg = "Hello from Pivot-" + ApplicationContext.getPivotVersion().toString() + ", running from Java " + // + ApplicationContext.getJVMVersion().toString()
System.getProperty("java.version");
// frame2);
Alert.alert(msg, frame2.getRootOwner());
System.out.println("Help triggered");
}
});
BXMLSerializer bxmlSerializer = new BXMLSerializer();
frame2 = (Frame) bxmlSerializer.readObject(MenuBarTest.class, "menu_bar_test.bxml");
frame2.setTitle("Frame 2, from bxml");
bxmlSerializer.bind(this, MenuBarTest.class);
MenuHandler menuHandler = new MenuHandler() {
@Override
public void configureMenuBar(Component component, MenuBar menuBar) {
System.out.println("Configure menu bar: got focus on " + component.getName());
}
@Override
public void cleanupMenuBar(Component component, MenuBar menuBar) {
System.out.println("Clean up menu bar: lost focus on " + component.getName());
}
};
textInput1.setMenuHandler(menuHandler);
textInput2.setMenuHandler(menuHandler);
textInput3.setMenuHandler(menuHandler);
frame1.open(display);
frame2.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class NamespaceTest method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window) bxmlSerializer.readObject(NamespaceTest.class, "namespace_test.bxml");
System.out.println((String) JSON.get(bxmlSerializer.getNamespace(), "content.text"));
System.out.println((String) JSON.get(bxmlSerializer.getNamespace(), "content['text']"));
window.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class PanoramaTest method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
frame1 = new Frame();
frame1.setTitle("Panorama Test 1");
Panorama panorama = new Panorama();
frame1.setContent(panorama);
frame1.setPreferredSize(240, 320);
ImageView imageView = new ImageView();
imageView.setImage(getClass().getResource("IMG_0767_2.jpg"));
panorama.setView(imageView);
frame1.open(display);
BXMLSerializer bxmlSerializer = new BXMLSerializer();
frame2 = new Frame((Component) bxmlSerializer.readObject(getClass().getResource("panorama_test.bxml")));
frame2.setTitle("Panorama Test 2");
frame2.setPreferredSize(480, 360);
frame2.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class SliderTest method startup.
@Override
public void startup(final Display display, final Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = new Window((Component) bxmlSerializer.readObject(getClass().getResource("slider_test.bxml")));
slider1 = (Slider) bxmlSerializer.getNamespace().get("slider1");
slider1.getSliderValueListeners().add((slider, previousValue) -> {
valueLabel1.setText(Integer.toString(slider.getValue()));
drawPoint(slider.getValue(), slider2.getValue(), slider.getStart(), slider.getEnd(), slider2.getStart(), slider2.getEnd());
});
slider2 = (Slider) bxmlSerializer.getNamespace().get("slider2");
slider2.getSliderValueListeners().add((slider, previousValue) -> {
valueLabel2.setText(Integer.toString(slider.getValue()));
drawPoint(slider1.getValue(), slider.getValue(), slider1.getStart(), slider1.getEnd(), slider.getStart(), slider.getEnd());
});
valueLabel1 = (Label) bxmlSerializer.getNamespace().get("valueLabel1");
valueLabel2 = (Label) bxmlSerializer.getNamespace().get("valueLabel2");
image = (ImageView) bxmlSerializer.getNamespace().get("imageView");
int width = slider1.getEnd() - slider1.getStart();
int height = slider2.getEnd() - slider2.getStart();
picture = new SliderPicture(width, height);
picture.clear(Color.LIGHT_GRAY);
drawPoint(slider1.getValue(), slider2.getValue(), slider1.getStart(), slider1.getEnd(), slider2.getStart(), slider2.getEnd());
image.setImage(picture);
window.setTitle("Slider Test");
window.setMaximized(true);
window.open(display);
}
Aggregations