Search in sources :

Example 21 with BXMLSerializer

use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.

the class SearchDemo method startup.

@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    bxmlSerializer.getNamespace().put(APPLICATION_KEY, this);
    window = (Window) bxmlSerializer.readObject(SearchDemo.class, "search_demo.bxml");
    bxmlSerializer.bind(this, SearchDemo.class);
    searchButton.setButtonData(searchImage);
    window.open(display);
    termTextInput.requestFocus();
}
Also used : BXMLSerializer(org.apache.pivot.beans.BXMLSerializer)

Example 22 with BXMLSerializer

use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.

the class ApplicationHandlerTest method startup.

@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    window = (Window) bxmlSerializer.readObject(ApplicationHandlerTest.class, "application_handler_test.bxml");
    window.open(display);
}
Also used : BXMLSerializer(org.apache.pivot.beans.BXMLSerializer)

Example 23 with BXMLSerializer

use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.

the class BXMLDictionaryTest method main.

public static void main(String[] args) throws Exception {
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    @SuppressWarnings("unchecked") HashMap<String, Object> hashMap = (HashMap<String, Object>) bxmlSerializer.readObject(BXMLDictionaryTest.class.getResource("bxml_dictionary_test.bxml"));
    System.out.println(JSONSerializer.toString(hashMap));
}
Also used : HashMap(org.apache.pivot.collections.HashMap) BXMLSerializer(org.apache.pivot.beans.BXMLSerializer)

Example 24 with BXMLSerializer

use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.

the class BorderTest method startup.

@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    frame = new Frame((Component) bxmlSerializer.readObject(getClass().getResource("border_test.bxml")));
    frame.setTitle("Border Test");
    frame.setPreferredSize(480, 360);
    frame.open(display);
}
Also used : Frame(org.apache.pivot.wtk.Frame) Component(org.apache.pivot.wtk.Component) BXMLSerializer(org.apache.pivot.beans.BXMLSerializer)

Example 25 with BXMLSerializer

use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.

the class CalendarTest method startup.

@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    window = (Window) bxmlSerializer.readObject(CalendarTest.class, "calendar_test.bxml");
    bxmlSerializer.bind(this, CalendarTest.class);
    Filter<CalendarDate> todayFilter = new Filter<CalendarDate>() {

        @Override
        public boolean include(CalendarDate date) {
            CalendarDate today = new CalendarDate();
            return (!date.equals(today));
        }
    };
    calendar.setDisabledDateFilter(todayFilter);
    calendarButton.getCalendarButtonListeners().add(new CalendarButtonListener() {

        @Override
        public void yearChanged(CalendarButton calendarButtonArgument, int previousYear) {
            disable();
        }

        @Override
        public void monthChanged(CalendarButton calendarButtonArgument, int previousMonth) {
            disable();
        }

        private void disable() {
            calendarButton.setDisabledDateFilter(new Filter<CalendarDate>() {

                @Override
                public boolean include(CalendarDate date) {
                    return true;
                }
            });
            Task<Void> task = new Task<Void>() {

                @Override
                public Void execute() {
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException exception) {
                    // ignore exception
                    }
                    return null;
                }
            };
            System.out.println("STARTING TASK");
            task.execute(new TaskAdapter<>(new TaskListener<Void>() {

                @Override
                public void taskExecuted(Task<Void> taskArgument) {
                    System.out.println("EXECUTED");
                    calendarButton.setDisabledDateFilter(null);
                }

                @Override
                public void executeFailed(Task<Void> taskArgument) {
                    System.out.println("FAILED");
                    calendarButton.setDisabledDateFilter(null);
                }
            }));
        }
    });
    window.open(display);
}
Also used : Task(org.apache.pivot.util.concurrent.Task) CalendarDate(org.apache.pivot.util.CalendarDate) Filter(org.apache.pivot.util.Filter) TaskAdapter(org.apache.pivot.wtk.TaskAdapter) CalendarButton(org.apache.pivot.wtk.CalendarButton) CalendarButtonListener(org.apache.pivot.wtk.CalendarButtonListener) BXMLSerializer(org.apache.pivot.beans.BXMLSerializer)

Aggregations

BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)86 Component (org.apache.pivot.wtk.Component)24 IOException (java.io.IOException)19 SerializationException (org.apache.pivot.serialization.SerializationException)14 Window (org.apache.pivot.wtk.Window)13 Button (org.apache.pivot.wtk.Button)11 PushButton (org.apache.pivot.wtk.PushButton)11 File (java.io.File)9 ButtonPressListener (org.apache.pivot.wtk.ButtonPressListener)9 Frame (org.apache.pivot.wtk.Frame)8 TextInput (org.apache.pivot.wtk.TextInput)8 ArrayList (org.apache.pivot.collections.ArrayList)7 List (org.apache.pivot.collections.List)7 Mouse (org.apache.pivot.wtk.Mouse)6 Sequence (org.apache.pivot.collections.Sequence)5 ComponentMouseButtonListener (org.apache.pivot.wtk.ComponentMouseButtonListener)5 ListButton (org.apache.pivot.wtk.ListButton)5 TextInputContentListener (org.apache.pivot.wtk.TextInputContentListener)5 URL (java.net.URL)4 MalformedURLException (java.net.MalformedURLException)3