예제 #1
0
  /** @see Editor#addEditorForm() */
  @Override
  public void addEditorForm() {
    if (initiallyNull) {
      model = new JTextField();
    } else {
      model = new JTextField(item.model);
      model.setEnabled(false);
    }

    model.setPreferredSize(fieldSize);

    addField(TABLE_BUS_MODEL, model);

    try {
      MaskFormatter formatter = new MaskFormatter("####");
      formatter.setPlaceholderCharacter('Y');
      year = new JFormattedTextField(formatter);
      if (!initiallyNull) {
        ((JFormattedTextField) year).setText(item.year);
        year.setEnabled(false);
      }

      year.setPreferredSize(fieldSize);
      addField(TABLE_BUS_YEAR, year);
    } catch (ParseException e) {
    }
  }
예제 #2
0
    /**
     * Réagit au changement dans la définition de la partie.
     *
     * @param pEvt Evènement signalant le changement.
     */
    public void propertyChange(final PropertyChangeEvent pEvt) {
      assert pEvt != null;

      _first.setEnabled(_game.getCurrentMoveIndex() >= 0);
      _previous.setEnabled(_game.getCurrentMoveIndex() >= 0);
      _next.setEnabled(_game.getCurrentMoveIndex() < _game.getMovesCount() - 1);
      _last.setEnabled(_game.getCurrentMoveIndex() < _game.getMovesCount() - 1);
    }
  @Override
  protected void configure(BindingContext context) {
    Enablement enablementAvgGridSize =
        context.bindEnabledState(
            GraticuleLayerType.PROPERTY_NAME_RES_PIXELS, true,
            GraticuleLayerType.PROPERTY_NAME_RES_AUTO, true);
    Enablement enablementLatStep =
        context.bindEnabledState(
            GraticuleLayerType.PROPERTY_NAME_RES_LAT, true,
            GraticuleLayerType.PROPERTY_NAME_RES_AUTO, false);
    Enablement enablementLonStep =
        context.bindEnabledState(
            GraticuleLayerType.PROPERTY_NAME_RES_LON, true,
            GraticuleLayerType.PROPERTY_NAME_RES_AUTO, false);

    context
        .getPropertySet()
        .getProperty(GraticuleLayerType.PROPERTY_NAME_RES_AUTO)
        .addPropertyChangeListener(
            evt -> {
              enablementAvgGridSize.apply();
              enablementLatStep.apply();
              enablementLonStep.apply();
            });

    Enablement enablementTextBgTransparency =
        context.bindEnabledState(
            GraticuleLayerType.PROPERTY_NAME_TEXT_BG_TRANSPARENCY, true,
            GraticuleLayerType.PROPERTY_NAME_TEXT_ENABLED, true);

    context
        .getPropertySet()
        .getProperty(GraticuleLayerType.PROPERTY_NAME_TEXT_ENABLED)
        .addPropertyChangeListener(
            evt -> {
              enablementTextBgTransparency.apply();
              for (JComponent component : textFgColorComponents) {
                component.setEnabled(((Boolean) evt.getNewValue()));
              }
              for (JComponent component : textBgColorComponents) {
                component.setEnabled(((Boolean) evt.getNewValue()));
              }
            });

    for (JComponent component : textFgColorComponents) {
      component.setEnabled(true);
    }
    for (JComponent component : textBgColorComponents) {
      component.setEnabled(true);
    }
  }
예제 #4
0
파일: OptionUI.java 프로젝트: amrecio/mymom
  /** Set up component. */
  protected void initialize() {

    JComponent component = getComponent();
    component.setToolTipText(label.getToolTipText());
    component.setEnabled(editable);
    component.setOpaque(false);
  }
예제 #5
0
 /**
  * Convenience method to ensure a component is safe to toggle the enabled state on
  *
  * @param comp to toggle
  * @param enabled the status to use
  * @return true on success
  */
 protected boolean safeEnable(JComponent comp, boolean enabled) {
   if (comp != null) {
     comp.setEnabled(enabled);
     return true;
   }
   return false;
 }
