private void toogle() { boolean selected = jRadioButtonMenuItem3.isSelected(); for (Component comp : jTaskPane1.getComponents()) { if (comp.getClass().equals(MyAnunci.class)) { MyAnunci ma = (MyAnunci) comp; ma.setExpanded(selected); } } }
@Override protected Void doInBackground() throws Exception { isLoading = true; int sel = jComboBox1.getSelectedIndex(); int type = -1; if (sel > 0) { type = AnuncisDefinition.getMapDefined().get(sel - 1).getAnuncisTypeId(); } int orderType = 1; // 0=post date, 1=first event date if (jRadioButtonMenuItem2.isSelected()) { orderType = 0; } ArrayList<AnunciBean> listAnuncis = loadAnuncis(type, orderType); ////// System.out.println("anuncis has been loaded"); MyAnunci first = null; int k = 0; vigents = 0; for (AnunciBean bean : listAnuncis) { ////// System.out.println(this.getStray()+"STRAY"); ////// System.out.println(this.getStray().getFrame()+"FRAME"); MyAnunci ma = new MyAnunci(bean, AnuncisModule.this.getStray().getFrame(), AnuncisModule.this, cfg); if (k == 0) { first = ma; } jTaskPane1.add(ma); k += 1; if (ma.isExpanded()) { vigents += 1; } } if (listAnuncis != null && listAnuncis.isEmpty()) { JTaskPaneGroup emptyLabel = new JTaskPaneGroup(); //////////////// emptyLabel.setCollapsable(false); emptyLabel.setExpanded(false); emptyLabel.setTitle("No s'han trobat anuncis"); jTaskPane1.add(emptyLabel); } listAnuncis.clear(); listAnuncis = null; jTaskPane1.revalidate(); jTaskPane1.repaint(); isLoading = false; return null; }