public void resetBag(final IkonBag aBag) { bag = aBag; if (jmenaVybranychAlel == null) { final Genotyp genotypVychozi = bag.getGenom().getGenotypVychozi(); jmenaVybranychAlel = Alela.alelyToNames(genotypVychozi.getAlely()); } refresh(aBag, jmenaVybranychAlel, null); }
public void onEvent(final PoziceChangedEvent event) { final Wpt wpt = event.poziceq.getWpt(); if (wpt == null) { return; } if (bag == null) { return; } jmenaVybranychAlel = Alela.alelyToNames(wpt.getGenotyp(bag.getGenom()).getAlely()); zobrazovatVse = true; refresh(bag, jmenaVybranychAlel, null); }
@Override protected void zmenaVyberu(final Set<Alela> aAlelyx) { jmenaVybranychAlel = Alela.alelyToNames(aAlelyx); final Genotyp genotyp = new Genotyp(aAlelyx, bag.getGenom()); final Sklivec sklivec = bag.getSklivec(genotyp); jskelneikony.removeAll(); // BoundingRect br = Imagant.sjednoceni(sklivec.imaganti); { jskelneikony.add(Box.createVerticalStrut(20)); final JButton jLabel = new JButton(); jLabel.setAlignmentX(CENTER_ALIGNMENT); // jLabel.setText("všechna skla přes sebe"); final Imagant imagant = Sklo.prekresliNaSebe(sklivec.imaganti); if (imagant != null) { jLabel.setIcon(new ImageIcon(imagant.getImage())); } jskelneikony.add(jLabel); } jskelneikony.add(Box.createVerticalStrut(50)); final Iterator<SkloAplikant> iterator = bag.getSada().getSkloAplikanti().iterator(); for (final Imagant imagant : sklivec.imaganti) { final SkloAplikant skloAplikant = iterator.next(); final Box panel = Box.createHorizontalBox(); final TitledBorder border = BorderFactory.createTitledBorder(skloAplikant.sklo.getName()); border.setTitleJustification(TitledBorder.CENTER); panel.setBorder(border); final JLabel jLabel = new JLabel(); // jLabel.setText("sklo"); if (imagant != null) { jLabel.setIcon(new ImageIcon(imagant.getImage())); } jLabel.setAlignmentX(CENTER_ALIGNMENT); panel.add(Box.createHorizontalGlue()); panel.add(jLabel); panel.add(Box.createHorizontalGlue()); panel.setMinimumSize(new Dimension(150, 100)); panel.setPreferredSize(new Dimension(150, 100)); // JLabel jJmenoSady = new JLabel(skloAplikant.sklo.getName()); // jJmenoSady.setAlignmentX(JComponent.CENTER_ALIGNMENT); // jskelneikony.add(jJmenoSady); jskelneikony.add(panel); jskelneikony.add(Box.createVerticalStrut(10)); } jskelneikony.add(Box.createVerticalGlue()); final JCheckBox jZobrazovaniVseho = new JCheckBox("Zobrazit vše"); jZobrazovaniVseho.setSelected(zobrazovatVse); jskelneikony.add(jZobrazovaniVseho); jZobrazovaniVseho.addItemListener( e -> { zobrazovatVse = jZobrazovaniVseho.isSelected(); resetBag(bag); }); // a teď vyrendrovat vše přes sebe System.out.println(genotyp); jskelneikony.revalidate(); // pack(); }
/* * (non-Javadoc) * * @see geokuk.mapicon.JVyberIkon0#shouldRender(geokuk.mapicon.Alela) */ @Override protected boolean shouldRender(final Alela alela) { return alela.isVychozi() || bag.getSada().getPouziteAlely().contains(alela) || zobrazovatVse; }
@Override protected boolean shouldEnable(final Alela alela) { return alela.isVychozi() || bag.getSada().getPouziteAlely().contains(alela); }