예제 #1
0
  @Override
  public JComponent createUI(
      DescriptionType inputOrOutput, Map<URI, Object> dataMap, Orientation orientation) {
    // Create the main panel
    JComponent component = new JPanel(new MigLayout("fill"));

    boolean isOptional = false;
    if (inputOrOutput instanceof InputDescriptionType) {
      isOptional =
          ((InputDescriptionType) inputOrOutput).getMinOccurs().equals(new BigInteger("0"));
    }
    // Display the SourceCA into a JTextField
    JTextField jtf = new JTextField();
    jtf.setToolTipText(inputOrOutput.getAbstract().get(0).getValue());
    // "Save" the CA inside the JTextField
    jtf.getDocument().putProperty(DATA_MAP_PROPERTY, dataMap);
    URI uri = URI.create(inputOrOutput.getIdentifier().getValue());
    jtf.getDocument().putProperty(URI_PROPERTY, uri);
    // add the listener for the text changes in the JTextField
    jtf.getDocument()
        .addDocumentListener(
            EventHandler.create(DocumentListener.class, this, "saveDocumentText", "document"));
    if (isOptional) {
      if (dataMap.containsKey(uri)) {
        jtf.setText(dataMap.get(uri).toString());
      }
    }

    GeometryData geometryData = null;
    if (inputOrOutput instanceof InputDescriptionType) {
      geometryData =
          (GeometryData) ((InputDescriptionType) inputOrOutput).getDataDescription().getValue();
    }
    // If the DescriptionType is an output, there is nothing to show, so exit
    if (geometryData == null) {
      return null;
    }

    component.add(jtf, "growx");

    if (orientation.equals(Orientation.VERTICAL)) {
      JPanel buttonPanel = new JPanel(new MigLayout());

      // Create the button Browse
      JButton pasteButton = new JButton(ToolBoxIcon.getIcon(ToolBoxIcon.PASTE));
      // "Save" the sourceCA and the JTextField in the button
      pasteButton.putClientProperty(TEXT_FIELD_PROPERTY, jtf);
      pasteButton.setBorderPainted(false);
      pasteButton.setContentAreaFilled(false);
      pasteButton.setMargin(new Insets(0, 0, 0, 0));
      // Add the listener for the click on the button
      pasteButton.addActionListener(EventHandler.create(ActionListener.class, this, "onPaste", ""));
      buttonPanel.add(pasteButton);

      component.add(buttonPanel, "dock east");
    }

    return component;
  }
예제 #2
0
 /**
  * Adds the style panel attached to the given {@link StyleWrapper}.
  *
  * @param sw StyleWrapper
  */
 private void addStylePanel(StyleWrapper sw) {
   PnlStyle stylePanel = sw.getPanel();
   stylePanel.setId(createNewID());
   stylePanel.addPropertyChangeListener(
       EventHandler.create(PropertyChangeListener.class, this, "onNodeNameChange", ""));
   dialogContainer.add(stylePanel.getId(), getJScrollPane(stylePanel));
 }
예제 #3
0
 public ActionLabel getPeriodoLabel() {
   if (periodoLabel == null) {
     periodoLabel = new ActionLabel("Buscar: " + periodo.toString());
     periodoLabel.addActionListener(
         EventHandler.create(ActionListener.class, this, "cambiarPeriodo"));
   }
   return periodoLabel;
 }
  public void init() {
    frame = new JFrame();
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("PersistentFrameTest");
    frame.setSize(400, 200);

    JButton loadButton = new JButton("Load");
    frame.add(loadButton);
    loadButton.addActionListener(EventHandler.create(ActionListener.class, this, "load"));

    JButton saveButton = new JButton("Save");
    frame.add(saveButton);
    saveButton.addActionListener(EventHandler.create(ActionListener.class, this, "save"));

    frame.setVisible(true);
  }
예제 #5
0
 /**
  * Attach listeners to the BackgroundManager
  *
  * @return itself
  */
 public JobListModel listenToBackgroundManager() {
   BackgroundManager bm = Services.getService(BackgroundManager.class);
   // bm.addBackgroundListener(EventHandler.create(BackgroundListener.class,this,"onJobListChange"));
   bm.addBackgroundListener(new JobListBackgroundListener());
   labelUpdateListener =
       EventHandler.create(PropertyChangeListener.class, this, "onJobItemLabelChange", "source");
   return this;
 }
