public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() >= 2) {
     int row = this.tabelaDeErros.getSelectedRow();
     if (row == -1) return;
     int linhaToGo = Integer.parseInt(tabelaDeErros.getValueAt(row, 0).toString());
     if (linhaToGo == 0) return;
     textAreaSourceCode.goToLine(linhaToGo);
     textAreaSourceCode.selectLine(linhaToGo);
     erroAtual = row;
     btnAplicar.setEnabled(true);
     RegrasHardCodedEmag regra = new RegrasHardCodedEmag();
     texto.setText(regra.getAtributo(controle.getTag(erroAtual), "alt"));
   }
 }
 public void avaliaUrl(String url) {
   PegarPaginaWEB ppw = new PegarPaginaWEB();
   if (url != null) {
     arquivo = null;
     try {
       String codHtml = ppw.getContent(url);
       textAreaSourceCode.setText(codHtml);
       TxtBuffer.setContentOriginal(codHtml, "0");
       reavalia(codHtml);
       this.painelOriginal.avalia(codHtml);
     } catch (HttpException e1) {
       JOptionPane.showMessageDialog(
           this,
           TradPainelAvaliacao.AVISO_NAO_CONECTOU,
           TradPainelAvaliacao.AVISO,
           JOptionPane.WARNING_MESSAGE);
     } catch (Exception e1) {
       JOptionPane.showMessageDialog(
           this,
           TradPainelAvaliacao.AVISO_VERIFIQUE_URL,
           TradPainelAvaliacao.AVISO,
           JOptionPane.WARNING_MESSAGE);
     }
   }
 }
 /**
  * Construtor
  *
  * @param frameSilvinha
  */
 public PanelLinkRedundante(FrameSilvinha frameSilvinha, String codHtml) {
   XHTML_Panel.carregaTexto(TokenLang.LANG);
   this.frameSilvinha = frameSilvinha;
   criaInterfaceVisualEscalavel();
   atribuiActionCommand();
   arquivo = null;
   textAreaSourceCode.setText(codHtml);
   reavalia(codHtml);
 }
  private void reavalia(String codigo) {

    tabelaDeErros.initComponents();
    // boxCode.coloreSource();
    controle = new ControleLinkRedundante();
    // xhtmlValidator.avalia(arquivo.getFile());

    controle.avalia(codigo);
    if (controle.length() == 0) {
      tabelaDeErros.addLinha(0, 0, XHTML_Panel.DOC_SEM_ERROS);
    }

    for (int i = 0; i < controle.length(); i++) {
      tabelaDeErros.addLinha(controle.getLinha(i), controle.getColuna(i), controle.getTag(i));
      // boxCode.marcaErro(ini, fim);
      textAreaSourceCode.marcaErro(
          controle.getLinha(i), controle.getColuna(i), controle.getTag(i).length());
    }
    btnAplicar.setEnabled(false);
    // domValidator
  }
 /**
  * Avalia o código
  *
  * @param codHtml codigo HTML
  */
 private void avalia(String codHtml) {
   textAreaSourceCode.setText(codHtml);
   reavalia(codHtml);
 }
  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();
    }
  }
  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);
  }