package siprp.medicina.processo.ui; import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CLOSE; import info.clearthought.layout.TableLayout; import info.clearthought.layout.TableLayoutConstraints; import java.awt.Dimension; import javax.swing.JSeparator; import siprp.logic.SIPRPLogic.LeafUIActionBinding; import siprp.medicina.processo.logic.MedicinaProcessoLogic; import siprp.ui.SIPRPWindow; public class MedicinaProcessoWindow extends SIPRPWindow { private static final long serialVersionUID = 1L; private static final Dimension WINDOW_DIMENSION = new Dimension( 1024, 700 ); public static final String TITLE = "Processos de trabalhadores"; private static final Dimension DIMENSION_TRABALHADORES_CHOOSER = new Dimension( 0, 200 ); private static final Dimension DIMENSION_PROCESSO_TOOLBAR = new Dimension( 150, 0 ); public final JSeparator separator = new JSeparator(); @LeafPanel public final ProcessoDadosPanel panelProcessoDados; @LeafPanel public final ProcessoAccoesPanel panelProcessoToolbar; @LeafPanel public final ProcessoTreePanel panelProcessoTree; @LeafPanel public final TrabalhadoresChooserPanel panelTrabalhadoresChooser; public MedicinaProcessoWindow() throws Exception { super( new MedicinaProcessoLogic() ); setSize( WINDOW_DIMENSION ); setTitle( TITLE ); panelProcessoDados = new ProcessoDadosPanel( this ); panelProcessoToolbar = new ProcessoAccoesPanel( this ); panelProcessoTree = new ProcessoTreePanel( this ); panelTrabalhadoresChooser = new TrabalhadoresChooserPanel( this ); setupLayout(); setupComponents(); placeComponents(); completeSetup(); } private void setupLayout() { double[] cols = new double[] { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.FILL }; double[] rows = new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }; TableLayout layout = new TableLayout( cols, rows ); layout.setVGap( 5 ); layout.setHGap( 5 ); this.setLayout( layout ); } private void setupComponents() { panelTrabalhadoresChooser.setPreferredSize( DIMENSION_TRABALHADORES_CHOOSER ); panelProcessoToolbar.setPreferredSize( DIMENSION_PROCESSO_TOOLBAR ); } private void placeComponents() { this.add( panelTrabalhadoresChooser, new TableLayoutConstraints( 0, 0, 2, 0 ) ); this.add( separator, new TableLayoutConstraints( 0, 1, 2, 1 ) ); this.add( panelProcessoToolbar, new TableLayoutConstraints( 0, 2 ) ); this.add( panelProcessoTree, new TableLayoutConstraints( 1, 2 ) ); this.add( panelProcessoDados, new TableLayoutConstraints( 2, 2 ) ); } @LeafUIActionBinding(action=CLOSE) public void closeWindow() { close(); } }