예제 #6
0
  /** Initialize all the buttons that can be used to manage the tree content. */
  private void initButtons() {
    toolBar = new JToolBar();
    toolBar.setFloatable(false);

    jButtonMenuUp = new JButton();
    jButtonMenuUp.setIcon(OrbisGISIcon.getIcon("go-up"));
    jButtonMenuUp.setToolTipText(I18N.tr("Up"));
    ActionListener alu = EventHandler.create(ActionListener.class, this, "moveSelectedElementUp");
    jButtonMenuUp.addActionListener(alu);
    toolBar.add(jButtonMenuUp);

    jButtonMenuDown = new JButton();
    jButtonMenuDown.setIcon(OrbisGISIcon.getIcon("go-down"));
    jButtonMenuDown.setToolTipText(I18N.tr("Down"));
    ActionListener ald = EventHandler.create(ActionListener.class, this, "moveSelectedElementDown");
    jButtonMenuDown.addActionListener(ald);
    toolBar.add(jButtonMenuDown);

    JButton jButtonMenuAdd = new JButton();
    jButtonMenuAdd.setIcon(OrbisGISIcon.getIcon("picture_add"));
    jButtonMenuAdd.setToolTipText(I18N.tr("Add"));
    ActionListener aladd = EventHandler.create(ActionListener.class, this, "addElement");
    jButtonMenuAdd.addActionListener(aladd);
    jButtonMenuAdd.setFocusPainted(false);
    toolBar.add(jButtonMenuAdd);

    jButtonMenuDel = new JButton();
    jButtonMenuDel.setIcon(OrbisGISIcon.getIcon("picture_delete"));
    jButtonMenuDel.setToolTipText(I18N.tr("Delete"));
    ActionListener alrem = EventHandler.create(ActionListener.class, this, "removeSelectedElement");
    jButtonMenuDel.addActionListener(alrem);
    toolBar.add(jButtonMenuDel);

    jButtonMenuRename = new JButton();
    jButtonMenuRename.setIcon(OrbisGISIcon.getIcon("picture_edit"));
    jButtonMenuRename.setToolTipText(I18N.tr("Rename"));
    jButtonMenuRename.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            renameElement(evt);
          }
        });
    toolBar.add(jButtonMenuRename);
  }
예제 #7
0
 /**
  * Adds the rule panel attached to the given {@link RuleWrapper}.
  *
  * @param ruleWrapper RuleWrapper
  */
 private void addRulePanel(RuleWrapper ruleWrapper) {
   // Get the panel associated to this RuleWrapper, set its id,
   // initialize it and add a listener for when its node name changes.
   PnlRule rulePanel = ruleWrapper.getPanel();
   rulePanel.setId(createNewID());
   rulePanel.addPropertyChangeListener(
       EventHandler.create(PropertyChangeListener.class, this, "onNodeNameChange", ""));
   // Add the rule wrapper panel to the container after putting it in
   // a new JScrollPane.
   dialogContainer.add(rulePanel.getId(), getJScrollPane(rulePanel));
 }
예제 #8
0
 /**
  * Constructor
  *
  * @param editable Table editable instance
  */
 public ActionRemoveRow(
     TableEditableElement editable, TableEditor tableEditor, WpsServer wpsServer) {
   super(I18N.tr("Delete selected rows"), TableEditorIcon.getIcon("delete_row"));
   this.tableEditor = tableEditor;
   putValue(ActionTools.LOGICAL_GROUP, TableEditorActions.LGROUP_MODIFICATION_GROUP);
   putValue(ActionTools.MENU_ID, TableEditorActions.A_REMOVE_ROW);
   this.editable = editable;
   updateEnabledState();
   editable.addPropertyChangeListener(
       EventHandler.create(PropertyChangeListener.class, this, "onEditableUpdate", ""));
   this.wpsServer = wpsServer;
 }
예제 #9
0
  public LegendTree(final SimpleStyleEditor simpleEditor) {
    simpleStyleEditor = simpleEditor;

    StyleWrapper style = simpleStyleEditor.getStyleWrapper();
    // We create our tree
    tree = new JTree();
    // We don't want to display the root.
    tree.setRootVisible(true);
    // We have a custom model to provide... Listeners on the TreeModel
    // are added by the tree when calling setModel.
    LegendTreeModel ltm = new LegendTreeModel(tree, style);
    tree.setModel(ltm);
    // ..A custom cell editor...
    LegendTreeCellEditor editor = new LegendTreeCellEditor();
    editor.setClickCountToStart(2);
    tree.setCellEditor(editor);
    // ...and a custom TreeCellRenderer.
    LegendCellRenderer lcr = new LegendCellRenderer(tree);
    tree.setCellRenderer(lcr);
    // We want to select only one element at a time.
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    selectAndShowFirstLegend(style);
    // We refresh icons when the selection changes.
    TreeSelectionListener tsl =
        EventHandler.create(TreeSelectionListener.class, this, "refreshIcons");
    tree.addTreeSelectionListener(tsl);
    // We refresh the CardLayout of the associated SimpleStyleEditor
    TreeSelectionListener select =
        EventHandler.create(TreeSelectionListener.class, simpleStyleEditor, "legendSelected");
    tree.addTreeSelectionListener(select);
    expandAll(tree);
    // We want an editable tree
    tree.setEditable(true);
    initButtons();
    this.setLayout(new BorderLayout());
    this.add(toolBar, BorderLayout.PAGE_START);
    JScrollPane scrollPane = new JScrollPane(tree);
    this.add(scrollPane, BorderLayout.CENTER);
    refreshIcons();
  }
