Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
Corregidos algunos detalles en cuanto al click de los botones.
Browse files Browse the repository at this point in the history
  • Loading branch information
xman40100 committed May 29, 2019
1 parent 75a37a6 commit b055b17
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 103 deletions.
7 changes: 5 additions & 2 deletions src/techdomotica/java/forms/LoginPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,11 @@ private void loggedPassed(String mail) {
@Override
public void onAlmost() {
super.onAlmost();
System.out.println("Just went through here for user!");
if(admin.getPerfilActual() != null) this.jLabel1.setText("<html>Cargando... obteniendo datos de tu perfil...</html>");
else this.jLabel1.setText("<html>Cargando... asignando valores de los componentes...</html>");
System.out.println("Just went through here for admin!");
main = new Main(admin);
System.out.println("After new Main for user!");
System.out.println("After new Main for admin!");
}
public void onComplete() {
super.onComplete();
Expand All @@ -400,6 +402,7 @@ public void onComplete() {
@Override
public void onAlmost() {
super.onAlmost();
this.jLabel1.setText("<html>Cargando... asignando valores de los componentes...</html>");
System.out.println("Just went through here for user!");
main = new Main(usuario);
System.out.println("After new Main for user!");
Expand Down
90 changes: 48 additions & 42 deletions src/techdomotica/java/forms/devices/ACView.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,57 +186,63 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}// </editor-fold>//GEN-END:initComponents

private void activestateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_activestateActionPerformed
progressDialog dialog = new progressDialog(this, true, 3) {
@Override
public void progressBarFilled() {
ambiente.getACondicionado(0).toggleComponenteEncendido(true);
checkAC();
}
};
dialog.setTitle("Encendiendo sendor de puerta");
dialog.textVar.setText("Encendiendo el sensor de la puerta. Por favor, espere...");
dialog.setVisible(true);
if(ambiente.getACondicionado(0).getComponenteEncendidoState() == false) {
progressDialog dialog = new progressDialog(this, true, 3) {
@Override
public void progressBarFilled() {
ambiente.getACondicionado(0).toggleComponenteEncendido(true);
checkAC();
}
};
dialog.setTitle("Encendiendo sendor de puerta");
dialog.textVar.setText("Encendiendo el sensor de la puerta. Por favor, espere...");
dialog.setVisible(true);
}
}//GEN-LAST:event_activestateActionPerformed

private void inactivestateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inactivestateActionPerformed
progressDialog dialog = new progressDialog(this, true, 3) {
@Override
public void progressBarFilled() {
ambiente.getACondicionado(0).toggleComponenteEncendido(false);
checkAC();
}
};
dialog.setTitle("Apagando aire acondicionado");
dialog.textVar.setText("Apagando el aire acondicionado seleccionado. Por favor, espere...");
dialog.setVisible(true);
if(ambiente.getACondicionado(0).getComponenteEncendidoState() == true) {
progressDialog dialog = new progressDialog(this, true, 3) {
@Override
public void progressBarFilled() {
ambiente.getACondicionado(0).toggleComponenteEncendido(false);
checkAC();
}
};
dialog.setTitle("Apagando aire acondicionado");
dialog.textVar.setText("Apagando el aire acondicionado seleccionado. Por favor, espere...");
dialog.setVisible(true);
}
}//GEN-LAST:event_inactivestateActionPerformed

private void activestate1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_activestate1ActionPerformed
// TODO add your handling code here:
progressDialog dialog = new progressDialog(this, true, 3) {
@Override
public void progressBarFilled() {
ambiente.getACondicionado(1).toggleComponenteEncendido(true);
checkAC();
}
};
dialog.setTitle("Encendiendo aire acondicionado");
dialog.textVar.setText("Encendiendo el aire acondicionado seleccionado. Por favor, espere...");
dialog.setVisible(true);
if(ambiente.getACondicionado(1).getComponenteEncendidoState() == false) {
progressDialog dialog = new progressDialog(this, true, 3) {
@Override
public void progressBarFilled() {
ambiente.getACondicionado(1).toggleComponenteEncendido(true);
checkAC();
}
};
dialog.setTitle("Encendiendo aire acondicionado");
dialog.textVar.setText("Encendiendo el aire acondicionado seleccionado. Por favor, espere...");
dialog.setVisible(true);
}
}//GEN-LAST:event_activestate1ActionPerformed

