Classe <tt>LeCarro</tt>



next up previous contents
Next: About this document Up: Aplicações Interactivas em Smalltalk/V Previous: Classe ESView

Classe LeCarro

 

WindowDialog subclass: #LeCarro
  instanceVariableNames: 
    'carro fazerLavagem fazerAlinhamento '
  classVariableNames: ''
  poolDictionaries: ''  !

!LeCarro class methods ! !

!LeCarro methods !
 
cancel: aButton
        "Fechar a janela"
    self mainView close!

ler
        "Dialog Box para ler a informacao de um carro"
    | lineHeight charSize |

  fazerLavagem := false.
  fazerAlinhamento := false.

  self label: 'Registar Automovel'.

  charSize := WindowDialog unitMultiplier.
  lineHeight := charSize y.

  self addSubpane:
        (StaticText new
           centered;
           contents: 'Matricula: ';
           framingBlock:
             [:box |  (box leftTop down: lineHeight) 
extentFromLeftTop: 30@lineHeight ]
        ).
   self addSubpane:
        (EntryField new
            setName: #matricula;
            contents: '';
            framingBlock:
                [:box | (box leftTop rightAndDown: 40@lineHeight)
 extentFromLeftTop: 90@lineHeight ]
        ).

   self addSubpane:
        (StaticText new
            centered;
            contents: 'Marca: ';
            framingBlock:
              [:box | (box leftTop down: 3*lineHeight) 
extentFromLeftTop: 30@lineHeight ]
        ).
    self addSubpane:
        (EntryField new
            setName: #marca;
            contents: '';
            framingBlock:
               [:box | (box leftTop rightAndDown: 40@(3*lineHeight))
 extentFromLeftTop: 90@lineHeight ]
        ).

    self addSubpane:
        (StaticText new
            centered;
            contents: 'Modelo: ';
            framingBlock:
               [:box | (box leftTop down: 5*lineHeight)
 extentFromLeftTop: 30@lineHeight ]
        ).
    self addSubpane:
        (EntryField new
            setName: #modelo;
            contents: '';
            framingBlock:
               [:box | (box leftTop rightAndDown: 40@(5*lineHeight))
extentFromLeftTop: 90@lineHeight ]
        ).

    self addSubpane:
        (StaticText new
            centered;
            contents: 'Enviar para: ';
            framingBlock:
               [:box | (box leftTop down: 7*lineHeight) 
extentFromLeftTop: 30@lineHeight ]
        ).
    self addSubpane:
        (CheckBox new
            owner: self;
            contents: 'para Lavagem';
            when: #clicked perform: #setLavagem:;
            framingBlock:
                [:box | (box leftTop rightAndDown: 5@(8*lineHeight))
 extentFromLeftTop: 90@lineHeight ]
        ).
    self addSubpane:
        (CheckBox new
            owner: self;
            contents: 'para Alinhamento';
            when: #clicked perform: #setAlinhamento:;
            framingBlock: 
                 [:box | (box leftTop rightAndDown: 5@(9*lineHeight))
extentFromLeftTop: 90@lineHeight ]
        ).

    self addSubpane:
        (Button new
            defaultPushButton;
            contents: 'OK';
            idOK;
            when: #clicked perform: #ok:;
            framingBlock:
                [:box | (box leftTop rightAndDown: (17@10)*charSize)
 extentFromLeftTop: (8@2)*charSize]
        ).

    self addSubpane:
        (Button new
            pushButton;
            contents: 'Cancel';
            idCancel;
            when: #clicked perform: #cancel:;
            framingBlock:
                [:box | (box leftTop rightAndDown: (28@10)*charSize)
 extentFromLeftTop: (8@2)*charSize ]
        ).

    self openWindow.
   ^carro!
   
mostra: mat marca: mar modelo: mod lavagem: lav direccao: dir
        "Dialog Box para mostrar a informacao de um carro"
    | lineHeight charSize |

  fazerLavagem := lav not.
  fazerAlinhamento := dir  not.

  self label: 'Automovel'.

  charSize := WindowDialog unitMultiplier.
  lineHeight := charSize y.

  self addSubpane:
        (StaticText new
            centered;
            contents: 'Matricula: ';
            framingBlock:
                [:box | (box leftTop down: lineHeight) 
extentFromLeftTop: 30@lineHeight ]
        ).
   self addSubpane:
        (StaticText new
            setName: #matricula;
            contents: mat;
            framingBlock:
                [:box | (box leftTop rightAndDown: 40@lineHeight)
 extentFromLeftTop: 90@lineHeight ]
        ).

   self addSubpane:
        (StaticText new
            centered;
            contents: 'Marca: ';
            framingBlock:
                [:box | (box leftTop down: 3*lineHeight)
 extentFromLeftTop: 30@lineHeight ]
        ).
    self addSubpane:
        (StaticText new
            setName: #marca;
            contents: mar;
            framingBlock:
                [:box | (box leftTop rightAndDown: 40@(3*lineHeight))
 extentFromLeftTop: 90@lineHeight ]
        ).

    self addSubpane:
        (StaticText new
            centered;
            contents: 'Modelo: ';
            framingBlock:
                [:box | (box leftTop down: 5*lineHeight)
 extentFromLeftTop: 30@lineHeight ]
        ).
    self addSubpane:
        (StaticText new
            setName: #modelo;
            contents: mod;
            framingBlock:
                [:box | (box leftTop rightAndDown: 40@(5*lineHeight))
 extentFromLeftTop: 90@lineHeight ]
        ).

    self addSubpane:
        (StaticText new
            centered;
            contents: 'Enviar para: ';
            framingBlock:
                [:box | (box leftTop down: 7*lineHeight)
 extentFromLeftTop: 30@lineHeight ]
        ).
    fazerLavagem ifTrue:
        [ self addSubpane:
                (StaticText new
                   owner: self;
                   contents: 'para Lavagem';
                   framingBlock:
                     [:box | (box leftTop rightAndDown: 6@(8*lineHeight))
 extentFromLeftTop: 90@lineHeight ]
                )
         ].
    fazerAlinhamento ifTrue:
        [ self addSubpane:
                (StaticText new
                   owner: self;
                   contents: 'para Alinhamento';
                   framingBlock:
                     [:box | (box leftTop rightAndDown: 6@(9*lineHeight))
 extentFromLeftTop: 90@lineHeight ]
                )
        ].

    self addSubpane:
        (Button new
            defaultPushButton;
            contents: 'OK';
            idOK;
            when: #clicked perform: #cancel:;
            framingBlock:
                [:box | (box leftTop rightAndDown: (17@10)*charSize)
 extentFromLeftTop: (8@2)*charSize ]
        ).

    self openWindow.!

ok: aButton
        "Construir o carro lido."
    carro := AutoComFactura new: (self query: #matricula)
                            marca: (self query: #marca)
                            modelo: (self query: #modelo)
                            limpeza: (fazerLavagem not)
                            direccao: (fazerAlinhamento not).
    self mainView close!
 
setAlinhamento: botao
        "o botao de alinhamento foi clicado"
    fazerAlinhamento := fazerAlinhamento not.!
 
setLavagem: botao
        "o botao de lavagem foi clicado"
    fazerLavagem := fazerLavagem not.! !



Jose Franscisco Creissac Campos
Wed Jan 31 12:57:29 MET 1996