use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class HelloBXML method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
this.window = (Window) bxmlSerializer.readObject(HelloBXML.class, "hello.bxml");
this.window.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class Pivot721 method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window) bxmlSerializer.readObject(Pivot721.class, "pivot_721.bxml");
// force fill into button renderer, but only in some buttons ...
ButtonDataRenderer filledButtonDataRenderer = new ButtonDataRenderer();
filledButtonDataRenderer.setFillIcon(true);
PushButton button3 = (PushButton) bxmlSerializer.getNamespace().get("button3");
// ((ButtonDataRenderer)button3.getDataRenderer()).setFillIcon(true); //
// ok, but note that all buttons share a common renderer instance
// set/use the
button3.setDataRenderer(filledButtonDataRenderer);
// customized
// renderer instance
PushButton button4 = (PushButton) bxmlSerializer.getNamespace().get("button4");
// set/use the
button4.setDataRenderer(filledButtonDataRenderer);
// customized
// renderer instance
window.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class Pivot734WithWorkaround method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window) bxmlSerializer.readObject(Pivot734WithWorkaround.class, "pivot_734.bxml");
controlTree(bxmlSerializer);
window.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class Pivot832 method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window) bxmlSerializer.readObject(getClass().getResource("pivot_832.bxml"));
bxmlSerializer.bind(this, Pivot832.class);
selectFolderButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet();
// to
fileBrowserSheet.setMode(FileBrowserSheet.Mode.SAVE_TO);
// be
// able
// to
// select
// a
// folder
fileBrowserSheet.open(window, new SheetCloseListener() {
@Override
public void sheetClosed(Sheet sheet) {
if (sheet.getResult()) {
File loadedFile = fileBrowserSheet.getSelectedFile();
try {
selectedFolder = loadedFile.getCanonicalPath();
System.out.println("Selected folder '" + selectedFolder + "'");
// multiple tests ...
System.out.println("Verify: Root folder (display from getName) was set to '" + fileBrowserSheet.getRootDirectory().getName() + "'");
System.out.println("Verify: Root folder (display from getCanonicalPath) was set to '" + fileBrowserSheet.getRootDirectory().getCanonicalPath() + "'");
System.out.println("Verify: Root folder (display from getCanonicalFile) was set to '" + fileBrowserSheet.getRootDirectory().getCanonicalFile() + "'");
openFileButton.setEnabled(true);
} catch (IOException e) {
e.printStackTrace();
openFileButton.setEnabled(false);
}
window.setTitle("Selected folder: " + selectedFolder);
}
}
});
}
});
openFileButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
System.out.println("Now opening a BrowserSheet starting from the previous selected folder: \"" + selectedFolder + "\"");
final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet(FileBrowserSheet.Mode.OPEN, selectedFolder);
try {
// multiple tests ...
System.out.println("Verify: Root folder (display from getName) was set to '" + fileBrowserSheet.getRootDirectory().getName() + "'");
System.out.println("Verify: Root folder (display from getCanonicalPath) was set to '" + fileBrowserSheet.getRootDirectory().getCanonicalPath() + "'");
System.out.println("Verify: Root folder (display from getCanonicalFile) was set to '" + fileBrowserSheet.getRootDirectory().getCanonicalFile() + "'");
} catch (IOException e) {
e.printStackTrace();
}
fileBrowserSheet.open(window, new SheetCloseListener() {
@Override
public void sheetClosed(Sheet sheet) {
// empty block
}
});
}
});
window.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class SuggestionPopupTest method startup.
@Override
public void startup(final Display display, final Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window) bxmlSerializer.readObject(SuggestionPopupTest.class, "suggestion_popup_test.bxml");
bxmlSerializer.bind(this);
textInput.getTextInputContentListeners().add(new TextInputContentListener() {
@Override
public void textInserted(final TextInput textInputArgument, final int index, final int count) {
ArrayList<String> suggestions = new ArrayList<>("One", "Two", "Three", "Four", "Five");
suggestionPopup.setSuggestionData(suggestions);
suggestionPopup.open(textInputArgument, new SuggestionPopupCloseListener() {
@Override
public void suggestionPopupClosed(final SuggestionPopup suggestionPopupArgument) {
if (suggestionPopupArgument.getResult()) {
selectedIndexLabel.setText("You selected suggestion number " + suggestionPopupArgument.getSelectedIndex() + ".");
} else {
selectedIndexLabel.setText("You didn't select anything.");
}
}
});
}
@Override
public void textRemoved(final TextInput textInputArgument, final int index, final int count) {
suggestionPopup.close();
}
});
window.open(display);
}
Aggregations