コード例 #1
0
 private void avaliaArq(G_File temp) {
   arquivo = temp;
   salvaAlteracoes.setNomeDoArquivoEmDisco(arquivo.getFile().getAbsolutePath());
   TxtBuffer.setContentOriginal(arquivo.read(), "0");
   caminhoRecente.write(arquivo.getFile().getAbsolutePath());
   frameSilvinha.setTitle(arquivo.getFile().getName() + " - " + XHTML_Panel.TIT_LINK_RED);
   avalia();
   frameSilvinha.setUrlTextField(arquivo.getFile().getAbsolutePath());
   this.painelOriginal.avalia(arquivo.read());
 }
コード例 #2
0
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd == "Salvar") {
      salvaAlteracoes.salvar();
      /*	if (arquivo == null) {
      	salvarComo();
      	// avalia();
      	return;
      }
      arquivo.write(boxCode.getText());//*/
      // avalia();
      reavalia(textAreaSourceCode.getText());
    } else if (cmd == "Aplicar") {

      if (controle != null) {

        int pos = controle.getIniIndex(erroAtual);
        String newCod;
        try {
          newCod = controle.corrige(texto.getText(), erroAtual);
          textAreaSourceCode.setText(newCod);
          salvaAlteracoes.setAlterado();
          TxtBuffer.setContent(textAreaSourceCode.getText());
          reavalia(newCod);
          textAreaSourceCode.getTextPane().setCaretPosition(pos);
        } catch (ExceptionImagemNotFound e1) {
          JOptionPane.showMessageDialog(this, e1.getMessage());
        }
        controle.avalia(textAreaSourceCode.getText(), true);
      }
    } else if (cmd == "AbrirURL") {
      String url;
      url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
      avaliaUrl(url);
      // JOptionPane.showMessageDialog(null, "Seu nome é " + nome);

    } else if (cmd == "Abrir") {

      String a[] = {".html", ".htm"};
      G_File temp = new G_File(caminhoRecente.read(), a);
      if (temp.getFile() != null) {
        avaliaArq(temp);
      }
    } else if (cmd == "SaveAs") {
      // salvarComo();
      salvaAlteracoes.salvarComo();
      // avalia();
    } else if (cmd == "Creditos") {
      new Creditos();
    } else if (cmd == "Sair") {
      System.exit(0);
    } else if (cmd == "Desfazer") {
      textAreaSourceCode.undo();
      // boxCode.coloreSource();
      // reavalia(boxCode.getText());
    } else if (cmd == "AumentaFonte") {
      textAreaSourceCode.aumentaFontSize();
    } else if (cmd == "DiminuiFonte") {
      textAreaSourceCode.diminuiFontSize();
    } else if (cmd == "Contraste") {
      textAreaSourceCode.autoContraste();
      reavalia(textAreaSourceCode.getText());
    } else if (cmd == "SelecionarTudo") {
      textAreaSourceCode.getTextPane().selectAll();
      if (painelOriginal != null) {
        painelOriginal.textAreaSourceCode.getTextPane().selectAll();
      }
    } else if (cmd == "Cancelar") {
      salvaAlteracoes.cancelar();
    }
  }
コード例 #3
0
  private void criaInterfaceVisualEscalavel() {
    miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR);
    painel = new JPanel();
    textAreaSourceCode = new G_TextAreaSourceCode();
    // frameSilvinha.setJMenuBar(this.criaMenuBar());
    textAreaSourceCode.setTipoHTML();
    textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE));
    // frameSilvinha.setTitle(XHTMLPanel.TIT_LINK_RED);

    painel.setLayout(new GridLayout(2, 1));
    setBackground(frameSilvinha.corDefault);

    Container contentPane = this;
    contentPane.setLayout(new GridLayout(1, 1));
    painel.add(textAreaSourceCode);

    JPanel panelBtnTabela = new JPanel();

    panelBtnTabela.setLayout(new BorderLayout());

    /*
     * Barra de botões
     */
    btnPanel = new JPanel();
    btnPanel.setLayout(null);
    btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR);
    btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR);
    btn_salvar.setBounds(10, 0, 150, 25);
    btnPanel.add(btn_salvar);

    btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR);
    btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR);
    btn_abrir.setBounds(165, 0, 150, 25);
    btnPanel.add(btn_abrir);

    btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO);
    btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO);
    btn_salvarComo.setBounds(320, 0, 150, 25);
    btnPanel.add(btn_salvarComo);

    btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR);
    btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR);
    btn_cancelar.setBounds(480, 0, 150, 25);
    btnPanel.add(btn_cancelar);

    btnPanel.setPreferredSize(new Dimension(430, 30));

    /*
     * Barra de correcao
     */
    btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR);
    btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR);
    btnAplicar.setEnabled(false);

    texto = new JTextField();

    texto.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JPanel borda = new JPanel(new BorderLayout());
    JLabel lbl_texto = new JLabel(XHTML_Panel.ROTULO_TEXTO);
    lbl_texto.setToolTipText(XHTML_Panel.DICA_ROTULO_TEXTO);
    borda.add(lbl_texto, BorderLayout.WEST);
    borda.add(texto, BorderLayout.CENTER);
    borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    borda.setOpaque(false);
    panelCorretor = new JPanel(new BorderLayout());
    panelCorretor.add(borda, BorderLayout.CENTER);
    panelCorretor.add(btnAplicar, BorderLayout.EAST);
    // panelCorretor.add(btnPanel,BorderLayout.WEST);
    panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    panelCorretor.setOpaque(false);

    /*
     * Tabela de erros
     */
    tabelaDeErros = new TabelaErros();
    scrollPaneTabela = new JScrollPane();
    scrollPaneTabela.setViewportView(tabelaDeErros);
    panelBtnTabela.add(panelCorretor, BorderLayout.NORTH);
    panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER);
    panelBtnTabela.add(btnPanel, BorderLayout.SOUTH);
    scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS));
    painel.add(panelBtnTabela);

    btnPanel.setBackground(frameSilvinha.corDefault);
    if (!original) {
      reverter = new JButton("Reverter");
      reverter.setText(TradPainelRelatorio.REVERTER);
      reverter.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              // TODO Auto-generated method stub
              setVisible(false);
              TxtBuffer.setContent(TxtBuffer.getContentOriginal());
              frameSilvinha.showPainelFerramentaLinksRedundantes();
              setVisible(true);
            }
          });
      // reverter.setActionCommand("Reverter");
      reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
      reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
      reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
      reverter.setBounds(640, 0, 150, 25);
      btnPanel.add(reverter);
    }

    panelBtnTabela.setBackground(frameSilvinha.corDefault);
    painel.setBackground(frameSilvinha.corDefault);
    contentPane.setBackground(frameSilvinha.corDefault);
    scrollPaneTabela.setBackground(frameSilvinha.corDefault);
    textAreaSourceCode.setBackground(frameSilvinha.corDefault);
    miBtnSalvar.setEnabled(false);
    btn_salvar.setEnabled(false);
    salvaAlteracoes =
        TxtBuffer.getInstanciaSalvaAlteracoes(
            textAreaSourceCode.getTextPane(), btn_salvar, miBtnSalvar, frameSilvinha);
    String fil[] = {".html", ".htm"};
    salvaAlteracoes.setFiltro(fil);
    contentPane.add(painel);
    // pack();
    this.setVisible(true);
  }