private void inactivestate1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inactivestate1ActionPerformed
// TODO add your handling code here:
progressDialog dialog = new progressDialog(this, true, 3) {
@Override
public void progressBarFilled() {
ambiente.getACondicionado(1).toggleComponenteEncendido(false);
checkAC();
}
};
dialog.setTitle("Apagando aire acondicionado");
dialog.textVar.setText("Apagando el aire acondicionado seleccionado. Por favor, espere...");
dialog.setVisible(true);
if(ambiente.getACondicionado(1).getComponenteEncendidoState() == true) {
progressDialog dialog = new progressDialog(this, true, 3) {
@Override
public void progressBarFilled() {
ambiente.getACondicionado(1).toggleComponenteEncendido(false);
checkAC();
}
};
dialog.setTitle("Apagando aire acondicionado");
dialog.textVar.setText("Apagando el aire acondicionado seleccionado. Por favor, espere...");
dialog.setVisible(true);
}
}//GEN-LAST:event_inactivestate1ActionPerformed

/**
Expand Down
68 changes: 36 additions & 32 deletions src/techdomotica/java/forms/devices/CameraView.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,43 +134,47 @@ private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:even
}//GEN-LAST:event_formWindowClosing

private void camerabtnonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_camerabtnonActionPerformed
progressDialog dialogo = new progressDialog(this, true, 10){
@Override
public void progressBarFilled() {
super.progressBarFilled();
ambient.getCamara(cameraID).toggleComponenteEncendido(true);
try {
Thread.sleep(500);
loadViewIcon(cameraPath, true);
}
catch (InterruptedException ex) {
ex.printStackTrace();
if(ambient.getCamara(cameraID).getComponenteEncendidoState() == false) {
progressDialog dialogo = new progressDialog(this, true, 10){
@Override
public void progressBarFilled() {
super.progressBarFilled();
ambient.getCamara(cameraID).toggleComponenteEncendido(true);
try {
Thread.sleep(500);
loadViewIcon(cameraPath, true);
}
catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
};
dialogo.setTitle("Encendiendo cámara");
dialogo.textVar.setText("Encendiendo la cámara " + ambient.getCamara(cameraID).getComponenteFullName() + ". Por favor espere...");
dialogo.setVisible(true);
};
dialogo.setTitle("Encendiendo cámara");
dialogo.textVar.setText("Encendiendo la cámara " + ambient.getCamara(cameraID).getComponenteFullName() + ". Por favor espere...");
dialogo.setVisible(true);
}
}//GEN-LAST:event_camerabtnonActionPerformed

private void camerabtnoffActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_camerabtnoffActionPerformed
progressDialog dialogo = new progressDialog(this, true, 10){
@Override
public void progressBarFilled() {
super.progressBarFilled();
ambient.getCamara(cameraID).toggleComponenteEncendido(false);
try {
Thread.sleep(500);
loadViewIcon(cameraPath, false);
}
catch (InterruptedException ex) {
ex.printStackTrace();
if(ambient.getCamara(cameraID).getComponenteEncendidoState() == true) {
progressDialog dialogo = new progressDialog(this, true, 10){
@Override
public void progressBarFilled() {
super.progressBarFilled();
ambient.getCamara(cameraID).toggleComponenteEncendido(false);
try {
Thread.sleep(500);
loadViewIcon(cameraPath, false);
}
catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
};
dialogo.setTitle("Apagando cámara");
dialogo.textVar.setText("Apagando la cámara " + ambient.getCamara(cameraID).getComponenteFullName() + ". Por favor espere...");
dialogo.setVisible(true);
};
dialogo.setTitle("Apagando cámara");
dialogo.textVar.setText("Apagando la cámara " + ambient.getCamara(cameraID).getComponenteFullName() + ". Por favor espere...");
dialogo.setVisible(true);
}
}//GEN-LAST:event_camerabtnoffActionPerformed

public void loadViewIcon(String campath, boolean ison) {
Expand Down
10 changes: 5 additions & 5 deletions src/techdomotica/java/forms/devices/DeviceManager.form
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btndeleteac1" max="32767" attributes="0"/>
<Component id="btnrepairac1" pref="90" max="32767" attributes="0"/>
<Component id="btnrepairac1" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
Expand All @@ -132,7 +132,7 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btndeleteac2" alignment="0" max="32767" attributes="0"/>
<Component id="btnrepairac2" alignment="0" pref="91" max="32767" attributes="0"/>
<Component id="btnrepairac2" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
Expand Down Expand Up @@ -412,7 +412,7 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="btndeletecam1" max="32767" attributes="0"/>
<Component id="btnrepaircam1" pref="90" max="32767" attributes="0"/>
<Component id="btnrepaircam1" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
Expand Down Expand Up @@ -866,7 +866,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel8" pref="431" max="32767" attributes="0"/>
<Component id="jLabel8" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
Expand Down Expand Up @@ -1118,7 +1118,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel9" pref="431" max="32767" attributes="0"/>
<Component id="jLabel9" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
Expand Down
48 changes: 28 additions & 20 deletions src/techdomotica/java/forms/devices/DeviceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1344,19 +1344,19 @@ private void registerNewAC() {
}

private void rdbtnonac1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbtnonac1ActionPerformed
ambiente.getACondicionado(0).toggleComponenteEncendido(true);
if(ambiente.getACondicionado(0).getComponenteEncendidoState() == false) ambiente.getACondicionado(0).toggleComponenteEncendido(true);
}//GEN-LAST:event_rdbtnonac1ActionPerformed

private void rdbtnoffac1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbtnoffac1ActionPerformed
ambiente.getACondicionado(0).toggleComponenteEncendido(false);
if(ambiente.getACondicionado(0).getComponenteEncendidoState() == true) ambiente.getACondicionado(0).toggleComponenteEncendido(false);
}//GEN-LAST:event_rdbtnoffac1ActionPerformed

private void rdbtnonac2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbtnonac2ActionPerformed
ambiente.getACondicionado(1).toggleComponenteEncendido(true);
if(ambiente.getACondicionado(0).getComponenteEncendidoState() == false) ambiente.getACondicionado(1).toggleComponenteEncendido(true);
}//GEN-LAST:event_rdbtnonac2ActionPerformed

private void rdbtnoffac2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbtnoffac2ActionPerformed
ambiente.getACondicionado(1).toggleComponenteEncendido(false);
if(ambiente.getACondicionado(0).getComponenteEncendidoState() == true) ambiente.getACondicionado(1).toggleComponenteEncendido(false);
}//GEN-LAST:event_rdbtnoffac2ActionPerformed

private void btndeleteac2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btndeleteac2ActionPerformed
Expand Down Expand Up @@ -1769,25 +1769,29 @@ public void progressBarFilled() {
public void saveChangesToMain() {}

private void toggleCamera(int id, boolean onoff) {
onoffCamera(ambiente.getCamara(id), new progressDialog(this, true, 10) {
@Override
public void progressBarFilled() {
ambiente.getCamara(id).toggleComponenteEncendido(onoff);
}
}, "Encendiendo componente", "Modificando valores de la cámara " + ambiente.getCamara(id).getComponenteFullName() + ", puede tardar unos segundos.");
if(ambiente.getCamara(id).getComponenteEncendidoState() == !onoff) {
onoffCamera(ambiente.getCamara(id), new progressDialog(this, true, 10) {
@Override
public void progressBarFilled() {
ambiente.getCamara(id).toggleComponenteEncendido(onoff);
}
}, "Encendiendo componente", "Modificando valores de la cámara " + ambiente.getCamara(id).getComponenteFullName() + ", puede tardar unos segundos.");
}
}

private void toggleDevice(Componente comp, int timevalue, boolean onoff) {
progressDialog dialogo = new progressDialog(this, true, timevalue) {
@Override
public void progressBarFilled() {
comp.toggleComponenteEncendido(onoff);
}
};
if(onoff) dialogo.setTitle("Encendiendo dispositivo");
else dialogo.setTitle("Apagando dispositivo");
dialogo.textVar.setText("<html>Modificando valores del dispositivo " + comp.getComponenteFullName() + ", puede tardar unos segundos...</html>");
dialogo.setVisible(true);
if(comp.getComponenteEncendidoState() == !onoff) {
progressDialog dialogo = new progressDialog(this, true, timevalue) {
@Override
public void progressBarFilled() {
comp.toggleComponenteEncendido(onoff);
}
};
if(onoff) dialogo.setTitle("Encendiendo dispositivo");
else dialogo.setTitle("Apagando dispositivo");
dialogo.textVar.setText("<html>Modificando valores del dispositivo " + comp.getComponenteFullName() + ", puede tardar unos segundos...</html>");
dialogo.setVisible(true);
}
}

private void cameraView(String campath, String title, boolean ison) {
Expand Down Expand Up @@ -1835,6 +1839,10 @@ private void removeAdminStuff() {
if(ambiente.getAdminEncargado() == null) {
btndeleteac1.setVisible(false);
btndeleteac2.setVisible(false);

jTabbedPane1.remove(jPanel2);
jTabbedPane1.remove(jPanel3);

jPanel2.setVisible(false);
jPanel3.setVisible(false);
}
Expand Down
3 changes: 3 additions & 0 deletions src/techdomotica/java/forms/screens/SplashScreen.form
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
</Property>
<Property name="text" type="java.lang.String" value="&lt;html&gt;Cargando... obteniendo dispositivos...&lt;/html&gt;"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
Expand Down
4 changes: 2 additions & 2 deletions src/techdomotica/java/forms/screens/SplashScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void onHalf() {
}

public void onAlmost() {
jLabel1.setText("<html>Cargando... obteniendo datos de perfil...</html>");

}

public void onComplete() { }
Expand Down Expand Up @@ -177,7 +177,7 @@ public void run() {
}

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
public javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JLabel logoLabel;
Expand Down

0 comments on commit b055b17

Please sign in to comment.