예제 #6
0
 public void disableEnableComponents(boolean disable) {
   typeSelection.setEnabled(disable);
   fieldSelection.setEnabled(disable);
   fieldDrop.setEnabled(disable);
   literalEntry.setEnabled(disable);
   addRemoveMappingChoice.setEnabled(disable);
 }
예제 #7
0
 @Override
 public void setEnabled(final boolean enabled) {
   super.setEnabled(enabled);
   if (cboDisplayType == null) {
     return;
   }
   checkEnabled(enabled);
 }
예제 #8
0
 private void updateComponentStatus() {
   /*
    * enable/disable component by first checkbox
    */
   boolean enable = highlightSyntax.isSelected();
   for (JComponent c : componentSet) {
     c.setEnabled(enable);
   }
 }
예제 #9
0
  private void updateEnabledState() {
    myLabelEditor.setEnabled(myRbExpressionLabel.isSelected());

    final boolean isChildrenExpression = myRbExpressionChildrenRenderer.isSelected();
    myChildrenExpandedEditor.setEnabled(isChildrenExpression);
    myExpandedLabel.setEnabled(isChildrenExpression);
    myChildrenEditor.setEnabled(isChildrenExpression);
    myChildrenListEditor.setEnabled(myRbListChildrenRenderer.isSelected());
  }
예제 #10
0
 /**
  * Enable/disable a named widget
  *
  * @param widgetName the name of the widget to enable/disable
  * @param enable true if the widget should be enabled; false otherwise
  * @see {@code Widget} enum
  */
 public void enableWidget(String widgetName, boolean enable) {
   JComponent widget = m_widgetMap.get(widgetName);
   if (widget != null) {
     widget.setEnabled(enable);
   }
   JMenuItem mI = m_menuItemMap.get(widgetName);
   if (mI != null) {
     mI.setEnabled(enable);
   }
 }
예제 #11
0
 @Override
 protected JComponent createCustomComponent(String property) {
   if ("proveedor".equals(property)) {
     JComponent control = buildProveedorControl(model.getModel(property));
     control.setEnabled(!model.isReadOnly());
     return control;
   } else if ("comentario".equals(property)) {
     return Binder.createMayusculasTextField(model.getModel(property));
   }
   return super.createCustomComponent(property);
 }
예제 #12
0
 @Override
 public void setEnabled(boolean en) {
   super.setEnabled(en);
   if (!en && enabled) {
     removeMouseListener(getDiagramHandler().getEntityListener(this));
     removeMouseMotionListener(getDiagramHandler().getEntityListener(this));
     enabled = false;
   } else if (en && !enabled) {
     addMouseListener(getDiagramHandler().getEntityListener(this));
     addMouseMotionListener(getDiagramHandler().getEntityListener(this));
     enabled = true;
   }
 }
 public void setEnabled(final boolean enabled) {
   super.setEnabled(enabled);
   hideParameterUiCheckbox.setEnabled(enabled);
   allInOneTable.setEnabled(enabled);
   systemParameterTable.setEnabled(enabled);
   manualParameterTable.setEnabled(enabled);
   predefinedParameterTable.setEnabled(enabled);
   refreshParameterAction.setEnabled(enabled && listeners.isEmpty() == false);
   allInOneRemoveAction.setEnabled(enabled);
   manualParameterRemoveAction.setEnabled(enabled);
   addParameterAction.setEnabled(enabled);
   advancedEditorAction.setEnabled(enabled);
 }
 public void setEditable(boolean editable) {
   if (dataComponent instanceof JTextComponent) {
     ((JTextComponent) dataComponent).setEditable(editable);
   } else if (dataComponent instanceof JScrollPane) {
     Component subComponent = ((JScrollPane) dataComponent).getViewport().getView();
     if (subComponent instanceof JTextComponent) {
       ((JTextComponent) subComponent).setEditable(editable);
     }
   } else if (dataComponent instanceof JXDatePicker) {
     ((JXDatePicker) dataComponent).setEditable(editable);
   } else {
     dataComponent.setEnabled(editable);
   }
 }
