public void cargarCmbShort(JComboBox cmbShort, ComboBox cmbpadre) { opcionListaCombo opcion = new opcionListaCombo(); if (cmbShort.getName().equals("cmbshrnivel")) opcion = new opcionListaCombo((short) 1, "Nivel: " + 1); else opcion = new opcionListaCombo((short) 1, "Pos: " + 1); List<opcionListaCombo> lstopcion = new ArrayList<opcionListaCombo>(); if (cmbpadre.getSelectedItem().getClass().getCanonicalName().equals("SwingBernate.dtoVacio")) { lstopcion.add(opcion); DefaultComboBoxModel shrotModelo = new DefaultComboBoxModel(lstopcion.toArray()); cmbShort.setModel(shrotModelo); } }
public void itemStateChanged(ItemEvent event) { JComboBox comboBox = (JComboBox) event.getSource(); if (event.getStateChange() == 1) { if (comboBox.getName().equals("streamType")) { if (this.getTimer().getStreamingEngine() == 0) { this.getTimer().setJgrabberStreamType((String) comboBox.getSelectedItem()); } else { this.getTimer().setUdrecStreamType((String) comboBox.getSelectedItem()); } } if (comboBox.getName().equals("sender")) { int senderIndex = comboBox.getSelectedIndex(); BOSender sender = (BOSender) this.getControlTimer().getSenderList().get(senderIndex); timer.getMainTimer().setChannelId(sender.getChanId()); timer.getMainTimer().setSenderName(sender.getName()); } if (comboBox.getName().equals("repeat")) { this.setEventRepeatId((String) comboBox.getSelectedItem()); } } }
private void collectFieldValues() { params.clear(); for (Object control : namedControls) { if (control instanceof JWFNumberField) { JWFNumberField numberField = (JWFNumberField) control; params.put(numberField.getName(), new ScriptParam(numberField.getDoubleValue())); } else if (control instanceof JTextField) { JTextField textField = (JTextField) control; params.put(textField.getName(), new ScriptParam(textField.getText())); } else if (control instanceof JComboBox) { JComboBox comboBox = (JComboBox) control; params.put(comboBox.getName(), new ScriptParam((String) comboBox.getSelectedItem())); } else if (control instanceof JCheckBox) { JCheckBox checkBox = (JCheckBox) control; params.put(checkBox.getName(), new ScriptParam(checkBox.isSelected())); } else { throw new IllegalStateException(control.getClass().getName()); } } }
/** Called when the user presses Next on this panel */ public void exitingToRight() throws Exception { /** guardamos las celdas que tienen usuario asignado * */ JComboBox jCombo = null; String idCelda; String idSelectedUsuario; HashMap<String, String> celdasUsuarios = new HashMap<String, String>(); // lista de usuarios asignados a la celda que es índice int selectedIndex; for (int i = 0; i < jComboList.size(); i++) { jCombo = jComboList.get(i); idCelda = jCombo.getName(); selectedIndex = jCombo.getSelectedIndex(); idSelectedUsuario = ComboItemGraticuleListener.SIN_ASIGNAR; if (selectedIndex > 0) { idSelectedUsuario = listaUsuariosPermisos.get(selectedIndex - 1).getId(); } celdasUsuarios.put(idCelda, idSelectedUsuario); } // añadimos al clipboard el map generado blackboard.put(MOBILE_USERS_GRATICULES, celdasUsuarios); }
private JScrollPane getGraticuleCells() { // sacamos las cuadrículas de la rejilla LayerManager layerManager = context.getLayerManager(); Layer graticuleLayer = layerManager.getLayer(GraticuleCreatorEngine.getGraticuleName()); if (graticuleLayer != null) { FeatureCollectionWrapper fCollWrapper = graticuleLayer.getFeatureCollectionWrapper(); List featList = fCollWrapper.getFeatures(); jComboList = new ArrayList<JComboBox>(); Feature feature = null; Integer cellId = null; JPanel jPaneCells = new JPanel(); int cols = featList.size() / 2; if (featList.size() % 2 != 0) { cols++; } jPaneCells.setLayout(new GridLayout(cols, 2)); // //capas extraídas // ArrayList<GeopistaLayer> writeableLayers = (ArrayList<GeopistaLayer>) // blackboard.get(MobileExtractPanel01.MOBILE_WRITEABLE_LAYERS); // ArrayList<GeopistaLayer> readableLayers = (ArrayList<GeopistaLayer>) // blackboard.get(MobileExtractPanel01.MOBILE_READABLE_LAYERS); // ArrayList<String> listLayersId = new ArrayList<String>(); // GeopistaLayer geopistaLayer = null; // for(int i=0; i<writeableLayers.size(); i++){ // geopistaLayer = writeableLayers.get(i); // listLayersId.add(String.valueOf(geopistaLayer.getId_LayerDataBase())); // } // for(int i=0; i<readableLayers.size(); i++){ // geopistaLayer = readableLayers.get(i); // listLayersId.add(String.valueOf(geopistaLayer.getId_LayerDataBase())); // } // obtenemos el proyecto de extracción seleccionado de la pantalla anterior ExtractionProject eProject = (ExtractionProject) blackboard.get(MobileAssignCellsPanel01.SELECTED_EXTRACT_PROJECT); JPanel auxPanel = null; arrayNombresUsuarios = null; listaUsuariosPermisos = null; HashMap<String, String> usuariosAsignados = null; final String sUrlPrefix = Constants.APLICACION.getString("geopista.conexion.servidorurl"); try { // añadimos los usuarios a los combos AdministradorCartografiaClient administradorCartografiaClient = new AdministradorCartografiaClient( sUrlPrefix + WebAppConstants.GEOPISTA_WEBAPP_NAME + ServletConstants.ADMINISTRADOR_CARTOGRAFIA_SERVLET_NAME); ListaUsuarios usersRealList = (ListaUsuarios) administradorCartografiaClient.getUsersPermLayers( eProject.getIdExtractLayersList()); // usuarios ya asignados usuariosAsignados = administradorCartografiaClient.getAssignCellsExtractProject(eProject.getIdProyecto()); // usuarios con permisos sobre las capas Hashtable<String, Usuario> usuariosReales = (Hashtable<String, Usuario>) usersRealList.gethUsuarios(); Set<String> keySetUsers = usuariosReales.keySet(); arrayNombresUsuarios = new String[keySetUsers.size() + 1]; arrayNombresUsuarios[0] = ComboItemGraticuleListener.SIN_ASIGNAR; listaUsuariosPermisos = new ArrayList<Usuario>(); String userKey = null; Usuario usuario = null; int k = 1; for (Iterator iterator = keySetUsers.iterator(); iterator.hasNext(); ) { userKey = (String) iterator.next(); usuario = usuariosReales.get(userKey); arrayNombresUsuarios[k] = usuario.getName(); listaUsuariosPermisos.add(usuario); k++; } } catch (Exception e) { e.printStackTrace(); } JComboBox jcombo = null; ILayerViewPanel layerViewPanel = (ILayerViewPanel) context.getLayerViewPanel(); JLabel jLabelCelda = null; String cellIdStr = null; Map<Layer, HashSet<Feature>> visibleLayerToFeaturesInFenceMap = null; graticuleLayer.setVisible(false); // para quitar la cuadrícula de la intersección // añadimos el identificador de cada una al panel for (int i = 0; i < featList.size(); i++) { feature = (Feature) featList.get(i); visibleLayerToFeaturesInFenceMap = layerViewPanel.visibleLayerToFeaturesInFenceMap(feature.getGeometry()); cellId = (Integer) feature.getAttribute(GraticuleCreatorEngine.ATR_CELL_ID); auxPanel = new JPanel(); jLabelCelda = new JLabel( I18N.get( MobileAssignCellsPlugin.PluginMobileExtracti18n, MobilePluginI18NResource.MobileAssignCellsPanel02_celda) + cellId); jcombo = new JComboBox(arrayNombresUsuarios); cellIdStr = String.valueOf(cellId); jcombo.setName(cellIdStr); // celdas con features o sin ellas if (visibleLayerToFeaturesInFenceMap == null || visibleLayerToFeaturesInFenceMap.size() == 0) { jLabelCelda.setEnabled(false); jcombo.setEnabled(false); } else { jLabelCelda.setForeground(Color.RED); jcombo.addItemListener( new ComboItemGraticuleListener( layerViewPanel, graticuleLayer, feature, jLabelCelda, wizardContext)); jComboList.add(jcombo); } auxPanel.add(jLabelCelda); auxPanel.add(jcombo); jPaneCells.add(auxPanel); } graticuleLayer.setVisible(true); // seleccionamos los usuario asignados en los combos if (usuariosAsignados != null && usuariosAsignados.size() != 0) { for (int i = 0; i < jComboList.size(); i++) { jcombo = jComboList.get(i); cellIdStr = jcombo.getName(); if (usuariosAsignados.containsKey(cellIdStr)) { seleccionaUsuarioComboCelda(jcombo, usuariosAsignados.get(cellIdStr)); } } } jPaneInternal = new JScrollPane(); jPaneInternal.setViewportView(jPaneCells); jPaneInternal.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); } return jPaneInternal; }
public String getAnrede() { return jComboBox1.getName(); }