Update TextField after loadind-indicator done

Hi,

How can i update a TextField just when loading indicator stop ?

The TextField must be setEnabled(false) while loadind indicator shows and setEnabled(true) when completed.


public void adicionar() {
		
		if(!codigo.getValue().toString().trim().matches("[0-9]
+")) {
			codigo.setEnabled(true);
			btnAdicionar.setEnabled(true);
			codigo.selectAll();
			return;
		}
		
		if(codigo.getValue().toString().trim().equals("")) {
			codigo.setEnabled(true);
			btnAdicionar.setEnabled(true);
			codigo.focus();
			return;
		}
		
		if(quantidade.getValue().toString().trim().equals("")) {
			codigo.setEnabled(true);
			btnAdicionar.setEnabled(true);
			quantidade.focus();
			return;
		}
		
		if(!quantidade.getValue().toString().trim().matches("[0-9]
+")) {
			codigo.setEnabled(true);
			btnAdicionar.setEnabled(true);
			quantidade.selectAll();
			return;
		}
		
		codigo.setEnabled(false);
		
		String codBusca = codigo.getValue().toString().trim();
		int qtde = Integer.parseInt(quantidade.getValue().toString().trim());
		
		Connection conexao = null;
		List<Object[]> listagem = null;
		try {
			
			conexao = ConnectionFactory.getConnection();
			ContagemDao dao = new ContagemDao(conexao);
			
			dao.lancaContagem(codBusca, qtde, idSecao, idUsuario);
			listagem = dao.listaContagemSecao(idSecao);
			
			if(listagem != null) {
				
				table.removeAllItems();
				
				for(Object obj[] : listagem) {
					
					table.addItem(new Object[] {obj[0]
, obj[1]
, obj[2]
, obj[3]
}, ++cont);
					
				}
				
			}
			
		}
		catch(SQLException e) {
			
			getParent().getWindow().showNotification("LancaContagem : " + e.getMessage());
			codigo.setEnabled(true);
			btnAdicionar.setEnabled(true);
			return;
			
		}
		finally {
			
			codigo.setValue("");
			codigo.setEnabled(true);
			btnAdicionar.setEnabled(true);
			
		}

Thanks for any help !

Good question.
Something like PartialRenderListener.renderStarted()/renderEnded() to add to the MainWindow or the Application would be useful.
The hooks for this already exist and are used to show the loading indicator. They have to be public api :wink:

Thank you for answer me Jan Richter !

Can you explain me how do this ? Using hook !
If possible, a example, using my code posted!
Thank you.

Please !! Anyone can help me ?

My posting was just a suggestion to the developers.

If you only want to disable input fields while the loading indicator is showing - use css.
You can modify the busy indicator div to span over the whole screen with black background and 95% transparency (glass pane effect). this should block all user inputs.