⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 minibar.java

📁 java 文件下载器。可自定义
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			public void mouseUp(MouseEvent e)
			{
				moving = false;
			}

			
			{
				this$0 = MiniBar.this;
				super();
			}
		};
		mMoveListener = new MouseMoveListener() {

			final MiniBar this$0;

			public void mouseMove(MouseEvent e)
			{
				if (moving)
				{
					int dX = xPressed - e.x;
					int dY = yPressed - e.y;
					Point currentLoc = splash.getLocation();
					currentLoc.x -= dX;
					currentLoc.y -= dY;
					setSnapLocation(currentLoc);
				}
			}

			
			{
				this$0 = MiniBar.this;
				super();
			}
		};
		splash.setBackground(Colors.blues[0]);
		splash.setForeground(Colors.blues[9]);
		splash.addMouseListener(mListener);
		splash.addMouseMoveListener(mMoveListener);
		lDrag.addMouseListener(mListener);
		lDrag.addMouseMoveListener(mMoveListener);
		menu = new Menu(splash, 8);
		MenuBuildUtils.addMaintenanceListenerForMenu(menu, this);
		beginConstruction();
		splash.addListener(20, new Listener() {

			final MiniBar this$0;

			public void handleEvent(Event e)
			{
				splash.setVisible(true);
				splash.setActive();
			}

			
			{
				this$0 = MiniBar.this;
				super();
			}
		});
		splash.setSize(xSize + 3, hSize + 2);
		mListener = null;
		mMoveListener = null;
		menu = null;
		refresh();
		constructing = false;
		constructed = true;
		Point point = getInitialLocation();
		if (point != null)
			splash.setLocation(point);
		splash.setVisible(true);
	}

	public void buildMenu(Menu menu)
	{
		Object plugin_context_obj = getPluginMenuContextObject();
		Object plugin_context_obj_arg[] = null;
		if (plugin_context_obj != null)
			plugin_context_obj_arg = (new Object[] {
				plugin_context_obj
			});
		String plugin_menu_ids[] = getPluginMenuIdentifiers(plugin_context_obj);
		if (plugin_menu_ids != null)
		{
			org.gudy.azureus2.plugins.ui.menus.MenuItem menu_items[] = MenuItemManager.getInstance().getAllAsArray(plugin_menu_ids);
			if (menu_items.length > 0)
			{
				MenuBuildUtils.addPluginMenuItems(splash, menu_items, menu, true, true, new org.gudy.azureus2.ui.swt.MenuBuildUtils.MenuItemPluginMenuControllerImpl(plugin_context_obj_arg));
				new MenuItem(menu, 2);
			}
		}
		MenuItem itemClose = new MenuItem(menu, 0);
		itemClose.setText(MessageText.getString("wizard.close"));
		itemClose.addListener(13, new Listener() {

			final MiniBar this$0;

			public void handleEvent(Event e)
			{
				close();
			}

			
			{
				this$0 = MiniBar.this;
				super();
			}
		});
	}

	protected final void setSnapLocation(Point currentLoc)
	{
		MiniBarManager g_manager;
		Rectangle dim = new Rectangle(currentLoc.x, currentLoc.y, splash.getBounds().width, splash.getBounds().height);
		int topIntersectArea = 0;
		int bestScreen = 0;
		for (int i = 0; i < screens.length; i++)
		{
			Rectangle curScreen = screens[i].getClientArea();
			curScreen.intersect(dim);
			int area = curScreen.width * curScreen.height;
			if (area > topIntersectArea)
			{
				bestScreen = i;
				topIntersectArea = area;
			}
		}

		Rectangle screen = screens[bestScreen].getClientArea();
		if (currentLoc.x - screen.x < 10)
			currentLoc.x = screen.x;
		else
		if (currentLoc.x - screen.x > screen.width - dim.width - 10)
			currentLoc.x = (screen.x + screen.width) - dim.width;
		if (currentLoc.y - screen.y < 10)
			currentLoc.y = screen.y;
		MiniBar mw = this;
		int height = 0;
		do
		{
			if (mw == null)
				break;
			Shell s = mw.getShell();
			if (s.isDisposed())
			{
				mw = null;
			} else
			{
				height += s.getBounds().height - 1;
				mw = mw.getStucked();
				if (mw == this)
					mw = null;
			}
		} while (true);
		if (currentLoc.y - screen.y > screen.height - height - 10)
			currentLoc.y = (screen.y + screen.height) - height;
		g_manager = MiniBarManager.getManager();
		g_manager.getMiniBarMonitor().enter();
		if (g_manager.countMiniBars() > 1)
		{
			Iterator itr = g_manager.getMiniBarIterator();
			do
			{
				if (!itr.hasNext())
					break;
				MiniBar downloadBar = (MiniBar)itr.next();
				Point location = downloadBar.getShell().getLocation();
				location.y += downloadBar.getShell().getBounds().height;
				if ((downloadBar != this && downloadBar.getStucked() == null || downloadBar.getStucked() == this) && Math.abs(location.x - currentLoc.x) < 10 && location.y - currentLoc.y < 10 && location.y - currentLoc.y > 0)
				{
					downloadBar.setStucked(this);
					currentLoc.x = location.x;
					currentLoc.y = location.y - 1;
				}
				if (downloadBar != this && downloadBar.getStucked() == this && (Math.abs(location.x - currentLoc.x) > 10 || Math.abs(location.y - currentLoc.y) > 10))
					downloadBar.setStucked(null);
			} while (true);
		}
		g_manager.getMiniBarMonitor().exit();
		break MISSING_BLOCK_LABEL_582;
		Exception exception;
		exception;
		g_manager.getMiniBarMonitor().exit();
		throw exception;
		splash.setLocation(currentLoc);
		for (MiniBar mwCurrent = this; mwCurrent != null;)
		{
			currentLoc.y += mwCurrent.getShell().getBounds().height - 1;
			MiniBar mwChild = mwCurrent.getStucked();
			if (mwChild != null && mwChild != this)
			{
				Shell s = mwChild.getShell();
				if (s.isDisposed())
				{
					mwCurrent.setStucked(null);
					mwCurrent = null;
				} else
				{
					mwCurrent = mwChild;
					mwCurrent.getShell().setLocation(currentLoc);
				}
			} else
			{
				mwCurrent = null;
			}
		}

		return;
	}

	public Shell getShell()
	{
		return splash;
	}

	public void setVisible(boolean visible)
	{
		splash.setVisible(visible);
	}

	public final boolean hasSameContext(MiniBar m)
	{
		return hasContext(m.getContextObject());
	}

	public final boolean hasContext(Object context)
	{
		Object my_context = getContextObject();
		if (my_context == null)
			return context == null;
		else
			return my_context.equals(context);
	}

	public MiniBar getStucked()
	{
		return stucked;
	}

	public void setStucked(MiniBar mw)
	{
		stucked = mw;
	}

	public final void forceSaveLocation()
	{
		if (!splash.isDisposed())
			storeLastLocation(splash.getLocation());
	}

	public final void close()
	{
		if (!splash.isDisposed())
		{
			Display display = splash.getDisplay();
			if (display != null && !display.isDisposed())
				display.asyncExec(new AERunnable() {

					final MiniBar this$0;

					public void runSupport()
					{
						dispose();
					}

			
			{
				this$0 = MiniBar.this;
				super();
			}
				});
		}
		manager.unregister(this);
	}

	public void dispose()
	{
		if (!splash.isDisposed())
		{
			forceSaveLocation();
			splash.dispose();
		}
		if (bold_font != null && !bold_font.isDisposed())
			bold_font.dispose();
	}

	public final void refresh()
	{
		if (splash.isDisposed())
		{
			return;
		} else
		{
			refresh0();
			return;
		}
	}

	protected abstract void refresh0();

	protected abstract void beginConstruction();

	protected abstract Object getContextObject();

	public String[] getPluginMenuIdentifiers(Object context)
	{
		return null;
	}

	public Object getPluginMenuContextObject()
	{
		return null;
	}

	protected Point getInitialLocation()
	{
		return null;
	}

	protected void storeLastLocation(Point point1)
	{
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -