@Override public void onEvent(ConsoleState state, Event.Key kev) { // System.out.println("WindowChildren OnEvent.Key " + kev.key); super.onEvent(state, kev); if (active_ != null) active_.onEvent(state, kev); if (kev.state == Event.State.RELEASED) { switch (kev.key) { case TAB: if (children_.isEmpty()) { setActive(state, null); } else { Window current = active_; boolean found = false; int i = active_ != null ? children_.indexOf(active_) + 1 : 0; while (!found) { if (i >= children_.size()) { if (current == null) break; else i = 0; } Window active = children_.get(i); found = setActive(state, active); if (active == current) break; ++i; } } break; } } }
static void delProperty(Client c, Window w, int name, int type) throws IOException { Property p; synchronized (w) { p = w.getProperty(); Property prev = null; while (p != null) { if (p.propertyName == name) break; prev = p; p = p.next; } if (p != null) { if (prev == null) { // head !! w.setProperty(p.next); if (p.next == null) { // checkWindowOptionalNeed(); } } else { prev.next = p.next; } c.cevent.mkPropertyNotify( w.id, p.propertyName, (int) System.currentTimeMillis(), // Property.PropertyDelete 1); } } if (p != null) { w.sendEvent(c.cevent, 1, null); } }
void confirmDelete() { // Create the window... subwindow = new Window("Xoa ??"); // ...and make it modal subwindow.setModal(true); // Configure the windws layout; by default a VerticalLayout VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); // Add some content; a label and a close-button Label message = new Label("Ban co chac chan muon xoa ?"); subwindow.addComponent(message); Button close = new Button( "Co", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); } // end of confirmDelete
@Override public void update(Observable o, Object arg) { Action action = (Action) arg; System.out.println("Action add"); actionList.add(action); listModel.addElement(window.getActionsName()[action.getAction()][window.getSelectedLenguage()]); }
public GoogleCalendarPanel(CalendarTaskManager calendarManager) { // style this element as absolute position DOM.setStyleAttribute(this.getElement(), "position", "absolute"); calendarTaskManager = calendarManager; configureCalendar(); createDatePickerDialog(); setHeaderVisible(false); setBodyBorder(false); setBorders(false); setTopComponent(createCalendarToolbar()); add(calendar); // window events to handle resizing Window.enableScrolling(false); Window.addResizeHandler( new ResizeHandler() { public void onResize(ResizeEvent event) { resizeTimer.schedule(500); int h = event.getHeight(); } }); DeferredCommand.addCommand( new Command() { public void execute() { LayoutContainer center = (LayoutContainer) Registry.get(AppView.CENTER_PANEL); calendar.setHeight(center.getHeight() - calendarHeightSize + "px"); } }); }
public void render() { if (canvas.isVisible()) { GL11.glViewport(0, 0, window.getCanvas().getWidth(), window.getCanvas().getHeight()); window.render(); scene.render(); } }
static void subscribeTo(NavBarPanel panel) { if (panel.getClientProperty(LISTENER) != null) { unsubscribeFrom(panel); } final NavBarListener listener = new NavBarListener(panel); final Project project = panel.getProject(); panel.putClientProperty(LISTENER, listener); KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(listener); FileStatusManager.getInstance(project).addFileStatusListener(listener); PsiManager.getInstance(project).addPsiTreeChangeListener(listener); WolfTheProblemSolver.getInstance(project).addProblemListener(listener); ActionManager.getInstance().addAnActionListener(listener); final MessageBusConnection connection = project.getMessageBus().connect(); connection.subscribe(ProjectTopics.PROJECT_ROOTS, listener); connection.subscribe(NavBarModelListener.NAV_BAR, listener); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, listener); panel.putClientProperty(BUS, connection); panel.addKeyListener(listener); if (panel.isInFloatingMode()) { final Window window = SwingUtilities.windowForComponent(panel); if (window != null) { window.addWindowFocusListener(listener); } } }
public final boolean isAlphaModeEnabled(final Window window) { if (!window.isDisplayable() || !window.isShowing()) { throw new IllegalArgumentException( "window must be displayable and showing. window=" + window); } return isAlphaModeSupported(); }
private void close() { Window window = getWindow(); if (window != null) { window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING)); } }
/** Returns the popup type to use for the specified parameters. */ private int getPopupType(Component owner, Component contents, int ownerX, int ownerY) { int popupType = getPopupType(); if (owner == null || invokerInHeavyWeightPopup(owner)) { popupType = HEAVY_WEIGHT_POPUP; } else if (popupType == LIGHT_WEIGHT_POPUP && !(contents instanceof JToolTip) && !(contents instanceof JPopupMenu)) { popupType = MEDIUM_WEIGHT_POPUP; } // Check if the parent component is an option pane. If so we need to // force a heavy weight popup in order to have event dispatching work // correctly. Component c = owner; while (c != null) { if (c instanceof JComponent) { if (((JComponent) c).getClientProperty(PopupFactory_FORCE_HEAVYWEIGHT_POPUP) == Boolean.TRUE) { popupType = HEAVY_WEIGHT_POPUP; break; } } else if (c instanceof Window) { Window w = (Window) c; if (!w.isOpaque() || w.getOpacity() < 1 || w.getShape() != null) { popupType = HEAVY_WEIGHT_POPUP; break; } } c = c.getParent(); } return popupType; }
void test3(Window owner, Window child1, Window child2) { System.out.println("* * * STAGE 3 * * *\nWidow owner: " + owner); owner.setFocusableWindowState(true); owner.setVisible(true); child1.setFocusableWindowState(false); child1.setVisible(true); child2.setFocusableWindowState(true); child2.add(button); child2.setVisible(true); Util.waitTillShown(child2); Util.clickOnComp(button, robot); System.err.println( "focus owner: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()); if (button != KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) { throw new RuntimeException("Test failed."); } child1.dispose(); child2.dispose(); owner.dispose(); }
/** Restores the screen's display mode. */ public void restoreScreen() { Window window = device.getFullScreenWindow(); if (window != null) { window.dispose(); } device.setFullScreenWindow(null); }
static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { Window owner = (peer != null ? peer.getTarget().getOwner() : null); while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { owner = owner.getOwner(); } return owner != null ? (LWWindowPeer) owner.getPeer() : null; }
/** Recupera el modo de pantalla no completa */ public void recuperarPantalla() { Window window = device.getFullScreenWindow(); if (window != null) { window.dispose(); } device.setFullScreenWindow(null); }
public void setWakeLock(){ Window window = getWindow(); if(window != null){ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); AppLogs.d("!!Scanner", "wakelock set"); } }
private void updateSystemIcon() { Window window = getWindow(); if (window == null) { mySystemIcon = null; return; } List<Image> icons = window.getIconImages(); assert icons != null; if (icons.size() == 0) { mySystemIcon = null; } else if (icons.size() == 1) { mySystemIcon = icons.get(0); } else { final JBDimension size = JBUI.size(32); final Image image = icons.get(0); mySystemIcon = Scalr.resize( ImageUtil.toBufferedImage(image), Scalr.Method.ULTRA_QUALITY, size.width, size.height); } }
private void disposeAndUpdate(boolean update) { if (myView != null) { boolean visible = myView.isVisible(); myView.setVisible(false); Container container = myContent.getParent(); if (container != null) { container.remove(myContent); } if (myView instanceof Window) { myViewBounds = myView.getBounds(); Window window = (Window) myView; if (!push(UIUtil.getWindow(myOwner), window)) { window.dispose(); } } else { Container parent = myView.getParent(); if (parent == null) { myViewBounds = new Rectangle(myContent.getPreferredSize()); } else { myViewBounds = new Rectangle(myView.getBounds()); parent.remove(myView); Point point = new Point(myViewBounds.x, myViewBounds.y); SwingUtilities.convertPointToScreen(point, parent); myViewBounds.x = point.x; myViewBounds.y = point.y; } } myView = null; if (update && visible) { setVisible(true); } } }
/** * Tries to load/restore the window state of the given window. * * @param aNamespace the namespace to use for the window state; * @param aProperties the properties to read from; * @param aWindow the window to load the state for. */ public static void loadWindowState(final Preferences aProperties, final Window aWindow) { // Special case: for FileDialog/JFileChooser we also should restore the // properties... loadFileDialogState(aProperties, aWindow); try { final int xPos = aProperties.getInt("winXpos", -1); final int yPos = aProperties.getInt("winYpos", -1); if ((xPos >= 0) && (yPos >= 0)) { aWindow.setLocation(xPos, yPos); } } catch (NumberFormatException exception) { // Ignore... } if (isNonResizableWindow(aWindow)) { // In case the window cannot be resized, don't restore its width & // height... return; } try { final int width = aProperties.getInt("winWidth", -1); final int height = aProperties.getInt("winHeight", -1); if ((width >= 0) && (height >= 0)) { aWindow.setSize(width, height); } } catch (NumberFormatException exception) { // Ignore... } }
public void thing() { glFrontFace(GL_CW); glCullFace(GL_BACK); glEnable(GL_TEXTURE_2D); glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glActiveTexture(GL_TEXTURE0); GL11.glViewport(0, 0, window.getCanvas().getWidth(), window.getCanvas().getHeight()); scene.init(this); // these variables are here purely for ease of reading // i could just pass in the lastTime and time into update. // delta is necessary to not see any Jumps if the framerates gets lower(if you have a framerate // of 60 and do something like move(5) it will move 5 units 60 times per seconds // while if you have 30 fps it would only update 30 times per second so if you do move(5 * // delta) it doesnt matter what fps you have the object will move the same distance; float lastTime = (float) System.nanoTime() / (float) 1000000000L; float delta = 0; while (running) { float time = (float) System.nanoTime() / (float) 1000000000L; delta = time - lastTime; update(delta); delta = 0; render(); lastTime = time; } destroy(); }
// get out of full screen public void restoreScreen() { Window w = vc.getFullScreenWindow(); if (w != null) { w.dispose(); } vc.setFullScreenWindow(null); }
@Override public void actionPerformed(ActionEvent e) { if (window.getObjectsName()[10][window.getSelectedLenguage()] == e.getActionCommand()) { /* ACCEPTED */ System.out.println("accepted"); if (buzon == null) return; acceptButton.setEnabled(false); denyButton.setEnabled(false); inputLabel.setText(defaultMessage); buzon.send("ACCEPTED"); buzon = null; } if (window.getObjectsName()[11][window.getSelectedLenguage()] == e.getActionCommand()) { /* DENIED */ System.out.println("denied"); if (buzon == null) return; buzon.send("DENIED"); acceptButton.setEnabled(false); denyButton.setEnabled(false); inputLabel.setText(defaultMessage); buzon = null; } }
@Test(expected = IllegalArgumentException.class) public void testInitializationFailure() throws IOException { try (Window w = new Window(MOCK_CHANNEL, null, true, true)) { w.init(initialSize, packetSize, Collections.<String, Object>emptyMap()); fail("Unexpected success for initialiSize=" + initialSize + ", packetSize=" + packetSize); } }
private void showJPopupMenu(MouseEvent e) { try { if (e.isPopupTrigger() && menu != null) { if (window == null) { if (isWindows) { window = new JDialog((Frame) null); ((JDialog) window).setUndecorated(true); } else { window = new JWindow((Frame) null); } window.setAlwaysOnTop(true); Dimension size = menu.getPreferredSize(); Point centerPoint = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); if (e.getY() > centerPoint.getY()) window.setLocation(e.getX(), e.getY() - size.height); else window.setLocation(e.getX(), e.getY()); window.setVisible(true); menu.show(((RootPaneContainer) window).getContentPane(), 0, 0); // popup works only for focused windows window.toFront(); } } } catch (Exception ignored) { } }
private void maybeShowFor(Component c, MouseEvent me) { if (!(c instanceof JComponent)) return; JComponent comp = (JComponent) c; Window wnd = SwingUtilities.getWindowAncestor(comp); if (wnd == null) return; if (!wnd.isActive()) { if (JBPopupFactory.getInstance().isChildPopupFocused(wnd)) return; } String tooltipText = comp.getToolTipText(me); if (tooltipText == null || tooltipText.trim().isEmpty()) return; boolean centerDefault = Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_DEFAULT)); boolean centerStrict = Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_STRICT)); int shift = centerStrict ? 0 : centerDefault ? 4 : 0; // Balloon may appear exactly above useful content, such behavior is rather annoying. if (c instanceof JTree) { TreePath path = ((JTree) c).getClosestPathForLocation(me.getX(), me.getY()); if (path != null) { Rectangle pathBounds = ((JTree) c).getPathBounds(path); if (pathBounds != null && pathBounds.y + 4 < me.getY()) { shift += me.getY() - pathBounds.y - 4; } } } queueShow(comp, me, centerStrict || centerDefault, shift, -shift, -shift); }
static void reqListProperties(Client c) throws IOException { int foo, n; IO io = c.client; foo = io.readInt(); Window w = c.lookupWindow(foo); c.length -= 2; if (w == null) { c.errorValue = foo; c.errorReason = 3; // BadWindow; return; } synchronized (io) { io.writeByte(1); Property p = w.getProperty(); int i = 0; while (p != null) { i++; p = p.next; } io.writePad(1); io.writeShort(c.seq); io.writeInt(i); io.writeShort(i); io.writePad(22); p = w.getProperty(); while (p != null) { io.writeInt(p.propertyName); p = p.next; } io.flush(); } }
/** Notifies all views of a data reference change. */ public void init() { final Data data = initHistory(gui.context); if (data != null) { // if a large database is opened, the user is asked if complex /// visualizations should be closed first final long size = data.meta.dbsize(); boolean open = false; for (final View v : view) open |= v.visible() && v.db(); if (open && size > LARGEDB && BaseXDialog.confirm(gui, Util.info(H_LARGE_DB, Performance.format(size)))) { for (final View v : view) if (v.visible() && v.db()) v.visible(false); } } else { // database closed: close open dialogs for (final Window w : gui.getOwnedWindows()) { if (w.isVisible() && w instanceof BaseXDialog) ((BaseXDialog) w).cancel(); } } gui.context.focused = -1; for (final View v : view) v.refreshInit(); gui.layoutViews(); gui.setTitle(data != null ? data.meta.name : null); }
protected void applyWindowLevel(Window target) { if (target.isAlwaysOnTop() && target.getType() != Window.Type.POPUP) { CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel); } else if (target.getType() == Window.Type.POPUP) { CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSPopUpMenuWindowLevel); } }
/* * Retrieves the owner of the peer. * Note: this method returns the owner which can be activated, (i.e. the instance * of Frame or Dialog may be returned). */ static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { Window owner = (peer != null ? peer.getTarget().getOwner() : null); while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { owner = owner.getOwner(); } return owner == null ? null : (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner); }
public void mouseMoved(MouseEvent ev) { JRootPane root = getRootPane(); if (root.getWindowDecorationStyle() == JRootPane.NONE) { return; } Window w = (Window) ev.getSource(); Frame f = null; Dialog d = null; if (w instanceof Frame) { f = (Frame) w; } else if (w instanceof Dialog) { d = (Dialog) w; } // Update the cursor int cursor = getCursor(calculateCorner(w, ev.getX(), ev.getY())); if (cursor != 0 && ((f != null && (f.isResizable() && (f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0)) || (d != null && d.isResizable()))) { w.setCursor(Cursor.getPredefinedCursor(cursor)); } else { w.setCursor(lastCursor); } }
@Override public void init() { setMainWindow(mainWindow); setTheme("bluesmoke"); helper = new SpringContextHelper(this); feed = (OHLCFeed) helper.getBean("feed"); correlatorPool = (CorrelatorPool) helper.getBean("correlatorPool"); correlatorBuilderManager = (CorrelatorBuilderManager) helper.getBean("correlatorBuilderManager"); emulator = (PassageOfTimeEmulationWorker) helper.getBean("emulator"); buildMainLayout(); mainWindow.setContent(mainLayout); mainLayout.setSizeFull(); mainWindow.addListener( new Window.CloseListener() { public void windowClose(Window.CloseEvent e) { analytics.terminate(); } }); mainWindow.addListener( new Window.ResizeListener() { public void windowResized(Window.ResizeEvent e) { analytics.resize(); } }); mainWindow.addComponent(pusher); }