예제 #15
0
파일: MarcaForm.java 프로젝트: rcancino/sw2
 /*
  * (non-Javadoc)
  * @see com.luxsoft.siipap.swing.form2.AbstractForm#buildFormPanel()
  */
 @Override
 protected JComponent buildFormPanel() {
   final FormLayout layout = new FormLayout("p,2dlu,max(p;100dlu)", "");
   final DefaultFormBuilder builder = new DefaultFormBuilder(layout);
   builder.setDefaultDialogBorder();
   builder.appendSeparator("");
   if (model.getValue("id") != null) {
     JComponent ct = getControl("id");
     ct.setEnabled(false);
     builder.append("Id", ct, true);
   }
   builder.append("Nombre", addMandatory("nombre"), true);
   return builder.getPanel();
 }
  @Override
  public void updateFields() {
    super.updateFields();

    if (altitudeComponents == null) return;

    boolean enabled =
        (((RecoveryDevice) component).getDeploymentConfiguration().getDefault().getDeployEvent()
            == DeployEvent.ALTITUDE);

    for (JComponent c : altitudeComponents) {
      c.setEnabled(enabled);
    }
  }
예제 #17
0
파일: Entity.java 프로젝트: aaronc/UMLet
 @Override
 public void setEnabled(boolean en) {
   super.setEnabled(en);
   if (!en && enabled) {
     this.removeMouseListener(this.handler.getEntityListener(this));
     this.removeMouseMotionListener(this.handler.getEntityListener(this));
     enabled = false;
   } else if (en && !enabled) {
     if (!this.isPartOfGroup()) {
       this.addMouseListener(this.handler.getEntityListener(this));
       this.addMouseMotionListener(this.handler.getEntityListener(this));
     }
     enabled = true;
   }
 }
예제 #18
0
 public void parseAttributes(Element elm, JComponent comp) {
   String enabled = elm.getAttribute("enabled");
   if (enabled != null) {
     comp.setEnabled(!enabled.equals("false"));
   }
   String id = elm.getAttribute("id");
   if (id.length() > 0) {
     components.put(id, comp);
     comp.setName(id);
   }
   String tooltip = elm.getAttribute("tooltip");
   if (tooltip.length() > 0) {
     comp.setToolTipText(tooltip);
   }
 }
예제 #19
0
  void test(JComponent c) {
    c.setEnabled(false);
    c.setOpaque(true);
    c.setBackground(TEST_COLOR);
    c.setBorder(null);
    Dimension size = c.getPreferredSize();
    c.setBounds(0, 0, size.width, size.height);

    BufferedImage image = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
    c.paint(image.getGraphics());

    int rgb = TEST_COLOR.getRGB();
    for (int i = 0; i < size.height; i++) {
      for (int j = 0; j < size.width; j++) {
        if (image.getRGB(j, i) != rgb) {
          throw new RuntimeException(String.format("Color mismatch at [%d, %d]", j, i));
        }
      }
    }
  }
예제 #20
0
  /**
   * Recupera el estado de un componente y todos sus hijos, vaciando la pila de estados. Eso quiere
   * decir que no se podra volver a recuperar su estado sin haberlo guardado previamente.
   *
   * @param component
   */
  private void restoreStatus(JComponent component) {
    boolean auxEnabled = false;
    boolean finded = false;
    // Buscar estado de dicho componente
    for (int i = 0; i < statusList.size(); i++) {
      StatusComponentStruct auxStatus = (StatusComponentStruct) statusList.get(i);
      if (auxStatus.getObject() == component) {
        auxEnabled = auxStatus.isEnabled();
        statusList.remove(i);
        finded = true;
        break;
      }
    }

    // Asignar su estado
    if (finded) component.setEnabled(auxEnabled);

    for (int i = 0; i < component.getComponentCount(); i++)
      if (component.getComponent(i) instanceof JComponent)
        restoreStatus((JComponent) component.getComponent(i));
  }
