public JComponent getComponent(final RadComponent ignored, final Integer value, final InplaceContext inplaceContext) { // Find pair if (value == null) { getCbx().setSelectedItem(null); return getCbx(); } final ComboBoxModel model = getCbx().getModel(); for (int i = model.getSize() - 1; i >= 0; i--) { final Pair pair = (Pair)model.getElementAt(i); if (pair.myValue == value.intValue()) { getCbx().setSelectedIndex(i); return getCbx(); } } throw new IllegalArgumentException("unknown value: " + value); }
public JComponent getComponent(RadComponent component, String value, InplaceContext inplaceContext) { RadComponent[] components = collectFilteredComponents(component); // components [0] = null (<none>) myCbx.setModel(new DefaultComboBoxModel(components)); myOldValue = value; if (value == null || myOldValue.length() == 0) { myCbx.setSelectedIndex(0); } else { for(int i=1; i<components.length; i++) { if (components [i].getId().equals(value)) { myCbx.setSelectedIndex(i); break; } } } return myCbx; }
public JComponent getComponent(final RadComponent component, final String[] value, final InplaceContext inplaceContext) { myLastComponent = component; myLastValue = value; if (inplaceContext != null) { if (inplaceContext.isStartedByTyping()) { openListEditorDialog(new String[] { Character.toString(inplaceContext.getStartChar()) }); } else { openListEditorDialog(value); } inplaceContext.setModalDialogDisplayed(true); } else { myTextField.setText(listValueToString(value)); } return myTextField; }
@Override public JComponent getComponent(final RadComponent component, final Boolean value, final InplaceContext inplaceContext) { JCheckBox result = (JCheckBox) super.getComponent(component, value, inplaceContext); final boolean customCreateRequired = component.isCustomCreateRequired(); if (customCreateRequired) { result.setEnabled(false); result.setSelected(true); } else { result.setEnabled(true); } return result; }
public JComponent getComponent(RadComponent component, String value, InplaceContext inplaceContext) { if (UIFormXmlConstants.LAYOUT_XY.equals(value)) { myCbx.setModel(new DefaultComboBoxModel(LayoutManagerRegistry.getLayoutManagerNames())); } else { myCbx.setModel(new DefaultComboBoxModel(LayoutManagerRegistry.getNonDeprecatedLayoutManagerNames())); } myCbx.setSelectedItem(value); return myCbx; }
public JComponent getComponent(final RadComponent component, final StringDescriptor value, final InplaceContext inplaceContext) { myComponent = component; setValue(value); myTfWithButton.getTextField().setBorder(null); if (inplaceContext != null && inplaceContext.isStartedByTyping()) { myTfWithButton.setText(Character.toString(inplaceContext.getStartChar())); } return myTfWithButton; }
public JComponent getComponent(final RadComponent ignored, final Boolean value, final InplaceContext inplaceContext){ myInsideChange=true; try{ myCheckBox.setBackground(UIUtil.getTableBackground()); myCheckBox.setSelected(value != null && value.booleanValue()); return myCheckBox; }finally{ myInsideChange=false; } }
public JComponent getComponent(RadComponent component, IconDescriptor value, InplaceContext inplaceContext) { myValue = value; myComponent = component; if (myValue != null) { myTextField.setText(myValue.getIconPath()); } else { myTextField.setText(""); } return myTextField; }
public JComponent getComponent(final RadComponent ignored, final V value, final InplaceContext inplaceContext) { setValueFromComponent(ignored, value); if(inplaceContext != null) { myTf.setBorder(UIUtil.getTextFieldBorder()); if (inplaceContext.isStartedByTyping()) { myTf.setText(Character.toString(inplaceContext.getStartChar())); } } else{ myTf.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); } return myTf; }
public JComponent getComponent(final RadComponent component, final Enum value, final InplaceContext inplaceContext) { if (value == null) { return myCbx; } final ComboBoxModel model = myCbx.getModel(); for (int i = model.getSize() - 1; i >= 0; i--) { if (model.getElementAt(i) == value) { myCbx.setSelectedIndex(i); return myCbx; } } throw new IllegalArgumentException("unknown value: " + value); }
public void actionPerformed(final AnActionEvent e) { final ArrayList<RadComponent> selection = FormEditingUtil.getAllSelectedComponents(myEditor); final RadComponent component = selection.get(0); final Property defaultInplaceProperty = component.getDefaultInplaceProperty(); myEditor.getInplaceEditingLayer().startInplaceEditing(component, defaultInplaceProperty, component.getDefaultInplaceEditorBounds(), new InplaceContext(true)); }
/** * Starts editing of "inplace" property for the component at the * specified point <code>(x, y)</code>. * * @param x x coordinate in the editor coordinate system * @param y y coordinate in the editor coordinate system */ public void startInplaceEditing(final int x, final int y){ final RadComponent inplaceComponent = FormEditingUtil.getRadComponentAt(myEditor.getRootContainer(), x, y); if(inplaceComponent == null){ // nothing to edit return; } // Try to find property with inplace editor final Point p = SwingUtilities.convertPoint(this, x, y, inplaceComponent.getDelegee()); final Property inplaceProperty = inplaceComponent.getInplaceProperty(p.x, p.y); if (inplaceProperty != null) { final Rectangle bounds = inplaceComponent.getInplaceEditorBounds(inplaceProperty, p.x, p.y); startInplaceEditing(inplaceComponent, inplaceProperty, bounds, new InplaceContext(true)); } }
protected void processKeyEvent(final KeyEvent e){ if (e.getKeyCode() == KeyEvent.VK_SHIFT) { if (e.getID() == KeyEvent.KEY_PRESSED) { if ((myCurrentProcessor != null && myCurrentProcessor.isDragActive()) || (PaletteToolWindowManager.getInstance(myEditor).getActiveItem(ComponentItem.class) != null && myCurrentProcessor != myInsertComponentProcessor)) { myEditor.setDesignTimeInsets(12); } } else { myEditor.setDesignTimeInsets(2); } } if (myCurrentProcessor != null) { myCurrentProcessor.processKeyEvent(e); } else if (e.getID() == KeyEvent.KEY_TYPED && Character.isLetterOrDigit(e.getKeyChar()) && (e.getModifiers() & (InputEvent.ALT_MASK | InputEvent.CTRL_MASK | InputEvent.META_MASK)) == 0) { final ArrayList<RadComponent> selection = FormEditingUtil.getAllSelectedComponents(myEditor); if (selection.size() > 0) { final RadComponent component = selection.get(0); final InplaceEditingLayer inplaceLayer = myEditor.getInplaceEditingLayer(); inplaceLayer.startInplaceEditing(component, component.getDefaultInplaceProperty(), component.getDefaultInplaceEditorBounds(), new InplaceContext(false, e.getKeyChar())); e.consume(); } } }
protected void processKeyEvent(final KeyEvent e){ if (e.getKeyCode() == KeyEvent.VK_SHIFT) { if (e.getID() == KeyEvent.KEY_PRESSED) { if ((myCurrentProcessor != null && myCurrentProcessor.isDragActive()) || (PaletteManager.getInstance(myEditor.getProject()).getActiveItem(ComponentItem.class) != null && myCurrentProcessor != myInsertComponentProcessor)) { myEditor.setDesignTimeInsets(12); } } else { myEditor.setDesignTimeInsets(2); } } if (myCurrentProcessor != null) { myCurrentProcessor.processKeyEvent(e); } else if (e.getID() == KeyEvent.KEY_TYPED && Character.isLetterOrDigit(e.getKeyChar()) && (e.getModifiers() & (InputEvent.ALT_MASK | InputEvent.CTRL_MASK | InputEvent.META_MASK)) == 0) { final ArrayList<RadComponent> selection = FormEditingUtil.getAllSelectedComponents(myEditor); if (selection.size() > 0) { final RadComponent component = selection.get(0); final InplaceEditingLayer inplaceLayer = myEditor.getInplaceEditingLayer(); inplaceLayer.startInplaceEditing(component, component.getDefaultInplaceProperty(), component.getDefaultInplaceEditorBounds(), new InplaceContext(false, e.getKeyChar())); e.consume(); } } }
@Override public JComponent getComponent(final RadComponent component, final String value, final InplaceContext inplaceContext) { final String[] fieldNames = getFieldNames(component, value); myCbx.setModel(new DefaultComboBoxModel(fieldNames)); myCbx.setSelectedItem(value); return myCbx; }
protected void processKeyEvent(final KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_SHIFT) { if(e.getID() == KeyEvent.KEY_PRESSED) { if((myCurrentProcessor != null && myCurrentProcessor.isDragActive()) || (PaletteToolWindowManager.getInstance(myEditor) .getActiveItem(ComponentItem.class) != null && myCurrentProcessor != myInsertComponentProcessor)) { myEditor.setDesignTimeInsets(12); } } else { myEditor.setDesignTimeInsets(2); } } if(myCurrentProcessor != null) { myCurrentProcessor.processKeyEvent(e); } else if(e.getID() == KeyEvent.KEY_TYPED && Character.isLetterOrDigit(e.getKeyChar()) && (e.getModifiers() & (InputEvent.ALT_MASK | InputEvent.CTRL_MASK | InputEvent.META_MASK)) == 0) { final ArrayList<RadComponent> selection = FormEditingUtil.getAllSelectedComponents(myEditor); if(selection.size() > 0) { final RadComponent component = selection.get(0); final InplaceEditingLayer inplaceLayer = myEditor.getInplaceEditingLayer(); inplaceLayer.startInplaceEditing(component, component.getDefaultInplaceProperty(), component.getDefaultInplaceEditorBounds(), new InplaceContext(false, e.getKeyChar())); e.consume(); } } }