Skip to content

Commit

Permalink
💎 modificando o JOption Pane para tema do Portugol (#365)
Browse files Browse the repository at this point in the history
* 💎 iniciando desenvolvimento dos panes

* Finalizando Question Dialog

* Modificando algumas cores
  • Loading branch information
AlissonSteffens authored and AdsonEsteves committed Nov 10, 2017
1 parent ebf20cd commit bdf3f6d
Show file tree
Hide file tree
Showing 17 changed files with 225 additions and 152 deletions.
5 changes: 3 additions & 2 deletions ide/src/main/java/br/univali/ps/nucleo/Configuracoes.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package br.univali.ps.nucleo;

import br.univali.ps.ui.swing.weblaf.jOptionPane.QuestionDialog;
import br.univali.ps.ui.telas.TelaPrincipal;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
Expand Down Expand Up @@ -355,7 +356,7 @@ public void restartApplication()
}
else
{
JOptionPane.showMessageDialog(telaPrincipal, "Você deve fechar todas as abas de código antes de reiniciar", "Portugol Studio", JOptionPane.INFORMATION_MESSAGE);
QuestionDialog.getInstance().showMessage("Você deve fechar todas as abas de código antes de reiniciar");
if(temaPortugol.equals("Dark"))
{
setTemaPortugol("Portugol");
Expand All @@ -370,7 +371,7 @@ public void restartApplication()

private boolean confirmouReinicializacao()
{
int resp = JOptionPane.showConfirmDialog(null, "Para trocar de tema o Portugol Studio precisa reinicializar! Confirma?", "Confirmar", JOptionPane.YES_NO_CANCEL_OPTION);
int resp = QuestionDialog.getInstance().showConfirmMessage("Para trocar de tema o Portugol Studio precisa reinicializar! Confirma?");
if (resp == JOptionPane.YES_OPTION)
{
return true;
Expand Down
5 changes: 3 additions & 2 deletions ide/src/main/java/br/univali/ps/nucleo/PortugolStudio.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import br.univali.ps.ui.telas.TelaCustomBorder;
import br.univali.ps.ui.utils.FabricaDicasInterface;
import br.univali.ps.ui.swing.weblaf.WeblafUtils;
import br.univali.ps.ui.swing.weblaf.jOptionPane.QuestionDialog;
import br.univali.ps.ui.telas.Sobre;
import br.univali.ps.ui.telas.TelaAtalhos;
import br.univali.ps.ui.telas.TelaRelatarBug;
Expand Down Expand Up @@ -466,15 +467,15 @@ private boolean versaoJavaCorreta()

if (Double.valueOf(property) < 1.7)
{
JOptionPane.showMessageDialog(null, "Para executar o Portugol Studio é preciso utilizar o Java 1.7 ou superior.", "Portugol Studio", JOptionPane.ERROR_MESSAGE);
QuestionDialog.getInstance().showMessage("Para executar o Portugol Studio é preciso utilizar o Java 1.7 ou superior.", JOptionPane.ERROR_MESSAGE);
return false;
}

return true;
}
catch (HeadlessException | NumberFormatException excecao)
{
JOptionPane.showMessageDialog(null, "Não foi possível determinar a versão do Java. O Portugol Studio será encerrado!", "Portugol Studio", JOptionPane.ERROR_MESSAGE);
QuestionDialog.getInstance().showMessage("Não foi possível determinar a versão do Java. O Portugol Studio será encerrado!", JOptionPane.ERROR_MESSAGE);
return false;
}
}
Expand Down
3 changes: 2 additions & 1 deletion ide/src/main/java/br/univali/ps/nucleo/TratadorExcecoes.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import static br.univali.ps.nucleo.ExcecaoAplicacao.Tipo.ERRO_PROGRAMA;
import br.univali.ps.ui.swing.weblaf.jOptionPane.QuestionDialog;

/**
*
Expand Down Expand Up @@ -85,7 +86,7 @@ private void exibir(final ExcecaoAplicacao excecaoAplicacao)

private void exibirExcecaoSimples(ExcecaoAplicacao excecaoAplicacao, int tipoDialogo)
{
JOptionPane.showMessageDialog(null, excecaoAplicacao.getMessage(), "Portugol Studio", tipoDialogo);
QuestionDialog.getInstance().showMessage(excecaoAplicacao.getMessage(), tipoDialogo);

if (encerrarAplicacao)
{
Expand Down
14 changes: 7 additions & 7 deletions ide/src/main/java/br/univali/ps/ui/abas/AbaCodigoFonte.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import br.univali.ps.ui.utils.IconFactory;
import br.univali.ps.ui.swing.weblaf.BarraDeBotoesExpansivel;
import br.univali.ps.ui.swing.weblaf.WeblafUtils;
import br.univali.ps.ui.swing.weblaf.jOptionPane.QuestionDialog;
import br.univali.ps.ui.telas.TelaPrincipal;
import com.alee.laf.button.WebButton;
import java.awt.*;
Expand Down Expand Up @@ -806,7 +807,7 @@ public void actionPerformed(ActionEvent e)
}
else
{
JOptionPane.showMessageDialog(AbaCodigoFonte.this, "Este arquivo já está aberto em outra aba.\nPor favor feche o arquivo aberto antes de sobrescrevê-lo.", "Portugol Studio", JOptionPane.WARNING_MESSAGE);
QuestionDialog.getInstance().showMessage("Este arquivo já está aberto em outra aba.\nPor favor feche o arquivo aberto antes de sobrescrevê-lo.", JOptionPane.WARNING_MESSAGE);
usuarioCancelouSalvamento = true;
}
Configuracoes.getInstancia().setCaminhoUltimoDiretorio(dialogoSelecaoArquivo.getCurrentDirectory());
Expand Down Expand Up @@ -1162,7 +1163,7 @@ public void componentShown(final ComponentEvent e)
editor.getTextArea().requestFocusInWindow();

if (Configuracoes.getInstancia().isExibirAvisoRenomear()) {
JOptionPane.showMessageDialog(AbaCodigoFonte.this, ""
QuestionDialog.getInstance().showMessage(""
+ "O Portugol Studio tem uma novidade! Agora você pode renomear elementos do seu programa\n"
+ "como, por exemplo, variáveis e funções."
+ "\n\n"
Expand All @@ -1172,7 +1173,7 @@ public void componentShown(final ComponentEvent e)
+ "Você também pode renomear através do editor de código fonte, posicionando o cursor do teclado\n"
+ "sobre o nome do elemento e pressionando a combinação de teclas: Ctrl + R."
+ "\n\n"
+ "Que a força esteja com você!!!", "Portugol Studio", JOptionPane.INFORMATION_MESSAGE);
+ "Que a força esteja com você!!!", JOptionPane.INFORMATION_MESSAGE);
Configuracoes.getInstancia().setExibirAvisoRenomear(false);
}
});
Expand Down Expand Up @@ -1217,7 +1218,7 @@ public void mousePressed(MouseEvent e)
{
if ((programaCompilado != null && programaCompilado.isExecutando()))
{
JOptionPane.showMessageDialog(AbaCodigoFonte.this, "Não é possível renomear enquanto o programa está executando. Interrompa o programa e tente novamente");
QuestionDialog.getInstance().showMessage("Não é possível renomear enquanto o programa está executando. Interrompa o programa e tente novamente");
editor.getTextArea().requestFocusInWindow();
}
else
Expand Down Expand Up @@ -1861,9 +1862,8 @@ public boolean fechandoAba(Aba aba)
}

if (arquivoModificado())
{
int resp = JOptionPane.showConfirmDialog(this, String.format("O documento '%s' possui modificações, deseja Salvá-las?", getCabecalho().getTitulo()), "Confirmar", JOptionPane.YES_NO_CANCEL_OPTION);

{
int resp = QuestionDialog.getInstance().showConfirmMessage(String.format("O documento '%s' possui modificações, deseja Salvá-las?", getCabecalho().getTitulo()));
if (resp == JOptionPane.YES_OPTION)
{
acaoSalvarArquivo.actionPerformed(null);
Expand Down
4 changes: 3 additions & 1 deletion ide/src/main/java/br/univali/ps/ui/abas/AbaInicial.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import br.univali.ps.ui.swing.Themeable;
import br.univali.ps.ui.utils.WebConnectionUtils;
import br.univali.ps.ui.paineis.PainelTabuladoPrincipal;
import br.univali.ps.ui.swing.weblaf.jOptionPane.QuestionDialog;
import br.univali.ps.ui.telas.TelaPrincipal;
import br.univali.ps.ui.utils.IconFactory;
import java.awt.Cursor;
Expand Down Expand Up @@ -146,7 +147,7 @@ public void actionPerformed(ActionEvent e)
rotuloAssistirVideoAulas.setIcon(gif);
rotuloConhecerBibliotecas.setIcon(gif);
rotuloConhecerLinguagem.setIcon(gif);
JOptionPane.showMessageDialog(null, gif, "Never gonna", JOptionPane.PLAIN_MESSAGE);
QuestionDialog.getInstance().showMessage("Eita!!!");
}
}
catch (Exception ex)
Expand All @@ -155,6 +156,7 @@ public void actionPerformed(ActionEvent e)
}
}
});

}

private void configurarResolucao()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import br.univali.ps.ui.utils.IconFactory;
import br.univali.ps.ui.swing.weblaf.PSTreeUI;
import br.univali.ps.ui.swing.weblaf.WeblafUtils;
import br.univali.ps.ui.swing.weblaf.jOptionPane.QuestionDialog;
import java.awt.Component;
import java.awt.Desktop;
import java.io.BufferedReader;
Expand Down Expand Up @@ -470,7 +471,7 @@ public void hyperlinkUpdate(HyperlinkEvent evt)
String urlString = evt.getURL().toExternalForm();
if (urlString == null)
{
JOptionPane.showMessageDialog(this, "Erro: Link inválido", "Erro", JOptionPane.ERROR_MESSAGE);
QuestionDialog.getInstance().showMessage("Erro: Link inválido", JOptionPane.ERROR_MESSAGE);
}

try
Expand All @@ -482,12 +483,12 @@ public void hyperlinkUpdate(HyperlinkEvent evt)
}
else
{
JOptionPane.showMessageDialog(this, "Erro: Não foi possível abrir o navegador Web", "Erro", JOptionPane.ERROR_MESSAGE);
QuestionDialog.getInstance().showMessage("Erro: Não foi possível abrir o navegador Web", JOptionPane.ERROR_MESSAGE);
}
}
catch (Throwable excep)
{
JOptionPane.showMessageDialog(this, "Erro: Não foi possível abrir o navegador Web", "Erro", JOptionPane.ERROR_MESSAGE);
QuestionDialog.getInstance().showMessage("Erro: Não foi possível abrir o navegador Web", JOptionPane.ERROR_MESSAGE);
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions ide/src/main/java/br/univali/ps/ui/editor/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import br.univali.ps.ui.rstautil.SuportePortugolImpl;
import br.univali.ps.ui.utils.IconFactory;
import br.univali.ps.ui.swing.weblaf.WeblafUtils;
import br.univali.ps.ui.swing.weblaf.jOptionPane.QuestionDialog;
import com.alee.laf.WebLookAndFeel;
import java.awt.BorderLayout;
import java.awt.Color;
Expand Down Expand Up @@ -432,7 +433,7 @@ public void actionPerformed(ActionEvent e)
}
else
{
JOptionPane.showMessageDialog(Editor.this, "Não é possível renomear enquanto o programa está executando. Interrompa o programa e tente novamente");
QuestionDialog.getInstance().showMessage("Não é possível renomear enquanto o programa está executando. Interrompa o programa e tente novamente");
textArea.requestFocusInWindow();
}
}
Expand Down Expand Up @@ -1656,7 +1657,7 @@ public void searchEvent(SearchEvent e)
break;
case REPLACE_ALL:
result = SearchEngine.replaceAll(textArea, context);
JOptionPane.showMessageDialog(null, result.getCount()
QuestionDialog.getInstance().showMessage(result.getCount()
+ " ocorrências substituídas.");
break;
}
Expand Down Expand Up @@ -1708,7 +1709,7 @@ private void reiniciar(SearchContext context, RSyntaxTextArea textArea, SearchEv
s = "A pesquisa chegou no final do arquivo, deseja recomeçar do início?";
}

if (JOptionPane.showConfirmDialog(getParent(), s, "Pesquisar", JOptionPane.YES_OPTION) == JOptionPane.YES_OPTION)
if (QuestionDialog.getInstance().showConfirmMessage(s, JOptionPane.YES_OPTION) == JOptionPane.YES_OPTION)
{
if (context.getSearchForward())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Component class="com.alee.laf.button.WebButton" name="botaoCancelar">
<Properties>
<Property name="text" type="java.lang.String" value="Cancelar"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="botaoCancelarActionPerformed"/>
</Events>
</Component>
<Component class="com.alee.laf.button.WebButton" name="botaoNao">
<Properties>
<Property name="text" type="java.lang.String" value="N&#xe3;o"/>
</Properties>
</Component>
<Component class="com.alee.laf.button.WebButton" name="botaoSim">
<Properties>
<Property name="text" type="java.lang.String" value="Sim"/>
</Properties>
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="undecorated" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[400, 160]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
Expand All @@ -19,17 +42,12 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-67,0,0,1,-8"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-108,0,0,1,-8"/>
</AuxValues>

<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[450, 200]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
Expand All @@ -42,7 +60,7 @@
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="15" left="15" right="15" top="15"/>
<EmptyBorder/>
</Border>
</Property>
</Properties>
Expand All @@ -57,7 +75,7 @@
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/br/univali/ps/ui/icones/Dark/grande/lite/ajuda.png"/>
<Image iconType="3" name="/br/univali/ps/ui/icones/Dark/grande/big_logo.png"/>
</Property>
</Properties>
<Constraints>
Expand All @@ -78,11 +96,11 @@

<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Container class="javax.swing.JPanel" name="buttonsPane">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="2" left="2" right="2" top="20"/>
<EmptyBorder/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
Expand All @@ -96,26 +114,6 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
<Property name="horizontalGap" type="int" value="30"/>
</Layout>
<SubComponents>
<Component class="com.alee.laf.button.WebButton" name="webButton3">
<Properties>
<Property name="text" type="java.lang.String" value="Sim"/>
</Properties>
</Component>
<Component class="com.alee.laf.button.WebButton" name="webButton4">
<Properties>
<Property name="text" type="java.lang.String" value="N&#xe3;o"/>
</Properties>
</Component>
<Component class="com.alee.laf.button.WebButton" name="webButton2">
<Properties>
<Property name="text" type="java.lang.String" value="Cancelar"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="webButton2ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="textLabel">
<Properties>
Expand Down
Loading

0 comments on commit bdf3f6d

Please sign in to comment.