예제 #21
0
  @Override
  protected void initUIChild() {
    //        super.initUI(); // creates the default label components for us

    int numCols = getParameter().getProperties().getNumCols();
    int numRows = getParameter().getProperties().getNumRows();

    if (numRows <= 1) {
      JTextField textComponent = new JTextField();
      nameEditorComponent(textComponent);
      // Configure text field
      //
      if (numCols <= 0) {
        textComponent.setColumns(24);
      } else {
        textComponent.setColumns(numCols);
      }
      textComponent.addActionListener(getDefaultActionListener());
      setTextComponent(textComponent);
    } else {
      JTextArea textComponent = new JTextArea();
      nameEditorComponent(textComponent);
      textComponent.setRows(numRows);
      if (numCols > 0) {
        textComponent.setColumns(numCols);
      }
      textComponent.setLineWrap(true);
      textComponent.setWrapStyleWord(true);
      textComponent.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
      setTextComponent(textComponent);
    }

    final boolean enabled = !getParameter().getProperties().isReadOnly();
    _textComponent.setEnabled(enabled);
    _component.setEnabled(enabled);
    String toolTiptext = getParameter().getProperties().getDescription();
    _textComponent.setText(getParameter().getValueAsText());
    _textComponent.setToolTipText(toolTiptext);
    _textComponent.setInputVerifier(getDefaultInputVerifier());
  }
예제 #22
0
    protected void configureEnableToggle(
        Boolean initiallyEnabled, String valueIfDisabled, final List<JComponent> components) {
      if (initiallyEnabled != null) {
        enable = new JCheckBox();
        boolean enabled = initiallyEnabled.booleanValue();
        this.enable.setSelected(enabled);
        for (JComponent c : components) {
          c.setEnabled(enabled);
        }
        this.valueIfDisabled = valueIfDisabled;

        final OptionField f = this;
        this.enable.addItemListener(
            new ItemListener() {
              @Override
              public void itemStateChanged(ItemEvent e) {
                for (JComponent c : components) {
                  c.setEnabled(f.isEnabled());
                }
                fireChangeEvent();
              }
            });
      }
    }
예제 #23
0
 public void enableElements() {
   visibleComponent.setEnabled(true);
   icon.setEnabled(true);
 }
예제 #24
0
 public void disableElements() {
   visibleComponent.setEnabled(false);
   icon.setEnabled(false);
 }
예제 #25
0
 /**
  * Desactivar el componente y todos sus hijos sin guardar los estados. Hay que tener cuidado con
  * no confundirlo con setEnabled(false). Este metodo nunca guardara el estado, asi que no se podra
  * recuperar despues dicho estado.
  *
  * @param component
  */
 public static void setDisabled(JComponent component) {
   component.setEnabled(false);
   for (int i = 0; i < component.getComponentCount(); i++)
     if (component.getComponent(i) instanceof JComponent)
       setDisabled((JComponent) component.getComponent(i));
 }
 public void setEnabled(boolean b) {
   super.setEnabled(b);
   for (Component c : getComponents()) {
     c.setEnabled(b);
   }
 }