예제 #10
0
파일: Core.java 프로젝트: orbisgis/orbisgis
 /** Create the Instance of the main frame */
 private void makeMainFrame() {
   mainFrame.init(pluginFramework.getHostBundleContext());
   // When the user ask to close OrbisGis it call
   // the shutdown method here,
   // Link the Swing Events with the MainFrame event
   // Thanks to EventHandler we don't have to build a listener class
   mainFrame.addWindowListener(
       EventHandler.create(
           WindowListener.class, // The listener class
           this, // The event target object
           "onMainWindowClosing", // The event target method to call
           null, // the event parameter to pass(none)
           "windowClosing")); // The listener method to use
 }
예제 #11
0
파일: Core.java 프로젝트: orbisgis/orbisgis
 /** Add new menu to the OrbisGIS core */
 private void addCoreMenu() {
   DefaultAction def =
       new DefaultAction(
           MainFrameAction.MENU_SAVE,
           I18N.tr("&Save"),
           OrbisGISIcon.getIcon("save"),
           EventHandler.create(ActionListener.class, this, "onMenuSaveApplication"));
   def.setParent(MainFrameAction.MENU_FILE).setBefore(MainFrameAction.MENU_EXIT);
   mainFrame.addMenu(def);
   def.setToolTipText(I18N.tr("Save the workspace"));
   JButton saveBt = new CustomButton(def);
   saveBt.setHideActionText(true);
   mainFrame.addToolBarComponent(saveBt, "align left");
 }
예제 #12
0
 public PluginShell(final BundleContext hostBundle) {
   super(new BorderLayout());
   this.hostBundle = hostBundle;
   parameters.setName("plugin-shell");
   parameters.setTitle(I18N.tr("Plugin Shell"));
   parameters.setTitleIcon(new ImageIcon(PluginShell.class.getResource("panel_icon.png")));
   outputField.setEditable(false);
   outputField.setText(I18N.tr("Plugin shell, type \"help\" for command list.\n"));
   // Initialising components
   // The shell is composed by a logging part and a command line part
   add(new JScrollPane(outputField), BorderLayout.CENTER);
   add(commandField, BorderLayout.SOUTH);
   commandField.addActionListener(
       EventHandler.create(ActionListener.class, this, "onValidateCommand"));
 }
예제 #13
0
  @Override
  public void buildUI() {
    JPanel glob = new JPanel(new MigLayout("wrap 2"));

    glob.add(
        new ProportionalPointPanel(
            proportionalPoint, getPreview(), I18N.tr(MARK_SETTINGS), ds, table, geometryType));

    // The preview is created only once while the other panels are
    // created twice, currently. Adds a locally stored listener to
    // avoid having it twice because of this double call of
    // buildUI.
    CanvasSE prev = getPreview();
    if (l == null || prev.getMouseListeners().length == 0) {
      l = EventHandler.create(MouseListener.class, this, "onClickOnPreview", "", "mouseClicked");
      prev.addMouseListener(l);
    }
    glob.add(new PreviewPanel(getPreview()));
    this.add(glob);
  }
예제 #14
0
    public void mabeShowPopup(MouseEvent e) {

      if (e.isPopupTrigger()) {

        final JPopupMenu contextMenu = new JPopupMenu();

        int row = view.getTable().rowAtPoint(e.getPoint());
        ListTableModel<PatientModel> tModel = getTableModel();
        PatientModel obj = tModel.getObject(row);
        int selected = view.getTable().getSelectedRow();

        if (row == selected && obj != null) {
          contextMenu.add(
              new JMenuItem(new ReflectAction("カルテを開く", PatientSearchImpl.this, "openKarte")));
          contextMenu.addSeparator();
          // s.oh^ 2014/08/19 ID権限
          // contextMenu.add(new JMenuItem(copyAction));
          // contextMenu.add(new JMenuItem(new ReflectAction("受付登録", PatientSearchImpl.this,
          // "addAsPvt")));
          // contextMenu.addSeparator();
          if (!Project.isOtherCare()) {
            contextMenu.add(new JMenuItem(copyAction));
            contextMenu.add(
                new JMenuItem(new ReflectAction("受付登録", PatientSearchImpl.this, "addAsPvt")));
            contextMenu.addSeparator();
          }
          // s.oh$
        }

        JCheckBoxMenuItem item = new JCheckBoxMenuItem("年齢表示");
        contextMenu.add(item);
        item.setSelected(ageDisplay);
        item.addActionListener(
            (ActionListener)
                EventHandler.create(
                    ActionListener.class, PatientSearchImpl.this, "switchAgeDisplay"));

        contextMenu.show(e.getComponent(), e.getX(), e.getY());
      }
    }
예제 #15
0
 private void initialize(JList list) {
   updateLFRenderer();
   list.addPropertyChangeListener(
       "UI", EventHandler.create(PropertyChangeListener.class, this, "updateLFRenderer"));
 }