|
| 1 | +package com.window; |
| 2 | + |
| 3 | +import java.awt.AWTKeyStroke; |
| 4 | +import java.awt.BufferCapabilities; |
| 5 | +import java.awt.Frame; |
| 6 | +import java.awt.GraphicsConfiguration; |
| 7 | +import java.awt.Window; |
| 8 | +import java.util.Set; |
| 9 | + |
| 10 | +import liquidjava.specification.ExternalRefinementsFor; |
| 11 | +import liquidjava.specification.Refinement; |
| 12 | +import liquidjava.specification.StateRefinement; |
| 13 | +import liquidjava.specification.StateSet; |
| 14 | + |
| 15 | +@StateSet({"displayable", "notDisplayable"}) |
| 16 | +@ExternalRefinementsFor("java.awt.Window") |
| 17 | +public interface WindowRefinements{ |
| 18 | + |
| 19 | + @StateRefinement(to="notDisplayable(this)") |
| 20 | + void Window(Frame owner); |
| 21 | + |
| 22 | + @StateRefinement(to="notDisplayable(this)") |
| 23 | + void Window(Window owner); |
| 24 | + |
| 25 | + @StateRefinement(to="notDisplayable(this)") |
| 26 | + void Window(Window owner, GraphicsConfiguration gc); |
| 27 | + |
| 28 | + |
| 29 | + // to displayable |
| 30 | + @StateRefinement(to="displayable(this)") |
| 31 | + void addNotify(); // Makes this Window displayable by creating the connection to its native screen resource. This method is called internally by the toolkit and should not be called directly by programs. |
| 32 | + |
| 33 | + @StateRefinement(to="displayable(this)") |
| 34 | + void pack(); //If the window and/or its owner are not displayable yet, both of them are made displayable |
| 35 | + |
| 36 | + @StateRefinement(from="notDisplayable(this)") |
| 37 | + @StateRefinement(from="notDisplayable(this) && b",to="displayable(this)") // if its not displayable yet, is made displayable |
| 38 | + @StateRefinement(from="displayable(this)") // stays displayable |
| 39 | + void setVisible(boolean b); |
| 40 | + |
| 41 | + |
| 42 | + @StateRefinement(to="notDisplayable(this)") |
| 43 | + void dispose(); // makes not displayable. It can be displayed again later by calling pack(). |
| 44 | + |
| 45 | + @StateRefinement(from="displayable(this)") |
| 46 | + void createBufferStrategy(@Refinement("_ > 0")int numBuffers);// IllegalStateException - if the component is not displayable |
| 47 | + |
| 48 | + |
| 49 | + void createBufferStrategy(@Refinement("_ > 0") int numBuffers, BufferCapabilities caps); |
| 50 | + |
| 51 | + @StateRefinement(from="notDisplayable(this)") |
| 52 | + void setType(Window.Type type); // Sets the type of the window. This method can only be called while the window is not displayable. |
| 53 | + |
| 54 | + |
| 55 | + Set<AWTKeyStroke> getFocusTraversalKeys(@Refinement("_ >= 0 && _ <= 3") int id); |
| 56 | + |
| 57 | + void setOpacity(@Refinement("_ >= 0 && _ <= 1") float opacity); |
| 58 | + |
| 59 | +} |
0 commit comments