예제 #27
0
파일: IGVMenuBar.java 프로젝트: kshakir/IGV
  void createFileMenu() {

    List<JComponent> menuItems = new ArrayList<JComponent>();
    MenuAction menuAction = null;
    // We disable certain load items when there is no genome.
    boolean genomeLoaded = GenomeManager.getInstance().getCurrentGenome() != null;

    menuItems.add(new JSeparator());

    // Load menu items
    menuAction = new LoadFilesMenuAction("Load from File...", KeyEvent.VK_L, igv);
    menuAction.setToolTipText(UIConstants.LOAD_TRACKS_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction = new LoadFromURLMenuAction(LoadFromURLMenuAction.LOAD_FROM_URL, KeyEvent.VK_U, igv);
    menuAction.setToolTipText(UIConstants.LOAD_TRACKS_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction = new LoadFromServerAction("Load from Server...", KeyEvent.VK_S, igv);
    menuAction.setToolTipText(UIConstants.LOAD_SERVER_DATA_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction = new LoadFromURLMenuAction(LoadFromURLMenuAction.LOAD_FROM_DAS, KeyEvent.VK_D, igv);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    if (PreferenceManager.getInstance().getAsBoolean(PreferenceManager.DB_ENABLED)) {
      menuAction = new LoadFromDatabaseAction("Load from Database...", 0, igv);
      menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));
    }

    String genomeId = IGV.getInstance().getGenomeManager().getGenomeId();
    if (EncodeFileBrowser.genomeSupported(genomeId)) {
      menuAction = new BrowseEncodeAction("Load from ENCODE...", KeyEvent.VK_E, igv);
      menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));
    }

    // Disable loading if no genome loaded. Something of an edge case
    if (!genomeLoaded) {
      for (JComponent menuItem : menuItems) {
        menuItem.setEnabled(false);
      }
    }

    menuItems.add(new JSeparator());

    // Session menu items
    menuAction = new NewSessionMenuAction("New Session...", KeyEvent.VK_N, igv);
    menuAction.setToolTipText(UIConstants.NEW_SESSION_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction = new OpenSessionMenuAction("Open Session...", KeyEvent.VK_O, igv);
    menuAction.setToolTipText(UIConstants.RESTORE_SESSION_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction = new SaveSessionMenuAction("Save Session...", KeyEvent.VK_V, igv);
    menuAction.setToolTipText(UIConstants.SAVE_SESSION_TOOLTIP);
    JMenuItem saveSessionItem = MenuAndToolbarUtils.createMenuItem(menuAction);
    menuItems.add(saveSessionItem);
    saveSessionItem.setEnabled(genomeLoaded);

    menuItems.add(new JSeparator());

    // ***** Snapshots
    // Snapshot Application
    menuAction =
        new MenuAction("Save Image ...", null, KeyEvent.VK_A) {
          @Override
          public void actionPerformed(ActionEvent e) {
            igv.saveImage(igv.getMainPanel());
          }
        };

    menuAction.setToolTipText(SAVE_IMAGE_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    // TODO -- change "Exit" to "Close" for BioClipse
    menuItems.add(new JSeparator()); // Exit
    menuAction =
        new MenuAction("Exit", null, KeyEvent.VK_X) {

          @Override
          public void actionPerformed(ActionEvent e) {
            doExitApplication();
          }
        };

    menuAction.setToolTipText(EXIT_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    // Empty the recent sessions list before we start to do
    // anything with it
    igv.getRecentSessionList().clear();

    // Retrieve the stored session paths
    String recentSessions = PreferenceManager.getInstance().getRecentSessions();
    if (recentSessions != null) {
      String[] sessions = recentSessions.split(";");
      for (String sessionPath : sessions) {
        if (!igv.getRecentSessionList().contains(sessionPath)) {
          igv.getRecentSessionList().add(sessionPath);
        }
      }
    }

    if (!IGV.getInstance().getRecentSessionList().isEmpty()) {

      menuItems.add(new JSeparator());

      // Now add menu items
      for (final String session : IGV.getInstance().getRecentSessionList()) {
        OpenSessionMenuAction osMenuAction =
            new OpenSessionMenuAction(session, session, IGV.getInstance());
        menuItems.add(MenuAndToolbarUtils.createMenuItem(osMenuAction));
      }
    }

    MenuAction fileMenuAction = new MenuAction("File", null, KeyEvent.VK_F);
    if (fileMenu == null) {
      fileMenu = MenuAndToolbarUtils.createMenu(menuItems, fileMenuAction);
    } else {
      fileMenu.removeAll();
      for (JComponent item : menuItems) {
        fileMenu.add(item);
      }
    }
  }
예제 #28
0
  public TemplateEditor() {
    super("OME Notes Template Editor");

    pictureHandler = new PictureTransferHandler();
    icons = new Hashtable[0];
    fields = new Hashtable[0];

    // set up the menu bar

    JMenuBar menubar = new JMenuBar();

    JMenu file = new JMenu("File");

    JMenuItem newFile = new JMenuItem("New...");
    newFile.setActionCommand("new");
    newFile.addActionListener(this);
    file.add(newFile);

    JMenuItem openFile = new JMenuItem("Open");
    openFile.setActionCommand("open");
    openFile.addActionListener(this);
    file.add(openFile);

    JMenuItem saveFile = new JMenuItem("Save");
    saveFile.setActionCommand("save");
    saveFile.addActionListener(this);
    file.add(saveFile);

    JMenuItem quit = new JMenuItem("Quit");
    quit.setActionCommand("quit");
    quit.addActionListener(this);
    file.add(quit);

    menubar.add(file);

    setJMenuBar(menubar);

    // set up the toolbar

    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);

    JButton tab = new JButton("New Tab");
    tab.addActionListener(this);
    tab.setActionCommand("prompt tab");

    JButton row = new JButton("Add Row");
    row.addActionListener(this);
    row.setActionCommand("add row");

    JButton col = new JButton("Add Column");
    col.addActionListener(this);
    col.setActionCommand("add col");

    JButton remove = new JButton("Remove this tab");
    remove.addActionListener(this);
    remove.setActionCommand("removeTab");

    toolbar.add(tab);
    toolbar.add(row);
    toolbar.add(col);
    toolbar.add(remove);

    // set up the rest of the window

    CellConstraints cc = new CellConstraints();

    FormLayout layout =
        new FormLayout(
            "pref:grow,pref,pref:grow,pref:grow,pref:grow",
            "pref,5dlu:grow,pref:grow,pref:grow,pref:grow");

    JPanel contentPane = new JPanel(layout);

    contentPane.add(toolbar, cc.xywh(1, 1, 5, 1));

    tabPane = new JTabbedPane();
    contentPane.add(tabPane, cc.xywh(3, 2, 3, 4));

    FormLayout componentLayout =
        new FormLayout(
            "pref:grow,pref:grow", "pref:grow,pref:grow,pref:grow,pref:grow,pref:grow,pref:grow");
    componentPane = new JPanel(componentLayout);

    componentPane.add(new JLabel("Field Choices"), cc.xywh(1, 1, 2, 1));

    try {
      for (int i = 0; i < COMPONENTS.length; i++) {
        JLabel label = new JLabel(COMPONENT_NAMES[i]);
        componentPane.add(label, cc.xy(1, i + 2));

        JPanel panel = new JPanel();
        JComponent component = (JComponent) COMPONENTS[i].newInstance();
        component.setPreferredSize(new Dimension(64, 25));
        component.setEnabled(false);
        panel.add(component);

        DraggableIcon img = new DraggableIcon(panel, -1, -1);
        img.setTransferHandler(pictureHandler);
        img.setEditable(false);

        componentPane.add(img, cc.xy(2, i + 2));
      }
    } catch (Exception e) {
      error("Failed to create field list", e);
    }

    contentPane.add(componentPane, cc.xywh(1, 2, 1, 4));

    setContentPane(contentPane);
    setSize(new Dimension(768, 768));
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setVisible(true);
  }
예제 #29
0
    private void update() {
      for (JComponent c : onTerrainOnlyItems) {
        c.setEnabled(currentFollowTerrain);
      }

      for (JComponent c : offTerrainOnlyItems) {
        c.setEnabled(!currentFollowTerrain);
      }

      if (this.currentShape instanceof SurfaceShape) {
        SurfaceShape shape = (SurfaceShape) currentShape;
        ShapeAttributes attr = shape.getAttributes();

        if (attr == null) attr = new BasicShapeAttributes();

        if (!currentBorderStyle.equals("None")) {
          float alpha =
              currentBorderOpacity >= 10
                  ? 1f
                  : currentBorderOpacity <= 0 ? 0f : currentBorderOpacity / 10f;
          Color color = null;
          if (currentBorderColor.equals("Yellow")) color = new Color(1f, 1f, 0f);
          else if (currentBorderColor.equals("Red")) color = new Color(1f, 0f, 0f);
          else if (currentBorderColor.equals("Green")) color = new Color(0f, 1f, 0f);
          else if (currentBorderColor.equals("Blue")) color = new Color(0f, 0f, 1f);

          attr.setDrawOutline(true);
          attr.setOutlineMaterial(new Material(color));
          attr.setOutlineOpacity(alpha);
          attr.setOutlineWidth(currentBorderWidth);
        } else {
          attr.setDrawOutline(false);
        }

        if (!currentInteriorStyle.equals("None")) {
          float alpha =
              currentInteriorOpacity >= 10
                  ? 1f
                  : currentInteriorOpacity <= 0 ? 0f : currentInteriorOpacity / 10f;
          Color color = null;
          if (currentInteriorColor.equals("Yellow")) color = new Color(1f, 1f, 0f);
          else if (currentInteriorColor.equals("Red")) color = new Color(1f, 0f, 0f);
          else if (currentInteriorColor.equals("Green")) color = new Color(0f, 1f, 0f);
          else if (currentInteriorColor.equals("Blue")) color = new Color(0f, 0f, 1f);

          attr.setInteriorMaterial(new Material(color));
          attr.setInteriorOpacity(alpha);
          attr.setDrawInterior(true);
        } else {
          attr.setDrawInterior(false);
        }

        shape.setAttributes(attr);
      } else {
        float alpha =
            currentPathOpacity >= 10 ? 1f : currentPathOpacity <= 0 ? 0f : currentPathOpacity / 10f;
        Color color = null;
        if (currentPathColor.equals("Yellow")) color = new Color(1f, 1f, 0f, alpha);
        else if (currentPathColor.equals("Red")) color = new Color(1f, 0f, 0f, alpha);
        else if (currentPathColor.equals("Green")) color = new Color(0f, 1f, 0f, alpha);
        else if (currentPathColor.equals("Blue")) color = new Color(0f, 0f, 1f, alpha);

        if (currentShape instanceof Polyline) {
          Polyline pl = (Polyline) currentShape;
          pl.setColor(color);
          pl.setLineWidth(currentPathWidth);
          pl.setFollowTerrain(currentFollowTerrain);
          pl.setTerrainConformance(currentTerrainConformance);
          pl.setNumSubsegments(currentNumSubsegments);

          if (currentPathType.equalsIgnoreCase("linear")) pl.setPathType(Polyline.LINEAR);
          else if (currentPathType.equalsIgnoreCase("rhumb line"))
            pl.setPathType(Polyline.RHUMB_LINE);
          else pl.setPathType(Polyline.GREAT_CIRCLE);

          pl.setOffset(currentOffset);

          if (currentPathStyle.equals("Dash")) {
            pl.setStippleFactor(5);
            pl.setStipplePattern((short) 0xAAAA);
          } else {
            pl.setStippleFactor(0); // solid
          }
        }
      }
      this.layer.removeAllRenderables();
      if (this.currentShape != null) this.layer.addRenderable(this.currentShape);
      this.wwjPanel.getWwd().redraw();
    }
예제 #30
0
 @Override
 public void implOnError(JComponent activator, boolean isError) {
   activator.setEnabled(!isError);
 }